Fixed the NO_REMAP implementation, fixed few minor bg in Settings.java
This commit is contained in:
@@ -103,5 +103,4 @@ class Globals {
|
||||
public static String DataDir = new String("");
|
||||
public static boolean SmoothVideo = false;
|
||||
public static boolean MultiThreadedVideo = false;
|
||||
public static int RemapKeymask = 0;
|
||||
}
|
||||
|
||||
@@ -254,6 +254,7 @@ class SDL_1_2_Keycodes {
|
||||
public static final int SDLK_EURO = 321;
|
||||
public static final int SDLK_UNDO = 322;
|
||||
|
||||
public static final int SDLK_NO_REMAP = 512;
|
||||
}
|
||||
|
||||
// Autogenerated by hand with a command:
|
||||
@@ -500,6 +501,7 @@ class SDL_1_3_Keycodes {
|
||||
public static final int SDLK_EJECT = 281;
|
||||
public static final int SDLK_SLEEP = 282;
|
||||
|
||||
public static final int SDLK_NO_REMAP = 512;
|
||||
}
|
||||
|
||||
class SDL_Keys
|
||||
@@ -511,7 +513,7 @@ class SDL_Keys
|
||||
public static Integer [] namesSortedIdx = null;
|
||||
public static Integer [] namesSortedBackIdx = null;
|
||||
|
||||
static final int JAVA_KEYCODE_LAST = 110; // Android 2.3 added several new gaming keys, it ends up at keycode 110 currently - plz keep in sync with javakeycodes.h
|
||||
static final int JAVA_KEYCODE_LAST = 255; // Android 2.3 added several new gaming keys, Android 3.1 added even more - keep in sync with javakeycodes.h
|
||||
|
||||
static
|
||||
{
|
||||
|
||||
@@ -320,13 +320,12 @@ public class MainActivity extends Activity {
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, final KeyEvent event)
|
||||
{
|
||||
// Overrides Back key to use in our app
|
||||
if(_screenKeyboard != null)
|
||||
_screenKeyboard.onKeyDown(keyCode, event);
|
||||
else
|
||||
if( mGLView != null )
|
||||
{
|
||||
if( !mGLView.callNativeKey( keyCode, 1 ) )
|
||||
if( mGLView.nativeKey( keyCode, 1 ) == 0 )
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
else
|
||||
@@ -353,7 +352,7 @@ public class MainActivity extends Activity {
|
||||
else
|
||||
if( mGLView != null )
|
||||
{
|
||||
if( !mGLView.callNativeKey( keyCode, 0 ) )
|
||||
if( mGLView.nativeKey( keyCode, 0 ) == 0 )
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1341,7 +1341,7 @@ class Settings
|
||||
|
||||
public void onKeyEvent(final int keyCode)
|
||||
{
|
||||
p.touchListener = null;
|
||||
p.keyListener = null;
|
||||
int keyIndex = keyCode;
|
||||
if( keyIndex < 0 )
|
||||
keyIndex = 0;
|
||||
@@ -1712,7 +1712,7 @@ class Settings
|
||||
|
||||
public void onKeyEvent(final int keyCode)
|
||||
{
|
||||
p.touchListener = null;
|
||||
p.keyListener = null;
|
||||
int keyIndex = keyCode;
|
||||
if( keyIndex < 0 )
|
||||
keyIndex = 0;
|
||||
|
||||
@@ -399,27 +399,18 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
mRenderer.nativeGlContextRecreated();
|
||||
};
|
||||
|
||||
// This seems like redundant code - it handled in MainActivity.java
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, final KeyEvent event) {
|
||||
if( !callNativeKey( keyCode, 1 ) )
|
||||
return super.onKeyDown(keyCode, event);
|
||||
if( nativeKey( keyCode, 1 ) == 0 )
|
||||
return super.onKeyDown(keyCode, event);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, final KeyEvent event) {
|
||||
if( !callNativeKey( keyCode, 0 ) )
|
||||
return super.onKeyUp(keyCode, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean callNativeKey(int keyCode, int down) {
|
||||
if( (Globals.RemapKeymask & keyCode ) == keyCode )
|
||||
{
|
||||
// no remap made for the key
|
||||
return false;
|
||||
}
|
||||
nativeKey( keyCode, down );
|
||||
if( nativeKey( keyCode, 0 ) == 0 )
|
||||
return super.onKeyUp(keyCode, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -428,7 +419,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
DifferentTouchInput touchInput = null;
|
||||
|
||||
public static native void nativeMouse( int x, int y, int action, int pointerId, int pressure, int radius );
|
||||
public static native void nativeKey( int keyCode, int down );
|
||||
public static native int nativeKey( int keyCode, int down );
|
||||
public static native void initJavaCallbacks();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user