mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-04-28 12:17:57 +03:00
api-impl: add APIs for libGDX games
This commit is contained in:
parent
728c43f925
commit
8e40c13480
4 changed files with 111 additions and 0 deletions
|
@ -316,3 +316,89 @@ JNIEXPORT void JNICALL Java_android_opengl_GLES20_glReadPixels(JNIEnv *env, jcla
|
|||
glReadPixels(x, y, width, height, format, type, pixels);
|
||||
release_nio_buffer(env, array_ref, array);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glPixelStorei(JNIEnv *env, jclass this, jint pname, jint param)
|
||||
{
|
||||
glPixelStorei((GLenum)pname, (GLint)param);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glTexParameteri(JNIEnv *env, jclass this, jint target, jint pname, jint param)
|
||||
{
|
||||
glTexParameteri((GLenum)target, (GLenum)pname, (GLint)param);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glGetShaderiv__IILjava_nio_IntBuffer_2(JNIEnv *env, jclass this, jint shader, jint pname, jobject params_buf)
|
||||
{
|
||||
jarray array_ref;
|
||||
jbyte *array;
|
||||
GLvoid *params = get_nio_buffer(env, params_buf, &array_ref, &array);
|
||||
glGetShaderiv((GLuint)shader, (GLenum)pname, (GLint *)params);
|
||||
release_nio_buffer(env, array_ref, array);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glGetProgramiv__IILjava_nio_IntBuffer_2(JNIEnv *env, jclass this, jint program, jint pname, jobject params_buf)
|
||||
{
|
||||
jarray array_ref;
|
||||
jbyte *array;
|
||||
GLvoid *params = get_nio_buffer(env, params_buf, &array_ref, &array);
|
||||
glGetProgramiv((GLuint)program, (GLenum)pname, (GLint *)params);
|
||||
release_nio_buffer(env, array_ref, array);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glDepthMask(JNIEnv *env, jclass this, jboolean flag)
|
||||
{
|
||||
glDepthMask((GLboolean)flag);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glBlendFuncSeparate(JNIEnv *env, jclass this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha)
|
||||
{
|
||||
glBlendFuncSeparate((GLenum)srcRGB, (GLenum)dstRGB, (GLenum)srcAlpha, (GLenum)dstAlpha);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glGenFramebuffers__I_3II(JNIEnv *env, jclass this, jint n, jintArray framebuffers_ref, jint offset)
|
||||
{
|
||||
GLuint *framebuffers = (*env)->GetPrimitiveArrayCritical(env, framebuffers_ref, 0);
|
||||
glGenFramebuffers((GLsizei)n, framebuffers + offset);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, framebuffers_ref, framebuffers, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glBindFramebuffer(JNIEnv *env, jclass this, jint target, jint framebuffer)
|
||||
{
|
||||
glBindFramebuffer((GLenum)target, (GLuint)framebuffer);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glFramebufferTexture2D(JNIEnv *env, jclass this, jint target, jint attachment, jint textarget, jint texture, jint level)
|
||||
{
|
||||
glFramebufferTexture2D((GLenum)target, (GLenum)attachment, (GLenum)textarget, (GLuint)texture, (GLint)level);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glBindRenderbuffer(JNIEnv *env, jclass this, jint target, jint renderbuffer)
|
||||
{
|
||||
glBindRenderbuffer((GLenum)target, (GLuint)renderbuffer);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_opengl_GLES20_glCheckFramebufferStatus(JNIEnv *env, jclass this, jint target)
|
||||
{
|
||||
return (jint)glCheckFramebufferStatus((GLenum)target);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glDeleteFramebuffers__I_3II(JNIEnv *env, jclass this, jint n, jintArray framebuffers_ref, jint offset)
|
||||
{
|
||||
GLuint *framebuffers = (*env)->GetPrimitiveArrayCritical(env, framebuffers_ref, 0);
|
||||
glDeleteFramebuffers((GLsizei)n, framebuffers + offset);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, framebuffers_ref, framebuffers, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glDeleteProgram(JNIEnv *env, jclass this, jint program)
|
||||
{
|
||||
glDeleteProgram((GLuint)program);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_opengl_GLES20_glGetFloatv__ILjava_nio_FloatBuffer_2(JNIEnv *env, jclass this, jint pname, jobject params_buf)
|
||||
{
|
||||
jarray array_ref;
|
||||
jbyte *array;
|
||||
GLvoid *params = get_nio_buffer(env, params_buf, &array_ref, &array);
|
||||
glGetFloatv((GLenum)pname, (GLfloat *)params);
|
||||
release_nio_buffer(env, array_ref, array);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package android.hardware;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
|
@ -44,4 +47,8 @@ public class SensorManager {
|
|||
}
|
||||
|
||||
native void register_accelerometer_listener_native(SensorEventListener listener, Sensor sensor, int sampling_period);
|
||||
|
||||
public List<Sensor> getSensorList(int type) {
|
||||
return Arrays.asList(getDefaultSensor(type));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,12 @@ public class MediaPlayer {
|
|||
public void reset() {}
|
||||
public void release() {}
|
||||
|
||||
public boolean isPlaying() { return false; }
|
||||
|
||||
public void seekTo(int dummy) {}
|
||||
|
||||
public void setVolume(float leftVolume, float rightVolume) {}
|
||||
|
||||
public static native void native_prepare(long gtk_media_stream);
|
||||
public native long native_setDataSource(String path);
|
||||
public static native void native_setOnCompletionListener(long gtk_media_stream, MediaPlayer.OnCompletionListener listener);
|
||||
|
|
|
@ -40,6 +40,18 @@ public class SoundPool {
|
|||
return nativePlay(nativePool, soundID);
|
||||
}
|
||||
|
||||
public void autoResume() {
|
||||
System.out.println("WARNING: SoundPool.autoResume not implemented yet");
|
||||
}
|
||||
|
||||
public void autoPause() {
|
||||
System.out.println("WARNING: SoundPool.autoPause not implemented yet");
|
||||
}
|
||||
|
||||
public void setVolume(int streamType, float leftVolume, float rightVolume) {
|
||||
System.out.println("WARNING: SoundPool.setVolume not implemented yet");
|
||||
}
|
||||
|
||||
public class Builder {
|
||||
public Builder setAudioAttributes(AudioAttributes attributes) {
|
||||
return this;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue