From 15c4e8016a3b535358aea63a599e56f5506606f9 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 11 Apr 2012 22:59:29 +0000 Subject: [PATCH] android: slightly update Android project for newer SDK versions. --- src/Makefile.am | 10 ++++--- src/application/application.cpp | 4 +++ src/platform/android/androidapp.cpp | 28 ++++++++++++++++++- src/platform/android/androidapp.h | 42 +++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 src/platform/android/androidapp.h diff --git a/src/Makefile.am b/src/Makefile.am index a6ceae3b..7db0c214 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,6 +22,7 @@ liblol_a_SOURCES = \ $(xbox_sources) \ $(nacl_sources) \ $(sdl_sources) \ + $(android_sources) \ \ thread/threadbase.h thread/thread.h \ \ @@ -31,11 +32,8 @@ liblol_a_SOURCES = \ gpu/vbo.cpp gpu/vbo.h \ \ image/image.cpp image/image.h image/image-private.h \ - image/codec/android-image.cpp \ image/codec/gdiplus-image.cpp \ image/codec/ios-image.cpp \ - image/codec/sdl-image.cpp \ - image/codec/ps3-image.cpp \ image/codec/dummy-image.cpp \ \ loldebug.h \ @@ -45,6 +43,7 @@ liblol_a_SOURCES = \ liblol_a_CPPFLAGS = @LOL_CFLAGS@ sdl_sources = \ + image/codec/sdl-image.cpp \ platform/sdl/sdlapp.cpp platform/sdl/sdlapp.h \ platform/sdl/sdlinput.cpp platform/sdl/sdlinput.h @@ -59,6 +58,7 @@ endif if HAVE_PS3 ps3_sources = \ + image/codec/ps3-image.cpp \ platform/ps3/threadbase.h \ platform/ps3/ps3app.cpp platform/ps3/ps3app.h \ platform/ps3/ps3input.cpp platform/ps3/ps3input.h @@ -69,3 +69,7 @@ xbox_sources = \ platform/xbox/xboxapp.cpp platform/xbox/xboxapp.h endif +android_sources = \ + image/codec/android-image.cpp \ + platform/android/androidapp.cpp platform/android/androidapp.h + diff --git a/src/application/application.cpp b/src/application/application.cpp index 5e59dd51..b7f8951c 100644 --- a/src/application/application.cpp +++ b/src/application/application.cpp @@ -21,6 +21,8 @@ # include "platform/xbox/xboxapp.h" #elif defined __native_client__ # include "platform/nacl/naclapp.h" +#elif defined __ANDROID__ +# include "platform/android/androidapp.h" #elif defined HAVE_GLES_2X # include "eglapp.h" #else @@ -47,6 +49,8 @@ class ApplicationData XboxApp app; #elif defined __native_client__ NaClApp app; +#elif defined __ANDROID__ + AndroidApp app; #elif defined HAVE_GLES_2X /* FIXME: this macro is only deactivated if we include "lolgl.h" */ EglApp app; diff --git a/src/platform/android/androidapp.cpp b/src/platform/android/androidapp.cpp index 5031592d..072e054f 100644 --- a/src/platform/android/androidapp.cpp +++ b/src/platform/android/androidapp.cpp @@ -16,15 +16,41 @@ #include #include "core.h" -#include "lolgl.h" #include "loldebug.h" +#include "androidapp.h" using namespace lol; +/* Monsterz-specific */ +#include "interface.h" + namespace lol { JavaVM *g_vm; 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 diff --git a/src/platform/android/androidapp.h b/src/platform/android/androidapp.h new file mode 100644 index 00000000..972ec81c --- /dev/null +++ b/src/platform/android/androidapp.h @@ -0,0 +1,42 @@ +// +// Lol Engine +// +// Copyright: (c) 2010-2011 Sam Hocevar +// 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__ +