| @@ -22,6 +22,7 @@ liblol_a_SOURCES = \ | |||||
| $(xbox_sources) \ | $(xbox_sources) \ | ||||
| $(nacl_sources) \ | $(nacl_sources) \ | ||||
| $(sdl_sources) \ | $(sdl_sources) \ | ||||
| $(android_sources) \ | |||||
| \ | \ | ||||
| thread/threadbase.h thread/thread.h \ | thread/threadbase.h thread/thread.h \ | ||||
| \ | \ | ||||
| @@ -31,11 +32,8 @@ liblol_a_SOURCES = \ | |||||
| gpu/vbo.cpp gpu/vbo.h \ | gpu/vbo.cpp gpu/vbo.h \ | ||||
| \ | \ | ||||
| image/image.cpp image/image.h image/image-private.h \ | image/image.cpp image/image.h image/image-private.h \ | ||||
| image/codec/android-image.cpp \ | |||||
| image/codec/gdiplus-image.cpp \ | image/codec/gdiplus-image.cpp \ | ||||
| image/codec/ios-image.cpp \ | image/codec/ios-image.cpp \ | ||||
| image/codec/sdl-image.cpp \ | |||||
| image/codec/ps3-image.cpp \ | |||||
| image/codec/dummy-image.cpp \ | image/codec/dummy-image.cpp \ | ||||
| \ | \ | ||||
| loldebug.h \ | loldebug.h \ | ||||
| @@ -45,6 +43,7 @@ liblol_a_SOURCES = \ | |||||
| liblol_a_CPPFLAGS = @LOL_CFLAGS@ | liblol_a_CPPFLAGS = @LOL_CFLAGS@ | ||||
| sdl_sources = \ | sdl_sources = \ | ||||
| image/codec/sdl-image.cpp \ | |||||
| platform/sdl/sdlapp.cpp platform/sdl/sdlapp.h \ | platform/sdl/sdlapp.cpp platform/sdl/sdlapp.h \ | ||||
| platform/sdl/sdlinput.cpp platform/sdl/sdlinput.h | platform/sdl/sdlinput.cpp platform/sdl/sdlinput.h | ||||
| @@ -59,6 +58,7 @@ endif | |||||
| if HAVE_PS3 | if HAVE_PS3 | ||||
| ps3_sources = \ | ps3_sources = \ | ||||
| image/codec/ps3-image.cpp \ | |||||
| platform/ps3/threadbase.h \ | platform/ps3/threadbase.h \ | ||||
| platform/ps3/ps3app.cpp platform/ps3/ps3app.h \ | platform/ps3/ps3app.cpp platform/ps3/ps3app.h \ | ||||
| platform/ps3/ps3input.cpp platform/ps3/ps3input.h | platform/ps3/ps3input.cpp platform/ps3/ps3input.h | ||||
| @@ -69,3 +69,7 @@ xbox_sources = \ | |||||
| platform/xbox/xboxapp.cpp platform/xbox/xboxapp.h | platform/xbox/xboxapp.cpp platform/xbox/xboxapp.h | ||||
| endif | endif | ||||
| android_sources = \ | |||||
| image/codec/android-image.cpp \ | |||||
| platform/android/androidapp.cpp platform/android/androidapp.h | |||||
| @@ -21,6 +21,8 @@ | |||||
| # include "platform/xbox/xboxapp.h" | # include "platform/xbox/xboxapp.h" | ||||
| #elif defined __native_client__ | #elif defined __native_client__ | ||||
| # include "platform/nacl/naclapp.h" | # include "platform/nacl/naclapp.h" | ||||
| #elif defined __ANDROID__ | |||||
| # include "platform/android/androidapp.h" | |||||
| #elif defined HAVE_GLES_2X | #elif defined HAVE_GLES_2X | ||||
| # include "eglapp.h" | # include "eglapp.h" | ||||
| #else | #else | ||||
| @@ -47,6 +49,8 @@ class ApplicationData | |||||
| XboxApp app; | XboxApp app; | ||||
| #elif defined __native_client__ | #elif defined __native_client__ | ||||
| NaClApp app; | NaClApp app; | ||||
| #elif defined __ANDROID__ | |||||
| AndroidApp app; | |||||
| #elif defined HAVE_GLES_2X | #elif defined HAVE_GLES_2X | ||||
| /* FIXME: this macro is only deactivated if we include "lolgl.h" */ | /* FIXME: this macro is only deactivated if we include "lolgl.h" */ | ||||
| EglApp app; | EglApp app; | ||||
| @@ -16,15 +16,41 @@ | |||||
| #include <android/log.h> | #include <android/log.h> | ||||
| #include "core.h" | #include "core.h" | ||||
| #include "lolgl.h" | |||||
| #include "loldebug.h" | #include "loldebug.h" | ||||
| #include "androidapp.h" | |||||
| using namespace lol; | using namespace lol; | ||||
| /* Monsterz-specific */ | |||||
| #include "interface.h" | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| JavaVM *g_vm; | JavaVM *g_vm; | ||||
| jobject g_activity; | jobject g_activity; | ||||
| AndroidApp::AndroidApp(char const *title, ivec2 res, float fps) : | |||||
| data(0) | |||||
| { | |||||
| } | |||||
| void AndroidApp::ShowPointer(bool show) | |||||
| { | |||||
| } | |||||
| void AndroidApp::Run() | |||||
| { | |||||
| while (!Ticker::Finished()) | |||||
| { | |||||
| /* Tick the renderer, show the frame and clamp to desired framerate. */ | |||||
| Ticker::TickDraw(); | |||||
| } | |||||
| } | |||||
| AndroidApp::~AndroidApp() | |||||
| { | |||||
| } | |||||
| }; | }; | ||||
| extern "C" jint | extern "C" jint | ||||
| @@ -0,0 +1,42 @@ | |||||
| // | |||||
| // Lol Engine | |||||
| // | |||||
| // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||||
| // This program is free software; you can redistribute it and/or | |||||
| // modify it under the terms of the Do What The Fuck You Want To | |||||
| // Public License, Version 2, as published by Sam Hocevar. See | |||||
| // http://sam.zoy.org/projects/COPYING.WTFPL for more details. | |||||
| // | |||||
| // | |||||
| // The AndroidApp class | |||||
| // -------------------- | |||||
| // | |||||
| #if !defined __LOL_ANDROIDAPP_H__ | |||||
| #define __LOL_ANDROIDAPP_H__ | |||||
| #include "lol/math/vector.h" | |||||
| namespace lol | |||||
| { | |||||
| class AndroidAppData; | |||||
| class AndroidApp | |||||
| { | |||||
| public: | |||||
| AndroidApp(char const *title, ivec2 res, float fps); | |||||
| virtual ~AndroidApp(); | |||||
| void ShowPointer(bool show); | |||||
| void Run(); | |||||
| private: | |||||
| AndroidAppData *data; | |||||
| }; | |||||
| } /* namespace lol */ | |||||
| #endif // __LOL_ANDROIDAPP_H__ | |||||