From bd12b7003de1aca4ac5ca43e0e8d292884e96a5b Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 13 Sep 2016 21:13:25 -0400 Subject: [PATCH] v0.4.2b: added sources for FroyoGLES20Fix --- .../com/watabou/glwrap/FroyoGLES20Fix.java | 5 +-- SPD-classes/src/main/jniSources/Android.mk | 9 +++++ .../src/main/jniSources/FroyoGLES20Fix.c | 35 +++++++++++++++++++ SPD-classes/src/main/jniSources/README.txt | 12 +++++++ 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 SPD-classes/src/main/jniSources/Android.mk create mode 100644 SPD-classes/src/main/jniSources/FroyoGLES20Fix.c create mode 100644 SPD-classes/src/main/jniSources/README.txt diff --git a/SPD-classes/src/main/java/com/watabou/glwrap/FroyoGLES20Fix.java b/SPD-classes/src/main/java/com/watabou/glwrap/FroyoGLES20Fix.java index 337e572fe..5a27213a4 100644 --- a/SPD-classes/src/main/java/com/watabou/glwrap/FroyoGLES20Fix.java +++ b/SPD-classes/src/main/java/com/watabou/glwrap/FroyoGLES20Fix.java @@ -31,8 +31,9 @@ package com.watabou.glwrap; //...I don't know what google engineer forgot to put the java hooks in android 2.2 back in 2010, // but you know who you are and this class is your fault. -//Note that compiled binares are included with this source, -// so the android NDK is not needed to compile this project +//Compiled binaries for the FroyoGLES20Fix lib are included in this project, which means that +// the android NDK is not required for building Shattered Pixel Dungeon. +// see SPD-classes/src/main/jniSources/README.txt for more details. //DO NOT REFERENCE THIS CLASS ON DEVICES API 9 AND ABOVE, use android.opengl.GLES20 instead. @SuppressWarnings("JniMissingFunction") diff --git a/SPD-classes/src/main/jniSources/Android.mk b/SPD-classes/src/main/jniSources/Android.mk new file mode 100644 index 000000000..37ca2d8ca --- /dev/null +++ b/SPD-classes/src/main/jniSources/Android.mk @@ -0,0 +1,9 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := FroyoGLES20Fix +LOCAL_SRC_FILES := FroyoGLES20Fix.c +LOCAL_LDLIBS := -lGLESv2 + +include $(BUILD_SHARED_LIBRARY) diff --git a/SPD-classes/src/main/jniSources/FroyoGLES20Fix.c b/SPD-classes/src/main/jniSources/FroyoGLES20Fix.c new file mode 100644 index 000000000..e3437565c --- /dev/null +++ b/SPD-classes/src/main/jniSources/FroyoGLES20Fix.c @@ -0,0 +1,35 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2016 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +#include +#include + +void Java_com_watabou_glwrap_FroyoGLES20Fix_glVertexAttribPointer + (JNIEnv *env, jclass c, jint index, jint size, jint type, jboolean normalized, jint stride, jint offset) +{ + glVertexAttribPointer(index, size, type, normalized, stride, (const void*)offset); +} + +void Java_com_watabou_glwrap_FroyoGLES20Fix_glDrawElements + (JNIEnv *env, jclass c, jint mode, jint count, jint type, jint offset) +{ + glDrawElements(mode, count, type, (const void*)offset); +} diff --git a/SPD-classes/src/main/jniSources/README.txt b/SPD-classes/src/main/jniSources/README.txt new file mode 100644 index 000000000..d3bc9d782 --- /dev/null +++ b/SPD-classes/src/main/jniSources/README.txt @@ -0,0 +1,12 @@ +These sources are provided for FOSS completeness, but compiling them is optional. + +The folder jniLibs already contains compiled versions of FroyoGLES20Fix.c, and makes compiling +The sources here an optional step in building Shattered Pixel Dungeon. This is done so that +The Android NDK is not required for project compilation, but those who want to ensure they are 100% +building from source can still do so. + +There is no functional difference between using the provided .so files, and compiling your own. + +In order to compile these files you will need the Android NDK. + +TODO: provide build instructions, or a build script, or make a gradle task. \ No newline at end of file