mirror of
https://github.com/jamessanford/kegs.git
synced 2025-01-24 14:29:46 +00:00
Use KegsViewGL renderer by default.
This commit is contained in:
parent
4704863843
commit
e45690bc74
@ -22,6 +22,9 @@
|
||||
|
||||
#include "defc.h"
|
||||
|
||||
// KegsViewGL, when defined lock pixels only once per mainLoop.
|
||||
#define ANDROID_GL
|
||||
|
||||
JNIEnv *g_env;
|
||||
jobject g_thiz;
|
||||
jobject g_bitmap;
|
||||
@ -30,6 +33,8 @@ jobject g_eventqueue;
|
||||
|
||||
extern int Verbose;
|
||||
|
||||
void *g_android_pixels;
|
||||
|
||||
extern int g_warp_pointer;
|
||||
extern int g_screen_depth;
|
||||
extern int g_force_depth;
|
||||
@ -159,10 +164,14 @@ x_push_kimage(Kimage *kimage_ptr, int destx, int desty, int srcx, int srcy,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ANDROID_GL
|
||||
if ((ret = AndroidBitmap_lockPixels(g_env, g_bitmap, &pixels)) < 0) {
|
||||
LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
pixels = g_android_pixels;
|
||||
#endif
|
||||
|
||||
// FILL PIXELS
|
||||
|
||||
@ -208,7 +217,9 @@ x_push_kimage(Kimage *kimage_ptr, int destx, int desty, int srcx, int srcy,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ANDROID_GL
|
||||
AndroidBitmap_unlockPixels(g_env, g_bitmap);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (pushed == 0) {
|
||||
@ -315,7 +326,19 @@ Java_com_froop_app_kegs_KegsThread_mainLoop( JNIEnv* env, jobject thiz, jobject
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID_GL
|
||||
if ((ret = AndroidBitmap_lockPixels(g_env, g_bitmap, &g_android_pixels)) < 0) {
|
||||
LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
kegsmain(0, NULL);
|
||||
|
||||
#ifdef ANDROID_GL
|
||||
AndroidBitmap_unlockPixels(g_env, g_bitmap);
|
||||
g_android_pixels = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4,7 +4,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.froop.app.kegs.KegsView
|
||||
<com.froop.app.kegs.KegsViewGL
|
||||
android:id="@+id/kegsview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -34,7 +34,9 @@ public class KegsMain extends Activity implements KegsKeyboard.StickyReset {
|
||||
|
||||
private KegsThread mKegsThread;
|
||||
|
||||
protected KegsView mKegsView;
|
||||
// For the software renderer, use 'KegsView' here and in res/layout/main.xml
|
||||
// Also consider undef ANDROID_GL in jni/android_driver.c
|
||||
protected KegsViewGL mKegsView;
|
||||
private KegsTouch mKegsTouch;
|
||||
private KegsKeyboard mKegsKeyboard;
|
||||
private TouchJoystick mJoystick;
|
||||
@ -341,7 +343,7 @@ public class KegsMain extends Activity implements KegsKeyboard.StickyReset {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
mKegsView = (KegsView)findViewById(R.id.kegsview);
|
||||
mKegsView = (KegsViewGL)findViewById(R.id.kegsview);
|
||||
|
||||
mKegsThread = new KegsThread(mKegsView.getBitmap());
|
||||
mKegsThread.registerUpdateScreenInterface(mKegsView);
|
||||
@ -399,12 +401,18 @@ public class KegsMain extends Activity implements KegsKeyboard.StickyReset {
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
getThread().onPause();
|
||||
if (mKegsView instanceof KegsViewGL) {
|
||||
mKegsView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
getThread().onResume();
|
||||
if (mKegsView instanceof KegsViewGL) {
|
||||
mKegsView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -217,7 +217,10 @@ class KegsRenderer implements GLSurfaceView.Renderer {
|
||||
}
|
||||
|
||||
public void updateScreenSize(BitmapSize bitmapSize) {
|
||||
// FIXME: TODO!: FIXME: lock here between use of these values...
|
||||
// mWidth, mHeight, mSizeChange, mScaleX, mScaleY, crop, ...
|
||||
mWidth = bitmapSize.getViewWidth();
|
||||
mHeight = bitmapSize.getViewHeight();
|
||||
mScaleX = bitmapSize.getScaleX();
|
||||
mScaleY = bitmapSize.getScaleY();
|
||||
mSizeChange = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user