v0.4.2b: added sources for FroyoGLES20Fix

This commit is contained in:
Evan Debenham 2016-09-13 21:13:25 -04:00
parent a99803117b
commit bd12b7003d
4 changed files with 59 additions and 2 deletions

View File

@ -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")

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>
*/
#include <jni.h>
#include <GLES2/gl2.h>
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);
}

View File

@ -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.