diff --git a/lime/_backend/native/NativeApplication.hx b/lime/_backend/native/NativeApplication.hx index 2fb32b32a..fc8645d0e 100644 --- a/lime/_backend/native/NativeApplication.hx +++ b/lime/_backend/native/NativeApplication.hx @@ -104,7 +104,9 @@ class NativeApplication { #elseif (cpp || neko) - return lime_application_exec (handle); + var result = lime_application_exec (handle); + __cleanup (); + return result; #else diff --git a/project/src/backend/sdl/SDLApplication.cpp b/project/src/backend/sdl/SDLApplication.cpp index 33241e3a1..6b25475b4 100644 --- a/project/src/backend/sdl/SDLApplication.cpp +++ b/project/src/backend/sdl/SDLApplication.cpp @@ -135,6 +135,13 @@ namespace lime { ProcessGamepadEvent (event); break; + case SDL_FINGERMOTION: + case SDL_FINGERDOWN: + case SDL_FINGERUP: + + ProcessTouchEvent (event); + break; + case SDL_JOYAXISMOTION: case SDL_JOYBALLMOTION: case SDL_JOYBUTTONDOWN: @@ -159,13 +166,6 @@ namespace lime { ProcessMouseEvent (event); break; - - case SDL_FINGERMOTION: - case SDL_FINGERDOWN: - case SDL_FINGERUP: - - ProcessTouchEvent (event); - break; case SDL_TEXTINPUT: case SDL_TEXTEDITING: @@ -394,39 +394,41 @@ namespace lime { void SDLApplication::ProcessTouchEvent (SDL_Event* event) { - + if (TouchEvent::callback) { - + switch (event->type) { + case SDL_FINGERMOTION: - + touchEvent.type = TOUCH_MOVE; touchEvent.x = event->tfinger.x; touchEvent.y = event->tfinger.y; touchEvent.id = event->tfinger.fingerId; break; - + case SDL_FINGERDOWN: - + touchEvent.type = TOUCH_START; touchEvent.x = event->tfinger.x; touchEvent.y = event->tfinger.y; touchEvent.id = event->tfinger.fingerId; break; - + case SDL_FINGERUP: - + touchEvent.type = TOUCH_END; touchEvent.x = event->tfinger.x; touchEvent.y = event->tfinger.y; touchEvent.id = event->tfinger.fingerId; break; + } - + TouchEvent::Dispatch (&touchEvent); - + } - + } diff --git a/project/src/utils/Bytes.cpp b/project/src/utils/Bytes.cpp index 679cafdad..15912af29 100644 --- a/project/src/utils/Bytes.cpp +++ b/project/src/utils/Bytes.cpp @@ -83,8 +83,8 @@ namespace lime { } lime::fseek (file, 0, SEEK_END); - int size = lime::ftell (file); + lime::fseek (file, 0, SEEK_SET); if (size > 0) { @@ -94,7 +94,6 @@ namespace lime { } lime::fclose (file); - delete file; }