SDL: fixed built-in emulated keyboard
This commit is contained in:
@@ -689,9 +689,9 @@ public class MainActivity extends Activity
|
||||
if (key > 100000)
|
||||
{
|
||||
key -= 100000;
|
||||
MainActivity.this.onKeyDown(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
mGLView.onKeyDown(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
}
|
||||
MainActivity.this.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
|
||||
mGLView.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
|
||||
}
|
||||
public void onRelease(int key)
|
||||
{
|
||||
@@ -705,9 +705,9 @@ public class MainActivity extends Activity
|
||||
{
|
||||
builtinKeyboard.shift = ! builtinKeyboard.shift;
|
||||
if (builtinKeyboard.shift && !builtinKeyboard.alt)
|
||||
MainActivity.this.onKeyDown(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
mGLView.onKeyDown(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
else
|
||||
MainActivity.this.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
mGLView.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
builtinKeyboard.ChangeKeyboard();
|
||||
return;
|
||||
}
|
||||
@@ -715,7 +715,7 @@ public class MainActivity extends Activity
|
||||
{
|
||||
builtinKeyboard.alt = ! builtinKeyboard.alt;
|
||||
if (builtinKeyboard.alt)
|
||||
MainActivity.this.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
mGLView.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
else
|
||||
builtinKeyboard.shift = false;
|
||||
builtinKeyboard.ChangeKeyboard();
|
||||
@@ -730,12 +730,12 @@ public class MainActivity extends Activity
|
||||
if (k.on)
|
||||
{
|
||||
builtinKeyboard.stickyKeys.add(key);
|
||||
MainActivity.this.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
|
||||
mGLView.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
|
||||
}
|
||||
else
|
||||
{
|
||||
builtinKeyboard.stickyKeys.remove(key);
|
||||
MainActivity.this.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
|
||||
mGLView.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -748,11 +748,11 @@ public class MainActivity extends Activity
|
||||
shifted = true;
|
||||
}
|
||||
|
||||
MainActivity.this.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
|
||||
mGLView.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
|
||||
|
||||
if (shifted)
|
||||
{
|
||||
MainActivity.this.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
mGLView.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||
builtinKeyboard.stickyKeys.remove(KeyEvent.KEYCODE_SHIFT_LEFT);
|
||||
for (Keyboard.Key k: builtinKeyboard.getKeyboard().getKeys())
|
||||
{
|
||||
@@ -774,6 +774,7 @@ public class MainActivity extends Activity
|
||||
_screenKeyboard = builtinKeyboard;
|
||||
FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM);
|
||||
_videoLayout.addView(_screenKeyboard, layout);
|
||||
_videoLayout.bringChildToFront(_screenKeyboard);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1553,7 +1554,7 @@ public class MainActivity extends Activity
|
||||
public ProgressDialog loadingDialog = null;
|
||||
|
||||
FrameLayout _videoLayout = null;
|
||||
private View _screenKeyboard = null;
|
||||
public View _screenKeyboard = null;
|
||||
private String _screenKeyboardHintMessage = null;
|
||||
static boolean keyboardWithoutTextInputShown = false;
|
||||
private boolean sdlInited = false;
|
||||
|
||||
@@ -1105,8 +1105,14 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(final MotionEvent event)
|
||||
public boolean onTouchEvent(final MotionEvent event)
|
||||
{
|
||||
if (mParent.keyboardWithoutTextInputShown && mParent._screenKeyboard != null &&
|
||||
mParent._screenKeyboard.getY() <= event.getY()) {
|
||||
event.offsetLocation(-mParent._screenKeyboard.getX(), -mParent._screenKeyboard.getY());
|
||||
mParent._screenKeyboard.onTouchEvent(event);
|
||||
return true;
|
||||
}
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
{
|
||||
if (getX() != 0)
|
||||
|
||||
@@ -177,9 +177,12 @@ AppUsesMultitouch=y
|
||||
# This option will add additional permission to Android manifest (y)/(n)
|
||||
AppRecordsAudio=n
|
||||
|
||||
# Application needs to access SD card. Always disable it, unless you want to access user photos and downloads. (y) / (n)
|
||||
# Application needs read/write access SD card. Always disable it, unless you want to access user photos and downloads. (y) / (n)
|
||||
AccessSdCard=y
|
||||
|
||||
# Application needs to read it's own OBB file. Enable this if you are using Play Store expansion files. (y) / (n)
|
||||
ReadObbFile=
|
||||
|
||||
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
|
||||
AccessInternet=
|
||||
|
||||
@@ -263,8 +266,8 @@ NDK_TOOLCHAIN_VERSION=clang
|
||||
APP_PLATFORM=
|
||||
|
||||
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
|
||||
# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a
|
||||
MultiABI='arm64-v8a'
|
||||
# Available architectures: armeabi-v7a x86 mips arm64-v8a
|
||||
MultiABI='armeabi-v7a'
|
||||
|
||||
# Optional shared libraries to compile - removing some of them will save space
|
||||
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
|
||||
|
||||
@@ -785,13 +785,13 @@ int main(int argc, char* argv[])
|
||||
x_speed = 500.0 * sin(t * 0.37);
|
||||
y_speed = 500.0 * sin(t * 0.53);
|
||||
z_speed = 400.0 * sin(t * 0.21);
|
||||
if( SDL_GetKeyState(NULL)[SDLK_LEFT] )
|
||||
if( SDL_GetKeyState(NULL)[SDLK_LEFT] || SDL_GetKeyState(NULL)[SDLK_a] )
|
||||
x_speed -= 100000 * dt;
|
||||
if( SDL_GetKeyState(NULL)[SDLK_RIGHT] )
|
||||
if( SDL_GetKeyState(NULL)[SDLK_RIGHT] || SDL_GetKeyState(NULL)[SDLK_d] )
|
||||
x_speed += 100000 * dt;
|
||||
if( SDL_GetKeyState(NULL)[SDLK_UP] )
|
||||
if( SDL_GetKeyState(NULL)[SDLK_UP] || SDL_GetKeyState(NULL)[SDLK_w] )
|
||||
y_speed -= 100000 * dt;
|
||||
if( SDL_GetKeyState(NULL)[SDLK_DOWN] )
|
||||
if( SDL_GetKeyState(NULL)[SDLK_DOWN] || SDL_GetKeyState(NULL)[SDLK_s] )
|
||||
y_speed += 100000 * dt;
|
||||
|
||||
ballfield_move(balls, x_speed, y_speed, z_speed);
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<Key android:codes="30" android:keyLabel="b" />
|
||||
<Key android:codes="42" android:keyLabel="n" />
|
||||
<Key android:codes="41" android:keyLabel="m" />
|
||||
<Key android:keyWidth="20.000004%p" android:codes="67" android:keyEdgeFlags="right" android:keyLabel="≪ ×" />
|
||||
<Key android:keyWidth="20.000004%p" android:codes="67" android:keyEdgeFlags="right" android:keyLabel="⬅" />
|
||||
</Row>
|
||||
<Row android:rowEdgeFlags="bottom">
|
||||
<Key android:codes="-6" android:keyEdgeFlags="left" android:keyLabel="123…" />
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<Key android:codes="30" android:keyLabel="B" android:isRepeatable="true"/>
|
||||
<Key android:codes="42" android:keyLabel="N" android:isRepeatable="true"/>
|
||||
<Key android:codes="41" android:keyLabel="M" android:isRepeatable="true"/>
|
||||
<Key android:codes="67" android:keyLabel="≪ ×" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
<Key android:codes="67" android:keyLabel="⬅" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
</Row>
|
||||
<Row android:rowEdgeFlags="bottom">
|
||||
<Key android:codes="-6" android:keyLabel="!@#…" android:keyEdgeFlags="left" android:isRepeatable="true"/>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<Key android:codes="30" android:keyLabel="b" android:isRepeatable="true"/>
|
||||
<Key android:codes="42" android:keyLabel="n" android:isRepeatable="true"/>
|
||||
<Key android:codes="41" android:keyLabel="m" android:isRepeatable="true"/>
|
||||
<Key android:codes="67" android:keyLabel="≪ ×" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
<Key android:codes="67" android:keyLabel="⬅" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
</Row>
|
||||
<Row android:rowEdgeFlags="bottom">
|
||||
<Key android:codes="-6" android:keyLabel="123…" android:keyEdgeFlags="left"/>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<Key android:codes="30" android:keyLabel="B" android:isRepeatable="true"/>
|
||||
<Key android:codes="42" android:keyLabel="N" android:isRepeatable="true"/>
|
||||
<Key android:codes="41" android:keyLabel="M" android:isRepeatable="true"/>
|
||||
<Key android:codes="67" android:keyLabel="≪ ×" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
<Key android:codes="67" android:keyLabel="⬅" android:keyWidth="20%p" android:keyEdgeFlags="right" android:isRepeatable="true"/>
|
||||
</Row>
|
||||
<Row android:rowEdgeFlags="bottom">
|
||||
<Key android:codes="-6" android:keyLabel="!@#…" android:keyEdgeFlags="left"/>
|
||||
|
||||
Reference in New Issue
Block a user