Implemented clicking with tap and timeout

This commit is contained in:
pelya
2011-02-07 17:49:14 +00:00
parent d840a57e2c
commit 0cb701bb24
12 changed files with 173 additions and 79 deletions

View File

@@ -1208,6 +1208,36 @@ class Settings
alert.show();
}
static void showRelativeMouseMovementConfig(final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.accel_fast),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_slow) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.pointandclick_relative_speed);
builder.setSingleChoiceItems(items, Globals.RelativeMouseMovementSpeed, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.RelativeMouseMovementSpeed = item;
dialog.dismiss();
showRelativeMouseMovementConfig1(p);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
{
public void onCancel(DialogInterface dialog)
{
showConfigMainMenu(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showRelativeMouseMovementConfig1(final MainActivity p)
{
final CharSequence[] items = { p.getResources().getString(R.string.accel_fast),
@@ -1997,7 +2027,7 @@ class Settings
Globals.RightClickKey,
Globals.LeftClickTimeout,
Globals.RightClickTimeout,
Globals.RelativeMouseMovement,
Globals.RelativeMouseMovement ? 1 : 0,
Globals.RelativeMouseMovementSpeed,
Globals.RelativeMouseMovementAccel );
if( Globals.AppUsesJoystick && (Globals.UseAccelerometerAsArrowKeys || Globals.UseTouchscreenKeyboard) )

View File

@@ -219,7 +219,9 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer {
public int swapBuffers() // Called from native code
{
this.notify();
synchronized(this) {
this.notify();
}
if( ! super.SwapBuffers() && Globals.NonBlockingSwapBuffers )
return 0;
if(mGlContextLost) {
@@ -227,19 +229,6 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer {
Settings.SetupTouchscreenKeyboardGraphics(context); // Reload on-screen buttons graphics
}
/*
// Pass just one char per frame, many SDL games cannot handle multiple events in a single frame
synchronized(context.textInput) {
if( context.textInput.size() >= 2 )
{
if( context.textInput.getFirst() != 0 )
nativeTextInput( context.textInput.getFirst(), context.textInput.get(1) );
context.textInput.removeFirst();
context.textInput.removeFirst();
}
}
*/
return 1;
}
@@ -256,7 +245,6 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer {
Callback cb = new Callback();
cb.parent = context;
context.runOnUiThread(cb);
//context.showScreenKeyboard();
}
public void exitApp() {
@@ -300,9 +288,11 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
touchInput.process(event);
// Wait a bit, and try to synchronize to app framerate, or event thread will eat all CPU and we'll lose FPS
if( event.getAction() == MotionEvent.ACTION_MOVE ) {
try {
mRenderer.wait(300L);
} catch (InterruptedException e) { }
synchronized(mRenderer) {
try {
mRenderer.wait(300L);
} catch (InterruptedException e) { }
}
}
return true;
};