Giter Club home page Giter Club logo

esfml's People

Contributors

abodelot avatar amdmi3 avatar arnolddumas avatar binary1248 avatar bluecobold avatar bmburstein avatar bromeon avatar ceylo avatar dermoumi avatar eatse21 avatar expl0it3r avatar firefly2442 avatar frex avatar grandseiken avatar intjelic avatar jcowgill avatar kimci86 avatar laurentgomila avatar ltwardus avatar mantognini avatar marioliebisch avatar tankos avatar thknepper avatar tomgalvin594 avatar valloric avatar varnie avatar vhab avatar wintertime avatar zerphmm avatar zsbzsb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esfml's Issues

Create unit tests to test SFML on Android

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.

Provide access to device sensors

Android sensors.

  • Accelerometer
  • Ambient Temperature
  • Gravity
  • Gyroscope
  • Light
  • Linear Acceleration
  • Magnetic Field
  • Orientation
  • Pressure
  • Proximity
  • Relative Humidity
  • Rotation Vector
  • Temperature

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.

Resuming app crashes emulator

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();
    }
}

NDK_PATH can't be set manually without using environment variables

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.

Support gesture detection

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.

Support sf::RenderTexture

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.

Drawing area is shifted

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.

Potential bug with compiler optimizations and initialization

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.

SegFault when (un-)docking Keyboard Dock

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 ?? ()

VertexArrays with sf::Quads won't render

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.

CMake: Invalid commands in makefiles when compiling on Windows

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 ...

Provide a way to get the device's physical size (and/or DPI)

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.

Double allocation when loading files with asset library

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.

Initializing OpenAL results in seg fault

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.

Prevent two video captures from running at the same time

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.

Inform the user when focus is lost/gained

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.

Fix sf::Text

So far, sf::Text renders badly. I suspect something with sf::Texture::copyToImage().

android: example app crashes on startup

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

Restarting app results in crash

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.