intjelic / esfml Goto Github PK
View Code? Open in Web Editor NEWSFML for supporting OpenGL ES available for smartphones/tablets
License: Other
SFML for supporting OpenGL ES available for smartphones/tablets
License: Other
Whether this should be in another branch or under some folder, each feature of SFML should be tested. Just to make sure things actually work. It's also possible to add these to the example, though that might make it more complicated than an example should be.
Consider not supporting Temperature, as it was officially deprecated in API 14. Also consider not supporting Orientation, as it was officially deprecated in API 8 (though some kind of method to equivalent to [SensorManager.getOrientation()
](http://developer.android.com/reference/android/hardware/SensorManager.html#getOrientation%28float[], float[]%29) should be considered).
SFML's Joystick may be a sensible way to provide access to these sensors.
I was kinda confuse when I wrote it. There was thousand of settings and couldn't find out how to write an equivalent algorithm to how GlContext does.
Running a demo, stopping it (by hitting the home button, not the back button), and then resuming it crashes the emulator. Code:
#include <sfml/system.hpp>
#include <sfml/window.hpp>
#include <sfml/graphics.hpp>
#include <sfml/audio.hpp>
int main(int argc, char *argv[])
{
sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "");
sf::Texture texture;
if(!texture.loadFromFile("image.png"))
return EXIT_FAILURE;
sf::Sprite sprite(texture);
sf::Vector2u imageSize = texture.getSize();
sprite.setOrigin(imageSize.x/2, imageSize.y/2);
// Set the world's center to the center of the screen
sf::View view = window.getView();
view.setCenter(0, 0);
window.setView(view);
while (window.isOpen())
{
sf::Event event;
if (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
window.close();
}
else if (event.type == sf::Event::MouseMoved)
{
// Move the sprite to the finger's location
sf::Vector2i pixelPos(event.mouseMove.x, event.mouseMove.y);
sf::Vector2f worldPos = window.mapPixelToCoords(pixelPos);
sprite.setPosition(worldPos);
}
else if (event.type == sf::Event::Resized)
{
// Resize the view so it's not stretched
sf::View view = window.getView();
view.setSize((float)event.size.width, (float)event.size.height);
window.setView(view);
}
else if (event.type == sf::Event::LostFocus)
{
bool powerSave = true;
while (powerSave)
{
while (window.pollEvent(event))
{
if (event.type == sf::Event::GainedFocus)
{
powerSave = false;
break;
}
else if (event.type == sf::Event::Closed)
{
powerSave = false;
window.close();
break;
}
}
sf::sleep(sf::milliseconds(250));
}
}
}
window.clear(sf::Color::Green);
window.draw(sprite);
window.display();
}
}
It doesn't reuse existing builds. It should only compile modified files and regenerate the libraries they belong to.
These errors keep populating my logcat. I'll look into them and try to fix them.
SFML users may want to provide haptic feedback to their app users. Access to the vibration hardware needs to be provided.
Right now it is impossible to set NDK_PATH
and CMAKE_INSTALL_PREFIX
with CMake, as both variables are modified every time CMake is invoked (through cmake/Platform/Android.cmake
).
The above mentioned file will try to determine the NDK path every time it runs, ignoring any previously set path. If none of the given environment variables is set (NDK
, NDK_PATH
, or ANDROID_NDK
), it's impossible to install the built files, even if you've properly set CMAKE_INSTALL_PREFIX
, as it's value will be reset to contain the default /path/to/the/NDK
.
Specifically, the zooming gesture can be very useful in games (especially on a small screen). The GestureDetector
class can, in theory, be called from the native code via the JNI. How to best expose this to the SFML user though, is unknown.
Vanilla OpenGL ES 1.x versions don't support FBO and this task should be performed with EGL rendering surface. However, there's a OES extension which add FBO support so, if this extension is available, use it, otherwise fall-back to EGL rendering surfaces.
Even with the required permissions :( It's OpenAL Soft's job to handle that stuff but it seems to fail.
You'll see obj/ directories after a build.
It's more exciting :p
SFML's Joystick could be useful in implementing this.
Open and close the device later, when needed instead of doing this in the constructor/destructor.
When drawing something at position (0, 0), it doesn't get displayed at the left/top corner of the screen. To solve that, I modified the default view of sf::Window but this is more a work around than a fix.
sfml-main, main.cpp has:
while (!states->initialized)
{
states->mutex.unlock();
sf::sleep(sf::milliseconds(20));
states->mutex.lock();
}
The compiler may optimize away the retrieval of the value of states->initialized
. The initialized
should be volatile
to force a memory access.
Additionally, mutexes aren't necessary for simple flag checking like this, though this isn't related to the potential bug.
When docking or undocking the keyboard on an Asus Transformer Prime, while the SFML app is running, it will segfault.
This seems to happen with any app using SFML, at least my own game as well as the example app.
Logcat:
I/DEBUG ( 115): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
GDB back trace:
0x407a0e88 in ?? ()
0x400f6c90 in __sflush_locked ()
from <path>/libc.so
0x00000000 in ?? ()
Subject pretty much sums it up.
If I try to draw sf::VertexArray(sf::Quads)
with four vertices nothing happens at all. Will probably try to fix it on my own once I've got some time, but don't want it getting lost.
The makefiles created with CMake fail to process properly, because they try to set environment variables the Unix/bash way.
The command line created in Macros.cmake has the following form:
NDK_PROJECT_PATH=/some/path/somewhere NDK_MODULE_PATH=/some/other/path /path/to/ndk/ndk-build ...
For this to properly work under Windows it would have to follow this pattern:
set NDK_PROJECT_PATH=/some/path/somewhere && set NDK_MODULE_PATH=/some/other/path && /path/to/ndk/ndk-build ...
Mobile devices have a huge range in their screens' DPI. SFML users might need to change their scaling/sizing depending on the device's physical size and DPI. Simply getting the number of pixels in the screen does not provide enough information.
A double allocation and memory copy is performed when loading files with asset library. Currently, it first copies a file into memory, then call loadFromMemory()
which copies our fresh copy, again. We should use sf::InputStream and use loadFromStream()
instead.
Simply creating an sf::Music
, for example (which results in the AudioDevice
being created and setting up OpenAL) results in the following log messages when closing the app:
05-25 17:09:00.733: D/dalvikvm(9473): threadid=11: thread exiting, not yet detached (count=0)
05-25 17:09:00.733: D/dalvikvm(9473): threadid=11: thread exiting, not yet detached (count=1)
05-25 17:09:00.738: E/dalvikvm(9473): threadid=11: native thread exited without detaching
05-25 17:09:00.738: E/dalvikvm(9473): VM aborting
05-25 17:09:00.738: A/libc(9473): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)
Not creating an sf::Music
results in proper termination. I'm not sure if this is a bug in OpenAL or if we're not shutting OpenAL down properly. I'm also unsure if this is caused by OpenAL's internal threads, or if its creating problems with our own threads.
If I code an Android app, I'd like SFML to take care of drawing stuff and so embed SFML (SFML Canvas as we do for integrating SFML to Gtk, Qt, etC.)
In void VideoRecorder::start(unsigned int frameRate), it should have a code that checks and prevents a second video capture from running at the same time.
It should print this message: "Trying to start video capture, but another capture is already running", then return.
The activity's start/stop events can be used to inform the user of the app gaining/losing focus.
I'm not sure if the activity pausing should be part of losing focus or not.
So far, sf::Text renders badly. I suspect something with sf::Texture::copyToImage().
Currently, only single touch is supported.
After compiling/installing esfml in android-ndk-r9, launching the android example on a nexus4 running cyanogenmod 10.1.2 (android 4.2.2) crashes.
However, launching the same app on the emulator didn't crash (the action bar disappeared and the screen remained white and there was some choppy sound)
Note that I was able to compile and run this project on the phone: http://code.google.com/p/android-native-egl-example/
I would love to help and debug if I can.
Following is the log in logcat:
08-07 23:50:00.666: D/libEGL(13867): loaded /system/lib/egl/libEGL_adreno200.so
08-07 23:50:00.666: D/libEGL(13867): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
08-07 23:50:00.676: D/libEGL(13867): loaded /system/lib/egl/libGLESv2_adreno200.so
08-07 23:50:00.686: I/Adreno200-EGL(13867): <eglInitialize:269>: EGL 1.4 QUALCOMM build: Nondeterministic AU_full_mako_PARTNER-ANDROID/JB-MR1-DEV_CL2961380_release_AU (CL2961380)
08-07 23:50:00.686: I/Adreno200-EGL(13867): Build Date: 12/10/12 Mon
08-07 23:50:00.686: I/Adreno200-EGL(13867): Local Branch:
08-07 23:50:00.686: I/Adreno200-EGL(13867): Remote Branch: m/partner-android/jb-mr1-dev
08-07 23:50:00.686: I/Adreno200-EGL(13867): Local Patches: NONE
08-07 23:50:00.686: I/Adreno200-EGL(13867): Reconstruct Branch: NOTHING
08-07 23:50:01.206: W/Adreno200-EGL(13867): <eglMakeCurrent:2857>: EGL_BAD_ALLOC
08-07 23:50:01.206: E/libEGL(13867): eglMakeCurrent:593 error 3003 (EGL_BAD_ALLOC)
08-07 23:50:01.216: W/Adreno200-EGL(13867): <eglMakeCurrent:2857>: EGL_BAD_ALLOC
08-07 23:50:01.216: E/libEGL(13867): eglMakeCurrent:593 error 3003 (EGL_BAD_ALLOC)
[...] snip many lines like the errors above
The android example app doesn't play sound anymore. @MarioLiebisch reports the same problem in #27 (comment)
After fixing #22 I noticed that closing the app (by hitting the back button) and then restarting it results in an immediate crash of the app. I debugged the issue as much as I could today and found that the crash was occurring in the Android VideoModeImpl
when using the pointer returned by sf::priv::getActivityStates(NULL)
(in the getScreenSize()
function when creating the default desktop mode for creating a sf::RenderWindow
). The pointer returned by sf::priv::getActivityStates(NULL)
is the pointer from the previous execution, not the current execution (despite other calls to sf::priv::getActivityStates(NULL)
being fine, like in onNativeWindowCreated()
), and the usage of the mutex results in a crash.
Re-running the app after a crash results in the app running just fine. Re-running the app after a successful execution results in a crash. I tried reverting to some earlier versions but found this behavior to persist.
I think proper condition variables (like needed in #15) might help in fixing this. However, more time will have to be spent debugging this to find the exact cause and proper solution.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.