diff --git a/jni/love/Android.mk b/jni/love/Android.mk index a31a8df9..d4dac606 100644 --- a/jni/love/Android.mk +++ b/jni/love/Android.mk @@ -16,7 +16,6 @@ LOCAL_C_INCLUDES := \ ${LOCAL_PATH}/src/libraries/ \ ${LOCAL_PATH}/src/libraries/enet/libenet/include \ ${LOCAL_PATH}/../SDL2-2.0.1/include \ - ${LOCAL_PATH}/../SDL2-2.0.1/src \ ${LOCAL_PATH}/../devil-1.7.8/include \ ${LOCAL_PATH}/../devil-1.7.8/src-IL/include \ ${LOCAL_PATH}/../jasper-1.900.1/src/libjasper/include \ @@ -43,8 +42,7 @@ LOCAL_SRC_FILES := \ ,$(subst $(LOCAL_PATH)/,,\ $(wildcard ${LOCAL_PATH}/src/love.cpp) \ $(wildcard ${LOCAL_PATH}/src/common/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/android/*.cpp) \ - $(wildcard ${LOCAL_PATH}/src/modules/audio/*.cpp) \ + $(wildcard ${LOCAL_PATH}/src/modules/audio/*.cpp) \ $(wildcard ${LOCAL_PATH}/src/modules/audio/null/*.cpp) \ $(wildcard ${LOCAL_PATH}/src/modules/audio/openal/*.cpp) \ $(wildcard ${LOCAL_PATH}/src/modules/event/*.cpp) \ diff --git a/jni/love/src/common/config.h b/jni/love/src/common/config.h index 7f946525..f4959831 100644 --- a/jni/love/src/common/config.h +++ b/jni/love/src/common/config.h @@ -90,7 +90,6 @@ # define LOVE_LITTLE_ENDIAN 1 # endif #else -# define LOVE_ENABLE_ANDROID # define LOVE_ENABLE_AUDIO # define LOVE_ENABLE_AUDIO_NULL # define LOVE_ENABLE_AUDIO_OPENAL diff --git a/jni/love/src/common/types.h b/jni/love/src/common/types.h index 60292a41..e9319ea5 100644 --- a/jni/love/src/common/types.h +++ b/jni/love/src/common/types.h @@ -35,9 +35,6 @@ enum Type DATA_ID, MODULE_ID, - // Android - ANDROID_DISPLAY_METRICS_ID, - // Filesystem. FILESYSTEM_FILE_ID, FILESYSTEM_FILE_DATA_ID, @@ -124,9 +121,6 @@ const bits OBJECT_T = bits(1) << OBJECT_ID; const bits DATA_T = (bits(1) << DATA_ID) | OBJECT_T; const bits MODULE_T = (bits(1) << MODULE_ID) | OBJECT_T; -// Android -const bits ANDROID_DISPLAY_METRICS_T = (bits(1) << ANDROID_DISPLAY_METRICS_ID) | OBJECT_T; - // Filesystem. const bits FILESYSTEM_FILE_T = (bits(1) << FILESYSTEM_FILE_ID) | OBJECT_T; const bits FILESYSTEM_FILE_DATA_T = (bits(1) << FILESYSTEM_FILE_DATA_ID) | DATA_T; diff --git a/jni/love/src/modules/android/Android.cpp b/jni/love/src/modules/android/Android.cpp deleted file mode 100644 index 70beba55..00000000 --- a/jni/love/src/modules/android/Android.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2006-2014 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "Android.h" - -namespace love -{ -namespace android -{ - -DisplayMetrics* Android::getDisplayMetrics() -{ - if (metrics == NULL) - { - metrics = new DisplayMetrics(); - } - return metrics; -} - -const char *Android::getName() const -{ - return "love.android"; -} - -} // android -} // love diff --git a/jni/love/src/modules/android/Android.h b/jni/love/src/modules/android/Android.h deleted file mode 100644 index 45170a41..00000000 --- a/jni/love/src/modules/android/Android.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2006-2014 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_ANDROID_ANDROID_H -#define LOVE_ANDROID_ANDROID_H - -// LOVE -#include "common/Module.h" -#include "DisplayMetrics.h" - -namespace love -{ -namespace android -{ - -/** - * The Android module provide access to some device features, like display metrics and camera. - **/ -class Android : public Module -{ -public: - - /** - * Destructor. - **/ - virtual ~Android() {} - - /** - * Gets display metrics that describe the size and density of this display. - * @return A DisplayMetrics object containing the metrics. - **/ - DisplayMetrics* getDisplayMetrics(); - - // Implements Module. - virtual const char *getName() const; - -private: - - DisplayMetrics *metrics; - -}; // Android - -} // android -} // love - -#endif // LOVE_ANDROID_ANDROID_H diff --git a/jni/love/src/modules/android/DisplayMetrics.cpp b/jni/love/src/modules/android/DisplayMetrics.cpp deleted file mode 100644 index c38627c3..00000000 --- a/jni/love/src/modules/android/DisplayMetrics.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) 2006-2014 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "DisplayMetrics.h" -#include "core/android/SDL_android.h" - -namespace love -{ -namespace android -{ - -DisplayMetrics::DisplayMetrics() -{ - JNIEnv *env = Android_JNI_GetEnv(); - - jclass activity = env->FindClass("org/love2d/android/GameActivity"); - jmethodID getMetrics = env->GetStaticMethodID(activity, "getMetrics", "()Landroid/util/DisplayMetrics;"); - jobject metrics = env->CallStaticObjectMethod(activity, getMetrics); - jclass metricsClass = env->GetObjectClass(metrics); - - // Density - density = env->GetFloatField(metrics, env->GetFieldID(metricsClass, "density", "F")); - scaledDensity = env->GetFloatField(metrics, env->GetFieldID(metricsClass, "scaledDensity", "F")); - densityDpi = env->GetIntField(metrics, env->GetFieldID(metricsClass, "densityDpi", "I")); - - // Size - widthPixels = env->GetIntField(metrics, env->GetFieldID(metricsClass, "widthPixels", "I")); - heightPixels = env->GetIntField(metrics, env->GetFieldID(metricsClass, "heightPixels", "I")); - - // DPI - xdpi = env->GetFloatField(metrics, env->GetFieldID(metricsClass, "xdpi", "F")); - ydpi = env->GetFloatField(metrics, env->GetFieldID(metricsClass, "ydpi", "F")); -} - -float DisplayMetrics::getDensity() -{ - return density; -} - -float DisplayMetrics::getScaledDensity() -{ - return scaledDensity; -} - -int DisplayMetrics::getDensityDpi() -{ - return densityDpi; -} - -int DisplayMetrics::getWidthPixels() -{ - return widthPixels; -} - -int DisplayMetrics::getHeightPixels() -{ - return heightPixels; -} - -float DisplayMetrics::getXdpi() -{ - return xdpi; -} - -float DisplayMetrics::getYdpi() -{ - return ydpi; -} - -} // android -} // love diff --git a/jni/love/src/modules/android/DisplayMetrics.h b/jni/love/src/modules/android/DisplayMetrics.h deleted file mode 100644 index 9a749b7b..00000000 --- a/jni/love/src/modules/android/DisplayMetrics.h +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Copyright (c) 2006-2014 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_ANDROID_DISPLAY_METRICS_H -#define LOVE_ANDROID_DISPLAY_METRICS_H - -// LOVE -#include "common/Object.h" - -namespace love -{ -namespace android -{ - -/** - * A DisplayMetrics describe a general information about a display, such as its size, density, and font scaling. - **/ -class DisplayMetrics : public Object -{ -public: - - /** - * Constructor. - **/ - DisplayMetrics(); - - /** - * Destructor. - **/ - virtual ~DisplayMetrics() {} - - /** - * The logical density of the display. - **/ - float getDensity(); - - /** - * A scaling factor for fonts displayed on the display. - **/ - float getScaledDensity(); - - /** - * The screen density expressed as dots-per-inch. - **/ - int getDensityDpi(); - - /** - * The absolute width of the display in pixels. - **/ - int getWidthPixels(); - - /** - * The absolute height of the display in pixels. - **/ - int getHeightPixels(); - - /** - * The exact physical pixels per inch of the screen in the X dimension. - **/ - float getXdpi(); - - /** - * The exact physical pixels per inch of the screen in the X dimension. - **/ - float getYdpi(); - -private: - float density; - float scaledDensity; - int densityDpi; - int widthPixels; - int heightPixels; - float xdpi; - float ydpi; - -}; // DisplayMetrics - -} // android -} // love - -#endif // LOVE_ANDROID_DISPLAY_METRICS_H diff --git a/jni/love/src/modules/android/wrap_Android.cpp b/jni/love/src/modules/android/wrap_Android.cpp deleted file mode 100644 index 940d59f7..00000000 --- a/jni/love/src/modules/android/wrap_Android.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) 2006-2014 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "wrap_Android.h" -#include "wrap_DisplayMetrics.h" - -namespace love -{ -namespace android -{ - -static Android *instance = nullptr; - -int w_getDisplayMetrics(lua_State *L) -{ - DisplayMetrics *metrics = 0; - EXCEPT_GUARD(metrics = instance->getDisplayMetrics();) - luax_pushtype(L, "DisplayMetrics", ANDROID_DISPLAY_METRICS_T, metrics); - return 1; -} - -// List of functions to wrap. -static const luaL_Reg functions[] = -{ - { "getDisplayMetrics", w_getDisplayMetrics }, - { 0, 0 } -}; - -// Types for this module. -static const lua_CFunction types[] = -{ - luaopen_displaymetrics, - 0 -}; - -extern "C" int luaopen_love_android(lua_State *L) -{ - if (instance == 0) - { - EXCEPT_GUARD(instance = new Android();) - } - else - instance->retain(); - - WrappedModule w; - w.module = instance; - w.name = "android"; - w.flags = MODULE_T; - w.functions = functions; - w.types = types; - - int n = luax_register_module(L, w); - - return n; -} - -} // android -} // love diff --git a/jni/love/src/modules/android/wrap_Android.h b/jni/love/src/modules/android/wrap_Android.h deleted file mode 100644 index 80dd6437..00000000 --- a/jni/love/src/modules/android/wrap_Android.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2006-2014 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_ANDROID_WRAP_ANDROID_H -#define LOVE_ANDROID_WRAP_ANDROID_H - -// LOVE -#include "common/config.h" -#include "common/runtime.h" -#include "Android.h" - -namespace love -{ -namespace android -{ - -int w_getDisplayMetrics(lua_State *L); -extern "C" LOVE_EXPORT int luaopen_love_android(lua_State *L); - -} // android -} // love - -#endif // LOVE_ANDROID_WRAP_ANDROID_H diff --git a/jni/love/src/modules/android/wrap_DisplayMetrics.cpp b/jni/love/src/modules/android/wrap_DisplayMetrics.cpp deleted file mode 100644 index 9631bd24..00000000 --- a/jni/love/src/modules/android/wrap_DisplayMetrics.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) 2006-2014 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#include "wrap_DisplayMetrics.h" - -namespace love -{ -namespace android -{ - -DisplayMetrics *luax_checkdisplaymetrics(lua_State *L, int idx) -{ - return luax_checktype(L, idx, "DisplayMetrics", ANDROID_DISPLAY_METRICS_T); -} - -int w_getDensity(lua_State *L) -{ - DisplayMetrics *metrics = luax_checkdisplaymetrics(L, 1); - lua_pushnumber(L, metrics->getDensity()); - return 1; -} - -int w_getScaledDensity(lua_State *L) -{ - DisplayMetrics *metrics = luax_checkdisplaymetrics(L, 1); - lua_pushnumber(L, metrics->getScaledDensity()); - return 1; -} - -int w_getDensityDpi(lua_State *L) -{ - DisplayMetrics *metrics = luax_checkdisplaymetrics(L, 1); - lua_pushnumber(L, metrics->getDensityDpi()); - return 1; -} - -int w_getWidthPixels(lua_State *L) -{ - DisplayMetrics *metrics = luax_checkdisplaymetrics(L, 1); - lua_pushnumber(L, metrics->getWidthPixels()); - return 1; -} - -int w_getHeightPixels(lua_State *L) -{ - DisplayMetrics *metrics = luax_checkdisplaymetrics(L, 1); - lua_pushnumber(L, metrics->getHeightPixels()); - return 1; -} - -int w_getXdpi(lua_State *L) -{ - DisplayMetrics *metrics = luax_checkdisplaymetrics(L, 1); - lua_pushnumber(L, metrics->getXdpi()); - return 1; -} - -int w_getYdpi(lua_State *L) -{ - DisplayMetrics *metrics = luax_checkdisplaymetrics(L, 1); - lua_pushnumber(L, metrics->getYdpi()); - return 1; -} - -static const luaL_Reg functions[] = -{ - { "getDensity", w_getDensity }, - { "getScaledDensity", w_getScaledDensity }, - { "getDensityDpi", w_getDensityDpi }, - { "getWidthPixels", w_getWidthPixels }, - { "getHeightPixels", w_getHeightPixels }, - { "getXdpi", w_getXdpi }, - { "getYdpi", w_getYdpi }, - { 0, 0 }, -}; - -extern "C" int luaopen_displaymetrics(lua_State *L) -{ - return luax_register_type(L, "DisplayMetrics", functions); -} - -} // android -} // love diff --git a/jni/love/src/modules/android/wrap_DisplayMetrics.h b/jni/love/src/modules/android/wrap_DisplayMetrics.h deleted file mode 100644 index 5c69098f..00000000 --- a/jni/love/src/modules/android/wrap_DisplayMetrics.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2006-2014 LOVE Development Team - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - **/ - -#ifndef LOVE_ANDROID_WRAP_DISPLAY_METRICS_H -#define LOVE_ANDROID_WRAP_DISPLAY_METRICS_H - -#include "common/runtime.h" -#include "DisplayMetrics.h" - -namespace love -{ -namespace android -{ - -DisplayMetrics *luax_checkdisplaymetrics(lua_State *L, int idx); -int w_getDensity(lua_State *L); -int w_getScaledDensity(lua_State *L); -int w_getDensityDpi(lua_State *L); -int w_getWidthPixels(lua_State *L); -int w_getHeightPixels(lua_State *L); -int w_getXdpi(lua_State *L); -int w_getYdpi(lua_State *L); -extern "C" int luaopen_displaymetrics(lua_State *L); - -} // android -} // love - -#endif // LOVE_ANDROID_WRAP_DISPLAY_METRICS_H diff --git a/jni/love/src/modules/love/love.cpp b/jni/love/src/modules/love/love.cpp index 4610e638..dd8c5ab5 100644 --- a/jni/love/src/modules/love/love.cpp +++ b/jni/love/src/modules/love/love.cpp @@ -52,9 +52,6 @@ // of addressing implementations directly. extern "C" { -#if defined(LOVE_ENABLE_ANDROID) - extern int luaopen_love_android(lua_State*); -#endif #if defined(LOVE_ENABLE_AUDIO) extern int luaopen_love_audio(lua_State*); #endif @@ -110,9 +107,6 @@ extern "C" } static const luaL_Reg modules[] = { -#if defined(LOVE_ENABLE_ANDROID) - { "love.android", luaopen_love_android }, -#endif #if defined(LOVE_ENABLE_AUDIO) { "love.audio", luaopen_love_audio }, #endif diff --git a/jni/love/src/scripts/boot.lua b/jni/love/src/scripts/boot.lua index 9336476c..ea1e6950 100644 --- a/jni/love/src/scripts/boot.lua +++ b/jni/love/src/scripts/boot.lua @@ -315,7 +315,6 @@ function love.init() highdpi = false, }, modules = { - android = true, event = true, keyboard = true, mouse = true, @@ -364,7 +363,6 @@ function love.init() -- Gets desired modules. for k,v in ipairs{ - "android", "thread", "timer", "event", diff --git a/jni/love/src/scripts/boot.lua.h b/jni/love/src/scripts/boot.lua.h index 564bfa5b..0df00dee 100644 --- a/jni/love/src/scripts/boot.lua.h +++ b/jni/love/src/scripts/boot.lua.h @@ -572,7 +572,6 @@ const unsigned char boot_lua[] = 0x2c, 0x0a, 0x09, 0x09, 0x7d, 0x2c, 0x0a, 0x09, 0x09, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x20, 0x3d, 0x20, 0x7b, 0x0a, - 0x09, 0x09, 0x09, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x09, 0x09, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, 0x09, 0x09, 0x09, 0x6b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x0a, @@ -645,7 +644,6 @@ const unsigned char boot_lua[] = 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x2e, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x20, 0x6b, 0x2c, 0x76, 0x20, 0x69, 0x6e, 0x20, 0x69, 0x70, 0x61, 0x69, 0x72, 0x73, 0x7b, 0x0a, - 0x09, 0x09, 0x22, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x22, 0x2c, 0x0a, 0x09, 0x09, 0x22, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x22, 0x2c, 0x0a, 0x09, 0x09, 0x22, 0x74, 0x69, 0x6d, 0x65, 0x72, 0x22, 0x2c, 0x0a, 0x09, 0x09, 0x22, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x2c, 0x0a,