Updated readme with info about SDL joystick API
This commit is contained in:
@@ -203,7 +203,7 @@ class Settings
|
||||
idx = ii;
|
||||
Globals.RemapScreenKbKeycode[i] = idx;
|
||||
}
|
||||
Globals.ScreenKbControlsShown[0] = Globals.AppNeedsArrowKeys;
|
||||
Globals.ScreenKbControlsShown[0] = (Globals.AppNeedsArrowKeys || Globals.AppUsesJoystick);
|
||||
Globals.ScreenKbControlsShown[1] = Globals.AppNeedsTextInput;
|
||||
for( int i = 2; i < Globals.ScreenKbControlsShown.length; i++ )
|
||||
Globals.ScreenKbControlsShown[i] = ( i - 2 < Globals.AppTouchscreenKeyboardKeysAmount );
|
||||
|
||||
Submodule project/jni/application/openarena/engine updated: 7d4816a25a...4d88204dbe
Submodule project/jni/application/openarena/vm updated: c88124ddcb...c744424da5
@@ -131,7 +131,7 @@ void SDL_android_init_keymap(SDLKey *SDL_android_keymap)
|
||||
keymap[KEYCODE_PICTSYMBOLS] = SDL_KEY(LSHIFT);
|
||||
keymap[KEYCODE_SWITCH_CHARSET] = SDL_KEY(LSHIFT);
|
||||
keymap[KEYCODE_BUTTON_A] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_2));
|
||||
keymap[KEYCODE_BUTTON_B] = SDL_KEY(ESCAPE); // SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_3)); // There's no Back key on Ouya
|
||||
keymap[KEYCODE_BUTTON_B] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_3));
|
||||
keymap[KEYCODE_BUTTON_C] = SDL_KEY(C);
|
||||
keymap[KEYCODE_BUTTON_X] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_0));
|
||||
keymap[KEYCODE_BUTTON_Y] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_1));
|
||||
@@ -140,8 +140,8 @@ void SDL_android_init_keymap(SDLKey *SDL_android_keymap)
|
||||
keymap[KEYCODE_BUTTON_R1] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_4));
|
||||
keymap[KEYCODE_BUTTON_L2] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_0));
|
||||
keymap[KEYCODE_BUTTON_R2] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_6));
|
||||
keymap[KEYCODE_BUTTON_THUMBL] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_1));
|
||||
keymap[KEYCODE_BUTTON_THUMBR] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_4));
|
||||
keymap[KEYCODE_BUTTON_THUMBL] = SDL_KEY(SPACE);
|
||||
keymap[KEYCODE_BUTTON_THUMBR] = SDL_KEY(RETURN);
|
||||
keymap[KEYCODE_BUTTON_START] = SDL_KEY(RETURN);
|
||||
keymap[KEYCODE_BUTTON_SELECT] = SDL_KEY(ESCAPE);
|
||||
keymap[KEYCODE_BUTTON_MODE] = SDL_KEY(SPACE);
|
||||
|
||||
26
readme.txt
26
readme.txt
@@ -51,8 +51,7 @@ Recent Android phone models like HTC Evo have no keyboard at all, on-screen keyb
|
||||
is available for such devices - it has joystick (which can be configured as arrow buttons or analog joystick),
|
||||
and 6 configurable keys, full text input is toggled with 7-th key. Both user and application may redefine
|
||||
button layout and returned keycodes, and also toggle full text input - see SDL_screenkeyboard.h.
|
||||
Also you can read multitouch events and accelerometer events - they are passed as joystick events,
|
||||
see Ballfield sample app for the input event handling code.
|
||||
Also you can read multitouch events and accelerometer events - they are passed as joystick events.
|
||||
|
||||
This port also supports GL ES + SDL combo - there is GLXGears demo app in project/jni/application/glxgears,
|
||||
to compile it remove project/jni/application/src symlink and make new one pointing to glxgears, and run build.sh
|
||||
@@ -246,6 +245,29 @@ SDL supports AdMob advertisements, you need to set your publisher ID inside Andr
|
||||
see project test-advertisements for details.
|
||||
Also you can hide or reposition your ad from C code, check out file SDL_android.h for details.
|
||||
|
||||
SDL reports several joysticks, which are used to pass accelerometer and multitouch events.
|
||||
On-screen joystick events are sent as SDL_JOYAXISMOTION in event.jaxis.jalue, scaled from -32767 to 32767,
|
||||
with event.jaxis.which == 0 and event.jaxis.axis from 0 to 1, you will need to set AppUsesJoystick=y
|
||||
in AndroidAppSettings.cfg and call SDL_JoystickOpen(0) in your code.
|
||||
Multitouch events are sent as SDL_JOYBALLMOTION in event.jball.xrel and event.jball.yrel, scaled to screen size,
|
||||
with event.jball.which == 0 and e.jball.ball from 0 to 15, you will need to set AppUsesMultitouch=y
|
||||
in AndroidAppSettings.cfg and call SDL_JoystickOpen(0). SDL_JOYBUTTONDOWN and SDL_JOYBUTTONUP events
|
||||
are sent when the screen is touched or released, with e.jbutton.which == 0 and e.jbutton.button from 0 to 15.
|
||||
Additionally, the touch pressure is sent as SDL_JOYAXISMOTION, scaled from 0 to 32767,
|
||||
with event.jaxis.which == 0 and event.jaxis.axis from 4 to 19.
|
||||
Accelerometer events are sent as SDL_JOYAXISMOTION, with event.jaxis.which == 1 and event.jaxis.axis from 0 to 1,
|
||||
scaled from -32767 to 32767, denoting the device tilt angles from the horizontal.
|
||||
Raw accelerometer events are sent with event.jaxis.axis from 5 to 7, with Earth gravity having a value 9800.
|
||||
You will need to set AppUsesAccelerometer=y in AndroidAppSettings.cfg, and call SDL_JoystickOpen(1) in your code.
|
||||
Gyroscope events are sent as SDL_JOYAXISMOTION, with event.jaxis.which == 1 and event.jaxis.axis from 2 to 4,
|
||||
with value 32767 equal to 0.25 rad/s. You will need to set AppUsesGyroscope=y in AndroidAppSettings.cfg to use it.
|
||||
Gyroscope hardware is much more precise and less noisy than accelerometer, it is present on newer devices
|
||||
starting from Galaxy S II, but older devices do no have it - it is emulated with accelerometer + compass.
|
||||
SDL also supports gamepad - you can plug PS3/Xbox gamepad to almost any tablet, some devices have built-in gamepad.
|
||||
Gamepad stick events are sent as SDL_JOYAXISMOTION, with event.jaxis.which == 2 and event.jaxis.axis from 0 to 3.
|
||||
Gamepad analog L1/R1 buttons are sent as SDL_JOYAXISMOTION, with event.jaxis.which == 2 and event.jaxis.axis from 4 to 5.
|
||||
Other gamepad buttons generate key events, which are taken from RedefinedKeysScreenKb in AndroidAppSettings.cfg.
|
||||
|
||||
|
||||
How to compile your own application using automake/configure scripts
|
||||
====================================================================
|
||||
|
||||
Reference in New Issue
Block a user