Moved some files around between SDL 1.2 and 1.3
This commit is contained in:
@@ -20,12 +20,12 @@ AppUsesMouse=y
|
||||
AppNeedsTwoButtonMouse=n
|
||||
ShowMouseCursor=n
|
||||
ForceRelativeMouseMode=n
|
||||
AppNeedsArrowKeys=y
|
||||
AppNeedsArrowKeys=n
|
||||
AppNeedsTextInput=n
|
||||
AppUsesJoystick=n
|
||||
AppUsesJoystick=y
|
||||
AppUsesAccelerometer=y
|
||||
AppUsesMultitouch=n
|
||||
NonBlockingSwapBuffers=y
|
||||
NonBlockingSwapBuffers=n
|
||||
RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP"
|
||||
AppTouchscreenKeyboardKeysAmount=4
|
||||
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/audio/android/SDL_androidaudio.c
|
||||
349
project/jni/sdl-1.2/src/audio/android/SDL_androidaudio.c
Normal file
349
project/jni/sdl-1.2/src/audio/android/SDL_androidaudio.c
Normal file
@@ -0,0 +1,349 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
|
||||
This file written by Ryan C. Gordon (icculus@icculus.org)
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
#include "SDL_version.h"
|
||||
|
||||
#include "SDL_rwops.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audiomem.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "../SDL_audiodev_c.h"
|
||||
#include "SDL_androidaudio.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_thread.h"
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include <string.h> // for memset()
|
||||
#include <pthread.h>
|
||||
|
||||
#define _THIS SDL_AudioDevice *this
|
||||
|
||||
/* Audio driver functions */
|
||||
|
||||
static void ANDROIDAUD_WaitAudio(_THIS);
|
||||
static void ANDROIDAUD_PlayAudio(_THIS);
|
||||
static Uint8 *ANDROIDAUD_GetAudioBuf(_THIS);
|
||||
static void ANDROIDAUD_CloseAudio(_THIS);
|
||||
static void ANDROIDAUD_ThreadInit(_THIS);
|
||||
static void ANDROIDAUD_ThreadDeinit(_THIS);
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
|
||||
static int ANDROIDAUD_OpenAudio(_THIS, const char *devname, int iscapture);
|
||||
|
||||
static void ANDROIDAUD_DeleteDevice()
|
||||
{
|
||||
}
|
||||
|
||||
static int ANDROIDAUD_CreateDevice(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
|
||||
/* Set the function pointers */
|
||||
impl->OpenDevice = ANDROIDAUD_OpenAudio;
|
||||
impl->WaitDevice = ANDROIDAUD_WaitAudio;
|
||||
impl->PlayDevice = ANDROIDAUD_PlayAudio;
|
||||
impl->GetDeviceBuf = ANDROIDAUD_GetAudioBuf;
|
||||
impl->CloseDevice = ANDROIDAUD_CloseAudio;
|
||||
impl->ThreadInit = ANDROIDAUD_ThreadInit;
|
||||
impl->WaitDone = ANDROIDAUD_ThreadDeinit;
|
||||
impl->Deinitialize = ANDROIDAUD_DeleteDevice;
|
||||
impl->OnlyHasDefaultOutputDevice = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
AudioBootStrap ANDROIDAUD_bootstrap = {
|
||||
"android", "SDL Android audio driver",
|
||||
ANDROIDAUD_CreateDevice, 0
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
static int ANDROIDAUD_OpenAudio(_THIS, SDL_AudioSpec *spec);
|
||||
|
||||
static int ANDROIDAUD_Available(void)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void ANDROIDAUD_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *ANDROIDAUD_CreateDevice(int devindex)
|
||||
{
|
||||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = NULL;
|
||||
} else {
|
||||
SDL_OutOfMemory();
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = ANDROIDAUD_OpenAudio;
|
||||
this->WaitAudio = ANDROIDAUD_WaitAudio;
|
||||
this->PlayAudio = ANDROIDAUD_PlayAudio;
|
||||
this->GetAudioBuf = ANDROIDAUD_GetAudioBuf;
|
||||
this->CloseAudio = ANDROIDAUD_CloseAudio;
|
||||
this->ThreadInit = ANDROIDAUD_ThreadInit;
|
||||
this->WaitDone = ANDROIDAUD_ThreadDeinit;
|
||||
this->free = ANDROIDAUD_DeleteDevice;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
AudioBootStrap ANDROIDAUD_bootstrap = {
|
||||
"android", "SDL Android audio driver",
|
||||
ANDROIDAUD_Available, ANDROIDAUD_CreateDevice
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static unsigned char * audioBuffer = NULL;
|
||||
static size_t audioBufferSize = 0;
|
||||
|
||||
// Extremely wicked JNI environment to call Java functions from C code
|
||||
static jbyteArray audioBufferJNI = NULL;
|
||||
static JavaVM *jniVM = NULL;
|
||||
static jobject JavaAudioThread = NULL;
|
||||
static jmethodID JavaInitAudio = NULL;
|
||||
static jmethodID JavaDeinitAudio = NULL;
|
||||
static jmethodID JavaPauseAudioPlayback = NULL;
|
||||
static jmethodID JavaResumeAudioPlayback = NULL;
|
||||
|
||||
|
||||
static Uint8 *ANDROIDAUD_GetAudioBuf(_THIS)
|
||||
{
|
||||
return(audioBuffer);
|
||||
}
|
||||
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
static int ANDROIDAUD_OpenAudio (_THIS, const char *devname, int iscapture)
|
||||
{
|
||||
SDL_AudioSpec *audioFormat = &this->spec;
|
||||
|
||||
#else
|
||||
static int ANDROIDAUD_OpenAudio (_THIS, SDL_AudioSpec *spec)
|
||||
{
|
||||
SDL_AudioSpec *audioFormat = spec;
|
||||
#endif
|
||||
|
||||
int bytesPerSample;
|
||||
JNIEnv * jniEnv = NULL;
|
||||
|
||||
this->hidden = NULL;
|
||||
|
||||
if( ! (audioFormat->format == AUDIO_S8 || audioFormat->format == AUDIO_S16) )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "Application requested unsupported audio format - only S8 and S16 are supported");
|
||||
return (-1); // TODO: enable format conversion? Don't know how to do that in SDL
|
||||
}
|
||||
|
||||
bytesPerSample = (audioFormat->format & 0xFF) / 8;
|
||||
audioFormat->format = ( bytesPerSample == 2 ) ? AUDIO_S16 : AUDIO_S8;
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_OpenAudio(): app requested audio bytespersample %d freq %d channels %d samples %d", bytesPerSample, audioFormat->freq, (int)audioFormat->channels, (int)audioFormat->samples);
|
||||
|
||||
if(audioFormat->samples <= 0)
|
||||
audioFormat->samples = 128; // Some sane value
|
||||
if( audioFormat->samples > 32768 ) // Why anyone need so huge audio buffer?
|
||||
{
|
||||
audioFormat->samples = 32768;
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_OpenAudio(): limiting samples size to ", (int)audioFormat->samples);
|
||||
}
|
||||
|
||||
SDL_CalculateAudioSpec(audioFormat);
|
||||
|
||||
|
||||
(*jniVM)->AttachCurrentThread(jniVM, &jniEnv, NULL);
|
||||
|
||||
if( !jniEnv )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "ANDROIDAUD_OpenAudio: Java VM AttachCurrentThread() failed");
|
||||
return (-1); // TODO: enable format conversion? Don't know how to do that in SDL
|
||||
}
|
||||
|
||||
// The returned audioBufferSize may be huge, up to 100 Kb for 44100 because user may have selected large audio buffer to get rid of choppy sound
|
||||
audioBufferSize = (*jniEnv)->CallIntMethod( jniEnv, JavaAudioThread, JavaInitAudio,
|
||||
(jint)audioFormat->freq, (jint)audioFormat->channels,
|
||||
(jint)(( bytesPerSample == 2 ) ? 1 : 0), (jint)(audioFormat->size) );
|
||||
|
||||
if( audioBufferSize == 0 )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_OpenAudio(): failed to get audio buffer from JNI");
|
||||
ANDROIDAUD_CloseAudio(this);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* We cannot call DetachCurrentThread() from main thread or we'll crash */
|
||||
/* (*jniVM)->DetachCurrentThread(jniVM); */
|
||||
|
||||
audioFormat->samples = audioBufferSize / bytesPerSample / audioFormat->channels;
|
||||
audioFormat->size = audioBufferSize;
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_OpenAudio(): app opened audio bytespersample %d freq %d channels %d bufsize %d", bytesPerSample, audioFormat->freq, (int)audioFormat->channels, audioBufferSize);
|
||||
|
||||
SDL_CalculateAudioSpec(audioFormat);
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
return(1);
|
||||
#else
|
||||
return(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ANDROIDAUD_CloseAudio(_THIS)
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_CloseAudio()");
|
||||
JNIEnv * jniEnv = NULL;
|
||||
(*jniVM)->AttachCurrentThread(jniVM, &jniEnv, NULL);
|
||||
|
||||
(*jniEnv)->DeleteGlobalRef(jniEnv, audioBufferJNI);
|
||||
audioBufferJNI = NULL;
|
||||
audioBuffer = NULL;
|
||||
audioBufferSize = 0;
|
||||
|
||||
(*jniEnv)->CallIntMethod( jniEnv, JavaAudioThread, JavaDeinitAudio );
|
||||
|
||||
/* We cannot call DetachCurrentThread() from main thread or we'll crash */
|
||||
/* (*jniVM)->DetachCurrentThread(jniVM); */
|
||||
|
||||
}
|
||||
|
||||
/* This function waits until it is possible to write a full sound buffer */
|
||||
static void ANDROIDAUD_WaitAudio(_THIS)
|
||||
{
|
||||
/* We will block in PlayAudio(), do nothing here */
|
||||
}
|
||||
|
||||
static JNIEnv * jniEnvPlaying = NULL;
|
||||
static jmethodID JavaFillBuffer = NULL;
|
||||
|
||||
static void ANDROIDAUD_ThreadInit(_THIS)
|
||||
{
|
||||
jclass JavaAudioThreadClass = NULL;
|
||||
jmethodID JavaInitThread = NULL;
|
||||
jmethodID JavaGetBuffer = NULL;
|
||||
jboolean isCopy = JNI_TRUE;
|
||||
|
||||
(*jniVM)->AttachCurrentThread(jniVM, &jniEnvPlaying, NULL);
|
||||
|
||||
JavaAudioThreadClass = (*jniEnvPlaying)->GetObjectClass(jniEnvPlaying, JavaAudioThread);
|
||||
JavaFillBuffer = (*jniEnvPlaying)->GetMethodID(jniEnvPlaying, JavaAudioThreadClass, "fillBuffer", "()I");
|
||||
|
||||
/* HACK: raise our own thread priority to max to get rid of "W/AudioFlinger: write blocked for 54 msecs" errors */
|
||||
JavaInitThread = (*jniEnvPlaying)->GetMethodID(jniEnvPlaying, JavaAudioThreadClass, "initAudioThread", "()I");
|
||||
(*jniEnvPlaying)->CallIntMethod( jniEnvPlaying, JavaAudioThread, JavaInitThread );
|
||||
|
||||
JavaGetBuffer = (*jniEnvPlaying)->GetMethodID(jniEnvPlaying, JavaAudioThreadClass, "getBuffer", "()[B");
|
||||
audioBufferJNI = (*jniEnvPlaying)->CallObjectMethod( jniEnvPlaying, JavaAudioThread, JavaGetBuffer );
|
||||
audioBufferJNI = (*jniEnvPlaying)->NewGlobalRef(jniEnvPlaying, audioBufferJNI);
|
||||
audioBuffer = (unsigned char *) (*jniEnvPlaying)->GetByteArrayElements(jniEnvPlaying, audioBufferJNI, &isCopy);
|
||||
if( !audioBuffer )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "ANDROIDAUD_ThreadInit() JNI::GetByteArrayElements() failed! we will crash now");
|
||||
return;
|
||||
}
|
||||
if( isCopy == JNI_TRUE )
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "ANDROIDAUD_ThreadInit(): JNI returns a copy of byte array - no audio will be played");
|
||||
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_ThreadInit()");
|
||||
SDL_memset(audioBuffer, this->spec.silence, this->spec.size);
|
||||
};
|
||||
|
||||
static void ANDROIDAUD_ThreadDeinit(_THIS)
|
||||
{
|
||||
(*jniVM)->DetachCurrentThread(jniVM);
|
||||
};
|
||||
|
||||
static void ANDROIDAUD_PlayAudio(_THIS)
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_PlayAudio()");
|
||||
jboolean isCopy = JNI_TRUE;
|
||||
|
||||
(*jniEnvPlaying)->ReleaseByteArrayElements(jniEnvPlaying, audioBufferJNI, (jbyte *)audioBuffer, 0);
|
||||
audioBuffer = NULL;
|
||||
|
||||
(*jniEnvPlaying)->CallIntMethod( jniEnvPlaying, JavaAudioThread, JavaFillBuffer );
|
||||
|
||||
audioBuffer = (unsigned char *) (*jniEnvPlaying)->GetByteArrayElements(jniEnvPlaying, audioBufferJNI, &isCopy);
|
||||
if( !audioBuffer )
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "ANDROIDAUD_PlayAudio() JNI::GetByteArrayElements() failed! we will crash now");
|
||||
|
||||
if( isCopy == JNI_TRUE )
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_PlayAudio() JNI returns a copy of byte array - that's slow");
|
||||
}
|
||||
|
||||
int SDL_ANDROID_PauseAudioPlayback(void)
|
||||
{
|
||||
JNIEnv * jniEnv = NULL;
|
||||
(*jniVM)->AttachCurrentThread(jniVM, &jniEnv, NULL);
|
||||
return (*jniEnv)->CallIntMethod( jniEnv, JavaAudioThread, JavaPauseAudioPlayback );
|
||||
};
|
||||
int SDL_ANDROID_ResumeAudioPlayback(void)
|
||||
{
|
||||
JNIEnv * jniEnv = NULL;
|
||||
(*jniVM)->AttachCurrentThread(jniVM, &jniEnv, NULL);
|
||||
return (*jniEnv)->CallIntMethod( jniEnv, JavaAudioThread, JavaResumeAudioPlayback );
|
||||
};
|
||||
|
||||
|
||||
#ifndef SDL_JAVA_PACKAGE_PATH
|
||||
#error You have to define SDL_JAVA_PACKAGE_PATH to your package path with dots replaced with underscores, for example "com_example_SanAngeles"
|
||||
#endif
|
||||
#define JAVA_EXPORT_NAME2(name,package) Java_##package##_##name
|
||||
#define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package)
|
||||
#define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH)
|
||||
|
||||
JNIEXPORT jint JNICALL JAVA_EXPORT_NAME(AudioThread_nativeAudioInitJavaCallbacks) (JNIEnv * jniEnv, jobject thiz)
|
||||
{
|
||||
jclass JavaAudioThreadClass = NULL;
|
||||
JavaAudioThread = (*jniEnv)->NewGlobalRef(jniEnv, thiz);
|
||||
JavaAudioThreadClass = (*jniEnv)->GetObjectClass(jniEnv, JavaAudioThread);
|
||||
JavaInitAudio = (*jniEnv)->GetMethodID(jniEnv, JavaAudioThreadClass, "initAudio", "(IIII)I");
|
||||
JavaDeinitAudio = (*jniEnv)->GetMethodID(jniEnv, JavaAudioThreadClass, "deinitAudio", "()I");
|
||||
JavaPauseAudioPlayback = (*jniEnv)->GetMethodID(jniEnv, JavaAudioThreadClass, "pauseAudioPlayback", "()I");
|
||||
JavaResumeAudioPlayback = (*jniEnv)->GetMethodID(jniEnv, JavaAudioThreadClass, "resumeAudioPlayback", "()I");
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
jniVM = vm;
|
||||
return JNI_VERSION_1_2;
|
||||
};
|
||||
|
||||
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)
|
||||
{
|
||||
/* TODO: free JavaAudioThread */
|
||||
jniVM = vm;
|
||||
};
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/audio/android/SDL_androidaudio.h
|
||||
32
project/jni/sdl-1.2/src/audio/android/SDL_androidaudio.h
Normal file
32
project/jni/sdl-1.2/src/audio/android/SDL_androidaudio.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
#ifndef _SDL_androidaudio_h
|
||||
#define _SDL_androidaudio_h
|
||||
|
||||
#include "../SDL_sysaudio.h"
|
||||
|
||||
struct SDL_PrivateAudioData {
|
||||
};
|
||||
|
||||
#endif /* _SDL_androidaudio_h */
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/android/SDL_androidinput.c
|
||||
2183
project/jni/sdl-1.2/src/video/android/SDL_androidinput.c
Normal file
2183
project/jni/sdl-1.2/src/video/android/SDL_androidinput.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/android/SDL_androidinput.h
|
||||
206
project/jni/sdl-1.2/src/video/android/SDL_androidinput.h
Normal file
206
project/jni/sdl-1.2/src/video/android/SDL_androidinput.h
Normal file
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
#ifndef _SDL_ANDROIDINPUT_H_
|
||||
#define _SDL_ANDROIDINPUT_H_
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
||||
#include "SDL_version.h"
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_mouse.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../SDL_pixels_c.h"
|
||||
#include "SDL_events.h"
|
||||
#if (SDL_VERSION_ATLEAST(1,3,0))
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
#include "../../events/SDL_mouse_c.h"
|
||||
#include "SDL_keycode.h"
|
||||
#include "SDL_scancode.h"
|
||||
//#include "SDL_compat.h"
|
||||
#else
|
||||
#include "SDL_keysym.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#endif
|
||||
#include "SDL_joystick.h"
|
||||
#include "../../joystick/SDL_sysjoystick.h"
|
||||
#include "../../joystick/SDL_joystick_c.h"
|
||||
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "SDL_androidvideo.h"
|
||||
#include "javakeycodes.h"
|
||||
|
||||
/* JNI-C++ wrapper stuff */
|
||||
|
||||
// Special key to signal that key should be handled by Java internally, such as Volume Up/Down keys
|
||||
#define SDLK_NO_REMAP 512
|
||||
#define SDL_SCANCODE_NO_REMAP SDLK_NO_REMAP
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
|
||||
#define SDL_KEY2(X) SDL_SCANCODE_ ## X
|
||||
#define SDL_KEY(X) SDL_KEY2(X)
|
||||
typedef SDL_Scancode SDL_scancode;
|
||||
typedef SDL_Keycode SDLKey;
|
||||
typedef SDL_Keysym SDL_keysym;
|
||||
|
||||
#else
|
||||
|
||||
#define SDL_KEY2(X) SDLK_ ## X
|
||||
#define SDL_KEY(X) SDL_KEY2(X)
|
||||
|
||||
// Randomly redefining SDL 1.3 scancodes to SDL 1.2 keycodes
|
||||
#define KP_0 KP0
|
||||
#define KP_1 KP1
|
||||
#define KP_2 KP2
|
||||
#define KP_3 KP3
|
||||
#define KP_4 KP4
|
||||
#define KP_5 KP5
|
||||
#define KP_6 KP6
|
||||
#define KP_7 KP7
|
||||
#define KP_8 KP8
|
||||
#define KP_9 KP9
|
||||
#define NUMLOCKCLEAR NUMLOCK
|
||||
#define GRAVE DOLLAR
|
||||
#define APOSTROPHE QUOTE
|
||||
#define LGUI LMETA
|
||||
#define RGUI RMETA
|
||||
#define SCROLLLOCK SCROLLOCK
|
||||
// Overkill haha
|
||||
#define A a
|
||||
#define B b
|
||||
#define C c
|
||||
#define D d
|
||||
#define E e
|
||||
#define F f
|
||||
#define G g
|
||||
#define H h
|
||||
#define I i
|
||||
#define J j
|
||||
#define K k
|
||||
#define L l
|
||||
#define M m
|
||||
#define N n
|
||||
#define O o
|
||||
#define P p
|
||||
#define Q q
|
||||
#define R r
|
||||
#define S s
|
||||
#define T t
|
||||
#define U u
|
||||
#define V v
|
||||
#define W w
|
||||
#define X x
|
||||
#define Y y
|
||||
#define Z z
|
||||
|
||||
typedef SDLKey SDL_scancode;
|
||||
#define SDL_GetKeyboardState SDL_GetKeyState
|
||||
|
||||
#endif
|
||||
|
||||
#define SDL_KEY_VAL(X) X
|
||||
|
||||
enum MOUSE_ACTION { MOUSE_DOWN = 0, MOUSE_UP = 1, MOUSE_MOVE = 2, MOUSE_HOVER = 3 };
|
||||
|
||||
extern int SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int pointerId);
|
||||
extern int SDL_ANDROID_isTouchscreenKeyboardUsed;
|
||||
|
||||
#ifndef SDL_ANDROID_KEYCODE_0
|
||||
#define SDL_ANDROID_KEYCODE_0 RETURN
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_1
|
||||
#define SDL_ANDROID_KEYCODE_1 END
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_2
|
||||
#define SDL_ANDROID_KEYCODE_2 NO_REMAP
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_3
|
||||
#define SDL_ANDROID_KEYCODE_3 NO_REMAP
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_4
|
||||
#define SDL_ANDROID_KEYCODE_4 LCTRL
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_5
|
||||
#define SDL_ANDROID_KEYCODE_5 ESCAPE
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_6
|
||||
#define SDL_ANDROID_KEYCODE_6 RSHIFT
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_7
|
||||
#define SDL_ANDROID_KEYCODE_7 SDL_ANDROID_KEYCODE_1
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_8
|
||||
#define SDL_ANDROID_KEYCODE_8 LALT
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_9
|
||||
#define SDL_ANDROID_KEYCODE_9 RALT
|
||||
#endif
|
||||
|
||||
// Touchscreen keyboard keys + zoom and rotate keycodes
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_0
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_0 SDL_ANDROID_KEYCODE_0
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_1
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_1 SDL_ANDROID_KEYCODE_1
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_2
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_2 PAGEUP
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_3
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_3 PAGEDOWN
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_4
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_4 SDL_ANDROID_KEYCODE_6
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_5
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_5 SDL_ANDROID_KEYCODE_7
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_6
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_6 SDL_ANDROID_KEYCODE_4
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_7
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_7 SDL_ANDROID_KEYCODE_5
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_8
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_8 SDL_ANDROID_KEYCODE_8
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_9
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_9 SDL_ANDROID_KEYCODE_9
|
||||
#endif
|
||||
|
||||
// Queue events to main thread
|
||||
extern void SDL_ANDROID_MainThreadPushMouseMotion(int x, int y);
|
||||
extern void SDL_ANDROID_MainThreadPushMouseButton(int pressed, int button);
|
||||
extern void SDL_ANDROID_MainThreadPushKeyboardKey(int pressed, SDL_scancode key);
|
||||
extern void SDL_ANDROID_MainThreadPushMultitouchButton(int id, int pressed, int x, int y, int force); // SDL 1.3 only
|
||||
extern void SDL_ANDROID_MainThreadPushMultitouchMotion(int id, int x, int y, int force); // SDL 1.3 only
|
||||
extern void SDL_ANDROID_MainThreadPushJoystickAxis(int joy, int axis, int value);
|
||||
extern void SDL_ANDROID_MainThreadPushJoystickButton(int joy, int button, int pressed);
|
||||
extern void SDL_ANDROID_MainThreadPushJoystickBall(int joy, int ball, int x, int y);
|
||||
extern void SDL_ANDROID_MainThreadPushText( int ascii, int unicode );
|
||||
extern void SDL_android_init_keymap(SDLKey *SDL_android_keymap);
|
||||
extern void SDL_ANDROID_MainThreadPushMouseWheel( int x, int y ); // SDL 1.3 only
|
||||
extern void SDL_ANDROID_MainThreadPushAppActive(int active);
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/android/SDL_androidvideo.c
|
||||
402
project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c
Normal file
402
project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c
Normal file
@@ -0,0 +1,402 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <string.h> // for memset()
|
||||
|
||||
#include "SDL_config.h"
|
||||
#include "SDL_version.h"
|
||||
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_mouse.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_android.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../SDL_pixels_c.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "SDL_androidvideo.h"
|
||||
#include "jniwrapperstuff.h"
|
||||
|
||||
|
||||
// The device screen dimensions to draw on
|
||||
int SDL_ANDROID_sWindowWidth = 0;
|
||||
int SDL_ANDROID_sWindowHeight = 0;
|
||||
|
||||
int SDL_ANDROID_sRealWindowWidth = 0;
|
||||
int SDL_ANDROID_sRealWindowHeight = 0;
|
||||
|
||||
SDL_Rect SDL_ANDROID_ForceClearScreenRect = { 0, 0, 0, 0 };
|
||||
|
||||
// Extremely wicked JNI environment to call Java functions from C code
|
||||
static JNIEnv* JavaEnv = NULL;
|
||||
static jclass JavaRendererClass = NULL;
|
||||
static jobject JavaRenderer = NULL;
|
||||
static jmethodID JavaSwapBuffers = NULL;
|
||||
static jmethodID JavaShowScreenKeyboard = NULL;
|
||||
static jmethodID JavaToggleScreenKeyboardWithoutTextInput = NULL;
|
||||
static jmethodID JavaGetAdvertisementParams = NULL;
|
||||
static jmethodID JavaSetAdvertisementVisible = NULL;
|
||||
static jmethodID JavaSetAdvertisementPosition = NULL;
|
||||
static jmethodID JavaRequestNewAdvertisement = NULL;
|
||||
static int glContextLost = 0;
|
||||
static int showScreenKeyboardDeferred = 0;
|
||||
static const char * showScreenKeyboardOldText = "";
|
||||
static int showScreenKeyboardSendBackspace = 0;
|
||||
int SDL_ANDROID_VideoLinearFilter = 0;
|
||||
int SDL_ANDROID_VideoMultithreaded = 0;
|
||||
int SDL_ANDROID_VideoForceSoftwareMode = 0;
|
||||
int SDL_ANDROID_CompatibilityHacks = 0;
|
||||
int SDL_ANDROID_BYTESPERPIXEL = 2;
|
||||
int SDL_ANDROID_BITSPERPIXEL = 16;
|
||||
int SDL_ANDROID_UseGles2 = 0;
|
||||
int SDL_ANDROID_ShowMouseCursor = 0;
|
||||
|
||||
static void appPutToBackgroundCallbackDefault(void)
|
||||
{
|
||||
SDL_ANDROID_PauseAudioPlayback();
|
||||
}
|
||||
static void appRestoredCallbackDefault(void)
|
||||
{
|
||||
SDL_ANDROID_ResumeAudioPlayback();
|
||||
}
|
||||
|
||||
static SDL_ANDROID_ApplicationPutToBackgroundCallback_t appPutToBackgroundCallback = appPutToBackgroundCallbackDefault;
|
||||
static SDL_ANDROID_ApplicationPutToBackgroundCallback_t appRestoredCallback = appRestoredCallbackDefault;
|
||||
static SDL_ANDROID_ApplicationPutToBackgroundCallback_t openALPutToBackgroundCallback = NULL;
|
||||
static SDL_ANDROID_ApplicationPutToBackgroundCallback_t openALRestoredCallback = NULL;
|
||||
|
||||
int SDL_ANDROID_CallJavaSwapBuffers()
|
||||
{
|
||||
if( !glContextLost )
|
||||
{
|
||||
SDL_ANDROID_drawTouchscreenKeyboard();
|
||||
}
|
||||
|
||||
// Clear part of screen not used by SDL - on Android the screen contains garbage after each frame
|
||||
if( SDL_ANDROID_ForceClearScreenRect.w != 0 && SDL_ANDROID_ForceClearScreenRect.h != 0 )
|
||||
{
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrthox( 0, (SDL_ANDROID_sRealWindowWidth) * 0x10000, SDL_ANDROID_sRealWindowHeight * 0x10000, 0, 0, 1 * 0x10000 );
|
||||
glColor4x(0, 0, 0, 0x10000);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
GLshort vertices[] = { SDL_ANDROID_ForceClearScreenRect.x, SDL_ANDROID_ForceClearScreenRect.y,
|
||||
SDL_ANDROID_ForceClearScreenRect.x + SDL_ANDROID_ForceClearScreenRect.w, SDL_ANDROID_ForceClearScreenRect.y,
|
||||
SDL_ANDROID_ForceClearScreenRect.x + SDL_ANDROID_ForceClearScreenRect.w, SDL_ANDROID_ForceClearScreenRect.y + SDL_ANDROID_ForceClearScreenRect.h,
|
||||
SDL_ANDROID_ForceClearScreenRect.x, SDL_ANDROID_ForceClearScreenRect.y + SDL_ANDROID_ForceClearScreenRect.h };
|
||||
glVertexPointer(2, GL_SHORT, 0, vertices);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
if( ! (*JavaEnv)->CallIntMethod( JavaEnv, JavaRenderer, JavaSwapBuffers ) )
|
||||
return 0;
|
||||
if( glContextLost )
|
||||
{
|
||||
glContextLost = 0;
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "OpenGL context recreated, refreshing textures");
|
||||
SDL_ANDROID_VideoContextRecreated();
|
||||
appRestoredCallback();
|
||||
if(openALRestoredCallback)
|
||||
openALRestoredCallback();
|
||||
}
|
||||
if( showScreenKeyboardDeferred )
|
||||
{
|
||||
showScreenKeyboardDeferred = 0;
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaShowScreenKeyboard, (*JavaEnv)->NewStringUTF(JavaEnv, showScreenKeyboardOldText), showScreenKeyboardSendBackspace );
|
||||
}
|
||||
SDL_ANDROID_ProcessDeferredEvents();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeResize) ( JNIEnv* env, jobject thiz, jint w, jint h, jint keepRatio )
|
||||
{
|
||||
if( SDL_ANDROID_sWindowWidth == 0 )
|
||||
{
|
||||
SDL_ANDROID_sRealWindowWidth = w;
|
||||
SDL_ANDROID_sRealWindowHeight = h;
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
// Not supported in SDL 1.3
|
||||
#else
|
||||
if( keepRatio )
|
||||
{
|
||||
// TODO: tweak that parameters when app calls SetVideoMode(), not here - app may request something else than 640x480, it's okay for most apps though
|
||||
SDL_ANDROID_sWindowWidth = (SDL_ANDROID_sFakeWindowWidth*h)/SDL_ANDROID_sFakeWindowHeight;
|
||||
SDL_ANDROID_sWindowHeight = h;
|
||||
SDL_ANDROID_ForceClearScreenRect.x = SDL_ANDROID_sWindowWidth;
|
||||
SDL_ANDROID_ForceClearScreenRect.y = 0;
|
||||
SDL_ANDROID_ForceClearScreenRect.w = w - SDL_ANDROID_sWindowWidth;
|
||||
SDL_ANDROID_ForceClearScreenRect.h = h;
|
||||
|
||||
if(SDL_ANDROID_sWindowWidth >= w)
|
||||
{
|
||||
SDL_ANDROID_sWindowWidth = w;
|
||||
SDL_ANDROID_sWindowHeight = (SDL_ANDROID_sFakeWindowHeight*w)/SDL_ANDROID_sFakeWindowWidth;
|
||||
SDL_ANDROID_ForceClearScreenRect.x = 0;
|
||||
SDL_ANDROID_ForceClearScreenRect.y = SDL_ANDROID_sWindowHeight;
|
||||
SDL_ANDROID_ForceClearScreenRect.w = w;
|
||||
SDL_ANDROID_ForceClearScreenRect.h = SDL_ANDROID_sWindowHeight - h; // OpenGL vertical coord is inverted
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SDL_ANDROID_ForceClearScreenRect.w = 0;
|
||||
SDL_ANDROID_ForceClearScreenRect.h = 0;
|
||||
SDL_ANDROID_ForceClearScreenRect.x = 0;
|
||||
SDL_ANDROID_ForceClearScreenRect.y = 0;
|
||||
SDL_ANDROID_sWindowWidth = w;
|
||||
SDL_ANDROID_sWindowHeight = h;
|
||||
}
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Physical screen resolution is %dx%d, virtual screen %dx%d", w, h, SDL_ANDROID_sWindowWidth, SDL_ANDROID_sWindowHeight );
|
||||
SDL_ANDROID_TouchscreenCalibrationWidth = SDL_ANDROID_sWindowWidth;
|
||||
SDL_ANDROID_TouchscreenCalibrationHeight = SDL_ANDROID_sWindowHeight;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeDone) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "quitting...");
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
SDL_SendQuit();
|
||||
#else
|
||||
SDL_PrivateQuit();
|
||||
#endif
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "quit OK");
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeGlContextLost) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "OpenGL context lost, waiting for new OpenGL context");
|
||||
glContextLost = 1;
|
||||
appPutToBackgroundCallback();
|
||||
if(openALPutToBackgroundCallback)
|
||||
openALPutToBackgroundCallback();
|
||||
|
||||
SDL_ANDROID_VideoContextLost();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeGlContextLostAsyncEvent) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "OpenGL context lost - sending SDL_ACTIVEEVENT");
|
||||
SDL_ANDROID_MainThreadPushAppActive(0);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeGlContextRecreated) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "OpenGL context recreated, sending SDL_ACTIVEEVENT");
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
//if( ANDROID_CurrentWindow )
|
||||
// SDL_SendWindowEvent(ANDROID_CurrentWindow, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
||||
#else
|
||||
SDL_PrivateAppActive(1, SDL_APPACTIVE|SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS);
|
||||
#endif
|
||||
}
|
||||
|
||||
int SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput(void)
|
||||
{
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaToggleScreenKeyboardWithoutTextInput );
|
||||
return 1;
|
||||
}
|
||||
|
||||
volatile static textInputFinished = 0;
|
||||
void SDL_ANDROID_TextInputFinished()
|
||||
{
|
||||
textInputFinished = 1;
|
||||
};
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#else
|
||||
extern int SDL_Flip(SDL_Surface *screen);
|
||||
extern SDL_Surface *SDL_GetVideoSurface(void);
|
||||
#endif
|
||||
|
||||
void SDL_ANDROID_CallJavaShowScreenKeyboard(const char * oldText, char * outBuf, int outBufLen)
|
||||
{
|
||||
if( !outBuf )
|
||||
{
|
||||
showScreenKeyboardDeferred = 1;
|
||||
showScreenKeyboardOldText = oldText;
|
||||
showScreenKeyboardSendBackspace = 1;
|
||||
// Move mouse by 1 pixel to force screen update
|
||||
int x, y;
|
||||
SDL_GetMouseState( &x, &y );
|
||||
SDL_ANDROID_MainThreadPushMouseMotion(x > 0 ? x-1 : 0, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
textInputFinished = 0;
|
||||
SDL_ANDROID_TextInputInit(outBuf, outBufLen);
|
||||
|
||||
if( SDL_ANDROID_VideoMultithreaded )
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#else
|
||||
// Dirty hack: we may call (*JavaEnv)->CallVoidMethod(...) only from video thread
|
||||
showScreenKeyboardDeferred = 1;
|
||||
showScreenKeyboardOldText = oldText;
|
||||
showScreenKeyboardSendBackspace = 0;
|
||||
SDL_Flip(SDL_GetVideoSurface());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaShowScreenKeyboard, (*JavaEnv)->NewStringUTF(JavaEnv, oldText), 0 );
|
||||
|
||||
while( !textInputFinished )
|
||||
SDL_Delay(100);
|
||||
textInputFinished = 0;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeInitJavaCallbacks) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
JavaEnv = env;
|
||||
JavaRenderer = (*JavaEnv)->NewGlobalRef( JavaEnv, thiz );
|
||||
|
||||
JavaRendererClass = (*JavaEnv)->GetObjectClass(JavaEnv, thiz);
|
||||
JavaSwapBuffers = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "swapBuffers", "()I");
|
||||
JavaShowScreenKeyboard = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "showScreenKeyboard", "(Ljava/lang/String;I)V");
|
||||
JavaToggleScreenKeyboardWithoutTextInput = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "showScreenKeyboardWithoutTextInputField", "()V");
|
||||
// TODO: implement it
|
||||
JavaGetAdvertisementParams = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "getAdvertisementParams", "([I)V");
|
||||
JavaSetAdvertisementVisible = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "setAdvertisementVisible", "(I)V");
|
||||
JavaSetAdvertisementPosition = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "setAdvertisementPosition", "(II)V");
|
||||
JavaRequestNewAdvertisement = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "requestNewAdvertisement", "()V");
|
||||
|
||||
ANDROID_InitOSKeymap();
|
||||
}
|
||||
|
||||
int SDL_ANDROID_SetApplicationPutToBackgroundCallback(
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t appPutToBackground,
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t appRestored )
|
||||
{
|
||||
appPutToBackgroundCallback = appPutToBackgroundCallbackDefault;
|
||||
appRestoredCallback = appRestoredCallbackDefault;
|
||||
|
||||
if( appPutToBackground )
|
||||
appPutToBackgroundCallback = appPutToBackground;
|
||||
|
||||
if( appRestoredCallback )
|
||||
appRestoredCallback = appRestored;
|
||||
}
|
||||
|
||||
extern int SDL_ANDROID_SetOpenALPutToBackgroundCallback(
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t PutToBackground,
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t Restored );
|
||||
|
||||
int SDL_ANDROID_SetOpenALPutToBackgroundCallback(
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t PutToBackground,
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t Restored )
|
||||
{
|
||||
openALPutToBackgroundCallback = PutToBackground;
|
||||
openALRestoredCallback = Restored;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetVideoLinearFilter) (JNIEnv* env, jobject thiz)
|
||||
{
|
||||
SDL_ANDROID_VideoLinearFilter = 1;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetVideoMultithreaded) (JNIEnv* env, jobject thiz)
|
||||
{
|
||||
SDL_ANDROID_VideoMultithreaded = 1;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetVideoForceSoftwareMode) (JNIEnv* env, jobject thiz)
|
||||
{
|
||||
SDL_ANDROID_VideoForceSoftwareMode = 1;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetCompatibilityHacks) (JNIEnv* env, jobject thiz)
|
||||
{
|
||||
SDL_ANDROID_CompatibilityHacks = 1;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetVideoDepth) (JNIEnv* env, jobject thiz, jint bpp, jint UseGles2)
|
||||
{
|
||||
SDL_ANDROID_BITSPERPIXEL = bpp;
|
||||
SDL_ANDROID_BYTESPERPIXEL = SDL_ANDROID_BITSPERPIXEL / 8;
|
||||
SDL_ANDROID_UseGles2 = UseGles2;
|
||||
}
|
||||
|
||||
int SDLCALL SDL_ANDROID_GetAdvertisementParams(int * visible, SDL_Rect * position)
|
||||
{
|
||||
jint arr[5];
|
||||
jintArray elemArr = (*JavaEnv)->NewIntArray(JavaEnv, 5);
|
||||
if (elemArr == NULL)
|
||||
return 0;
|
||||
(*JavaEnv)->SetIntArrayRegion(JavaEnv, elemArr, 0, 5, arr);
|
||||
(*JavaEnv)->CallVoidMethod(JavaEnv, JavaRenderer, JavaGetAdvertisementParams, elemArr);
|
||||
(*JavaEnv)->GetIntArrayRegion(JavaEnv, elemArr, 0, 5, arr);
|
||||
(*JavaEnv)->DeleteLocalRef(JavaEnv, elemArr);
|
||||
if(visible)
|
||||
*visible = arr[0];
|
||||
if(position)
|
||||
{
|
||||
position->x = arr[1];
|
||||
position->y = arr[2];
|
||||
position->w = arr[3];
|
||||
position->h = arr[4];
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
int SDLCALL SDL_ANDROID_SetAdvertisementVisible(int visible)
|
||||
{
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaSetAdvertisementVisible, (jint)visible );
|
||||
return 1;
|
||||
}
|
||||
int SDLCALL SDL_ANDROID_SetAdvertisementPosition(int left, int top)
|
||||
{
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaSetAdvertisementPosition, (jint)left, (jint)top );
|
||||
return 1;
|
||||
}
|
||||
int SDLCALL SDL_ANDROID_RequestNewAdvertisement(void)
|
||||
{
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaRequestNewAdvertisement );
|
||||
return 1;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/android/SDL_androidvideo.h
|
||||
86
project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h
Normal file
86
project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
#ifndef _SDL_androidvideo_h
|
||||
#define _SDL_androidvideo_h
|
||||
|
||||
#include "SDL_version.h"
|
||||
#include "SDL_config.h"
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_events.h"
|
||||
|
||||
enum ScreenZoom { ZOOM_NONE = 0, ZOOM_MAGNIFIER = 1, ZOOM_SCREEN_TRANSFORM = 2, ZOOM_FULLSCREEN_MAGNIFIER = 3 };
|
||||
|
||||
extern int SDL_ANDROID_sWindowWidth;
|
||||
extern int SDL_ANDROID_sWindowHeight;
|
||||
extern int SDL_ANDROID_sRealWindowWidth;
|
||||
extern int SDL_ANDROID_sRealWindowHeight;
|
||||
extern int SDL_ANDROID_sFakeWindowWidth; // SDL 1.2 only
|
||||
extern int SDL_ANDROID_sFakeWindowHeight; // SDL 1.2 only
|
||||
extern int SDL_ANDROID_TouchscreenCalibrationWidth;
|
||||
extern int SDL_ANDROID_TouchscreenCalibrationHeight;
|
||||
extern int SDL_ANDROID_TouchscreenCalibrationX;
|
||||
extern int SDL_ANDROID_TouchscreenCalibrationY;
|
||||
extern int SDL_ANDROID_VideoLinearFilter;
|
||||
extern int SDL_ANDROID_VideoMultithreaded;
|
||||
extern int SDL_ANDROID_VideoForceSoftwareMode;
|
||||
extern int SDL_ANDROID_CompatibilityHacks;
|
||||
extern int SDL_ANDROID_ShowMouseCursor;
|
||||
extern int SDL_ANDROID_UseGles2;
|
||||
extern int SDL_ANDROID_BYTESPERPIXEL;
|
||||
extern int SDL_ANDROID_BITSPERPIXEL;
|
||||
extern void SDL_ANDROID_TextInputInit(char * buffer, int len);
|
||||
extern void SDL_ANDROID_TextInputFinished();
|
||||
extern SDL_Surface *SDL_CurrentVideoSurface;
|
||||
extern SDL_Rect SDL_ANDROID_ForceClearScreenRect;
|
||||
extern int SDL_ANDROID_ShowScreenUnderFinger;
|
||||
extern SDL_Rect SDL_ANDROID_ShowScreenUnderFingerRect, SDL_ANDROID_ShowScreenUnderFingerRectSrc;
|
||||
extern int SDL_ANDROID_CallJavaSwapBuffers();
|
||||
extern void SDL_ANDROID_CallJavaShowScreenKeyboard(const char * oldText, char * outBuf, int outBufLen);
|
||||
extern int SDL_ANDROID_drawTouchscreenKeyboard();
|
||||
extern void SDL_ANDROID_VideoContextLost();
|
||||
extern void SDL_ANDROID_VideoContextRecreated();
|
||||
extern void SDL_ANDROID_processAndroidTrackballDampening();
|
||||
extern void SDL_ANDROID_processMoveMouseWithKeyboard();
|
||||
extern int SDL_ANDROID_InsideVideoThread();
|
||||
extern void SDL_ANDROID_initFakeStdout();
|
||||
extern SDL_VideoDevice *ANDROID_CreateDevice_1_3(int devindex);
|
||||
extern void SDL_ANDROID_ProcessDeferredEvents();
|
||||
extern void SDL_ANDROID_WarpMouse(int x, int y);
|
||||
extern void SDL_ANDROID_DrawMouseCursor(int x, int y, int size, int alpha);
|
||||
extern void SDL_ANDROID_DrawMouseCursorIfNeeded();
|
||||
extern void SDL_ANDROID_CallJavaTogglePlainAndroidSoftKeyboardInput();
|
||||
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
extern SDL_Window * ANDROID_CurrentWindow;
|
||||
#endif
|
||||
|
||||
// Exports from SDL_androidinput.c - SDL_androidinput.h is too encumbered
|
||||
enum { MAX_MULTITOUCH_POINTERS = 16 };
|
||||
extern void ANDROID_InitOSKeymap();
|
||||
extern int SDL_ANDROID_isJoystickUsed;
|
||||
// Events have to be sent only from main thread from PumpEvents(), so we'll buffer them here
|
||||
extern void SDL_ANDROID_PumpEvents();
|
||||
|
||||
|
||||
#endif /* _SDL_androidvideo_h */
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c
|
||||
1064
project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c
Normal file
1064
project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/android/atan2i.h
|
||||
33
project/jni/sdl-1.2/src/video/android/atan2i.h
Normal file
33
project/jni/sdl-1.2/src/video/android/atan2i.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef __ATAN2I_H__
|
||||
#define __ATAN2I_H__
|
||||
#include <math.h>
|
||||
|
||||
// Fast arctan2, returns angle in radians as integer, with fractional part in lower 16 bits
|
||||
// Stolen from http://www.dspguru.com/dsp/tricks/fixed-point-atan2-with-self-normalization , precision is said to be 0.07 rads
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
enum { atan2i_coeff_1 = ((int)(M_PI*65536.0/4)), atan2i_coeff_2 = (3*atan2i_coeff_1), atan2i_PI = (int)(M_PI * 65536.0) };
|
||||
|
||||
static inline int atan2i(int y, int x)
|
||||
{
|
||||
int angle;
|
||||
int abs_y = abs(y);
|
||||
if( abs_y == 0 )
|
||||
abs_y = 1;
|
||||
if (x>=0)
|
||||
{
|
||||
angle = atan2i_coeff_1 - atan2i_coeff_1 * (x - abs_y) / (x + abs_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
angle = atan2i_coeff_2 - atan2i_coeff_1 * (x + abs_y) / (abs_y - x);
|
||||
}
|
||||
if (y < 0)
|
||||
return(-angle); // negate if in quad III or IV
|
||||
else
|
||||
return(angle);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/android/javakeycodes.h
|
||||
215
project/jni/sdl-1.2/src/video/android/javakeycodes.h
Normal file
215
project/jni/sdl-1.2/src/video/android/javakeycodes.h
Normal file
@@ -0,0 +1,215 @@
|
||||
#ifndef _JAVA_KEY_CODES_H_
|
||||
#define _JAVA_KEY_CODES_H_
|
||||
|
||||
// Keycodes ripped from Java SDK
|
||||
enum KEYCODES_ANDROID
|
||||
{
|
||||
KEYCODE_UNKNOWN = 0,
|
||||
KEYCODE_SOFT_LEFT = 1,
|
||||
KEYCODE_SOFT_RIGHT = 2,
|
||||
KEYCODE_HOME = 3,
|
||||
KEYCODE_BACK = 4,
|
||||
KEYCODE_CALL = 5,
|
||||
KEYCODE_ENDCALL = 6,
|
||||
KEYCODE_0 = 7,
|
||||
KEYCODE_1 = 8,
|
||||
KEYCODE_2 = 9,
|
||||
KEYCODE_3 = 10,
|
||||
KEYCODE_4 = 11,
|
||||
KEYCODE_5 = 12,
|
||||
KEYCODE_6 = 13,
|
||||
KEYCODE_7 = 14,
|
||||
KEYCODE_8 = 15,
|
||||
KEYCODE_9 = 16,
|
||||
KEYCODE_STAR = 17,
|
||||
KEYCODE_POUND = 18,
|
||||
KEYCODE_DPAD_UP = 19,
|
||||
KEYCODE_DPAD_DOWN = 20,
|
||||
KEYCODE_DPAD_LEFT = 21,
|
||||
KEYCODE_DPAD_RIGHT = 22,
|
||||
KEYCODE_DPAD_CENTER = 23,
|
||||
KEYCODE_VOLUME_UP = 24,
|
||||
KEYCODE_VOLUME_DOWN = 25,
|
||||
KEYCODE_POWER = 26,
|
||||
KEYCODE_CAMERA = 27,
|
||||
KEYCODE_CLEAR = 28,
|
||||
KEYCODE_A = 29,
|
||||
KEYCODE_B = 30,
|
||||
KEYCODE_C = 31,
|
||||
KEYCODE_D = 32,
|
||||
KEYCODE_E = 33,
|
||||
KEYCODE_F = 34,
|
||||
KEYCODE_G = 35,
|
||||
KEYCODE_H = 36,
|
||||
KEYCODE_I = 37,
|
||||
KEYCODE_J = 38,
|
||||
KEYCODE_K = 39,
|
||||
KEYCODE_L = 40,
|
||||
KEYCODE_M = 41,
|
||||
KEYCODE_N = 42,
|
||||
KEYCODE_O = 43,
|
||||
KEYCODE_P = 44,
|
||||
KEYCODE_Q = 45,
|
||||
KEYCODE_R = 46,
|
||||
KEYCODE_S = 47,
|
||||
KEYCODE_T = 48,
|
||||
KEYCODE_U = 49,
|
||||
KEYCODE_V = 50,
|
||||
KEYCODE_W = 51,
|
||||
KEYCODE_X = 52,
|
||||
KEYCODE_Y = 53,
|
||||
KEYCODE_Z = 54,
|
||||
KEYCODE_COMMA = 55,
|
||||
KEYCODE_PERIOD = 56,
|
||||
KEYCODE_ALT_LEFT = 57,
|
||||
KEYCODE_ALT_RIGHT = 58,
|
||||
KEYCODE_SHIFT_LEFT = 59,
|
||||
KEYCODE_SHIFT_RIGHT = 60,
|
||||
KEYCODE_TAB = 61,
|
||||
KEYCODE_SPACE = 62,
|
||||
KEYCODE_SYM = 63,
|
||||
KEYCODE_EXPLORER = 64,
|
||||
KEYCODE_ENVELOPE = 65,
|
||||
KEYCODE_ENTER = 66,
|
||||
KEYCODE_DEL = 67,
|
||||
KEYCODE_GRAVE = 68,
|
||||
KEYCODE_MINUS = 69,
|
||||
KEYCODE_EQUALS = 70,
|
||||
KEYCODE_LEFT_BRACKET = 71,
|
||||
KEYCODE_RIGHT_BRACKET = 72,
|
||||
KEYCODE_BACKSLASH = 73,
|
||||
KEYCODE_SEMICOLON = 74,
|
||||
KEYCODE_APOSTROPHE = 75,
|
||||
KEYCODE_SLASH = 76,
|
||||
KEYCODE_AT = 77,
|
||||
KEYCODE_NUM = 78,
|
||||
KEYCODE_HEADSETHOOK = 79,
|
||||
KEYCODE_FOCUS = 80,
|
||||
KEYCODE_PLUS = 81,
|
||||
KEYCODE_MENU = 82,
|
||||
KEYCODE_NOTIFICATION = 83,
|
||||
KEYCODE_SEARCH = 84,
|
||||
KEYCODE_MEDIA_PLAY_PAUSE= 85,
|
||||
KEYCODE_MEDIA_STOP = 86,
|
||||
KEYCODE_MEDIA_NEXT = 87,
|
||||
KEYCODE_MEDIA_PREVIOUS = 88,
|
||||
KEYCODE_MEDIA_REWIND = 89,
|
||||
KEYCODE_MEDIA_FAST_FORWARD = 90,
|
||||
KEYCODE_MUTE = 91,
|
||||
KEYCODE_PAGE_UP = 92,
|
||||
KEYCODE_PAGE_DOWN = 93,
|
||||
KEYCODE_PICTSYMBOLS = 94,
|
||||
KEYCODE_SWITCH_CHARSET = 95,
|
||||
KEYCODE_BUTTON_A = 96,
|
||||
KEYCODE_BUTTON_B = 97,
|
||||
KEYCODE_BUTTON_C = 98,
|
||||
KEYCODE_BUTTON_X = 99,
|
||||
KEYCODE_BUTTON_Y = 100,
|
||||
KEYCODE_BUTTON_Z = 101,
|
||||
KEYCODE_BUTTON_L1 = 102,
|
||||
KEYCODE_BUTTON_R1 = 103,
|
||||
KEYCODE_BUTTON_L2 = 104,
|
||||
KEYCODE_BUTTON_R2 = 105,
|
||||
KEYCODE_BUTTON_THUMBL = 106,
|
||||
KEYCODE_BUTTON_THUMBR = 107,
|
||||
KEYCODE_BUTTON_START = 108,
|
||||
KEYCODE_BUTTON_SELECT = 109,
|
||||
KEYCODE_BUTTON_MODE = 110,
|
||||
KEYCODE_ESCAPE = 111,
|
||||
KEYCODE_FORWARD_DEL = 112,
|
||||
KEYCODE_CTRL_LEFT = 113,
|
||||
KEYCODE_CTRL_RIGHT = 114,
|
||||
KEYCODE_CAPS_LOCK = 115,
|
||||
KEYCODE_SCROLL_LOCK = 116,
|
||||
KEYCODE_META_LEFT = 117,
|
||||
KEYCODE_META_RIGHT = 118,
|
||||
KEYCODE_FUNCTION = 119,
|
||||
KEYCODE_SYSRQ = 120,
|
||||
KEYCODE_BREAK = 121,
|
||||
KEYCODE_MOVE_HOME = 122,
|
||||
KEYCODE_MOVE_END = 123,
|
||||
KEYCODE_INSERT = 124,
|
||||
KEYCODE_FORWARD = 125,
|
||||
KEYCODE_MEDIA_PLAY = 126,
|
||||
KEYCODE_MEDIA_PAUSE = 127,
|
||||
KEYCODE_MEDIA_CLOSE = 128,
|
||||
KEYCODE_MEDIA_EJECT = 129,
|
||||
KEYCODE_MEDIA_RECORD = 130,
|
||||
KEYCODE_F1 = 131,
|
||||
KEYCODE_F2 = 132,
|
||||
KEYCODE_F3 = 133,
|
||||
KEYCODE_F4 = 134,
|
||||
KEYCODE_F5 = 135,
|
||||
KEYCODE_F6 = 136,
|
||||
KEYCODE_F7 = 137,
|
||||
KEYCODE_F8 = 138,
|
||||
KEYCODE_F9 = 139,
|
||||
KEYCODE_F10 = 140,
|
||||
KEYCODE_F11 = 141,
|
||||
KEYCODE_F12 = 142,
|
||||
KEYCODE_NUM_LOCK = 143,
|
||||
KEYCODE_NUMPAD_0 = 144,
|
||||
KEYCODE_NUMPAD_1 = 145,
|
||||
KEYCODE_NUMPAD_2 = 146,
|
||||
KEYCODE_NUMPAD_3 = 147,
|
||||
KEYCODE_NUMPAD_4 = 148,
|
||||
KEYCODE_NUMPAD_5 = 149,
|
||||
KEYCODE_NUMPAD_6 = 150,
|
||||
KEYCODE_NUMPAD_7 = 151,
|
||||
KEYCODE_NUMPAD_8 = 152,
|
||||
KEYCODE_NUMPAD_9 = 153,
|
||||
KEYCODE_NUMPAD_DIVIDE = 154,
|
||||
KEYCODE_NUMPAD_MULTIPLY = 155,
|
||||
KEYCODE_NUMPAD_SUBTRACT = 156,
|
||||
KEYCODE_NUMPAD_ADD = 157,
|
||||
KEYCODE_NUMPAD_DOT = 158,
|
||||
KEYCODE_NUMPAD_COMMA = 159,
|
||||
KEYCODE_NUMPAD_ENTER = 160,
|
||||
KEYCODE_NUMPAD_EQUALS = 161,
|
||||
KEYCODE_NUMPAD_LEFT_PAREN = 162,
|
||||
KEYCODE_NUMPAD_RIGHT_PAREN = 163,
|
||||
KEYCODE_VOLUME_MUTE = 164,
|
||||
KEYCODE_INFO = 165,
|
||||
KEYCODE_CHANNEL_UP = 166,
|
||||
KEYCODE_CHANNEL_DOWN = 167,
|
||||
KEYCODE_ZOOM_IN = 168,
|
||||
KEYCODE_ZOOM_OUT = 169,
|
||||
KEYCODE_TV = 170,
|
||||
KEYCODE_WINDOW = 171,
|
||||
KEYCODE_GUIDE = 172,
|
||||
KEYCODE_DVR = 173,
|
||||
KEYCODE_BOOKMARK = 174,
|
||||
KEYCODE_CAPTIONS = 175,
|
||||
KEYCODE_SETTINGS = 176,
|
||||
KEYCODE_TV_POWER = 177,
|
||||
KEYCODE_TV_INPUT = 178,
|
||||
KEYCODE_STB_POWER = 179,
|
||||
KEYCODE_STB_INPUT = 180,
|
||||
KEYCODE_AVR_POWER = 181,
|
||||
KEYCODE_AVR_INPUT = 182,
|
||||
KEYCODE_PROG_RED = 183,
|
||||
KEYCODE_PROG_GREEN = 184,
|
||||
KEYCODE_PROG_YELLOW = 185,
|
||||
KEYCODE_PROG_BLUE = 186,
|
||||
KEYCODE_APP_SWITCH = 187,
|
||||
KEYCODE_BUTTON_1 = 188,
|
||||
KEYCODE_BUTTON_2 = 189,
|
||||
KEYCODE_BUTTON_3 = 190,
|
||||
KEYCODE_BUTTON_4 = 191,
|
||||
KEYCODE_BUTTON_5 = 192,
|
||||
KEYCODE_BUTTON_6 = 193,
|
||||
KEYCODE_BUTTON_7 = 194,
|
||||
KEYCODE_BUTTON_8 = 195,
|
||||
KEYCODE_BUTTON_9 = 196,
|
||||
KEYCODE_BUTTON_10 = 197,
|
||||
KEYCODE_BUTTON_11 = 198,
|
||||
KEYCODE_BUTTON_12 = 199,
|
||||
KEYCODE_BUTTON_13 = 200,
|
||||
KEYCODE_BUTTON_14 = 201,
|
||||
KEYCODE_BUTTON_15 = 202,
|
||||
KEYCODE_BUTTON_16 = 203,
|
||||
|
||||
KEYCODE_LAST = 255 // Android 2.3 added several new gaming keys, Android 3.1 added even more - plz keep in sync with Keycodes.java
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/android/jniwrapperstuff.h
|
||||
13
project/jni/sdl-1.2/src/video/android/jniwrapperstuff.h
Normal file
13
project/jni/sdl-1.2/src/video/android/jniwrapperstuff.h
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
/* JNI-C++ wrapper stuff */
|
||||
#ifndef _JNI_WRAPPER_STUFF_H_
|
||||
#define _JNI_WRAPPER_STUFF_H_
|
||||
|
||||
#ifndef SDL_JAVA_PACKAGE_PATH
|
||||
#error You have to define SDL_JAVA_PACKAGE_PATH to your package path with dots replaced with underscores, for example "com_example_SanAngeles"
|
||||
#endif
|
||||
#define JAVA_EXPORT_NAME2(name,package) Java_##package##_##name
|
||||
#define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package)
|
||||
#define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH)
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/android/keymap.c
|
||||
242
project/jni/sdl-1.2/src/video/android/keymap.c
Normal file
242
project/jni/sdl-1.2/src/video/android/keymap.c
Normal file
@@ -0,0 +1,242 @@
|
||||
#include "SDL_config.h"
|
||||
|
||||
#include "SDL_version.h"
|
||||
#include "SDL_androidinput.h"
|
||||
#include "SDL_screenkeyboard.h"
|
||||
|
||||
void SDL_android_init_keymap(SDLKey *SDL_android_keymap)
|
||||
{
|
||||
int i;
|
||||
SDLKey * keymap = SDL_android_keymap;
|
||||
|
||||
for (i=0; i<SDL_arraysize(SDL_android_keymap); ++i)
|
||||
SDL_android_keymap[i] = SDL_KEY(UNKNOWN);
|
||||
|
||||
keymap[KEYCODE_UNKNOWN] = SDL_KEY(UNKNOWN);
|
||||
|
||||
keymap[KEYCODE_BACK] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_5));
|
||||
|
||||
keymap[KEYCODE_MENU] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_4));
|
||||
|
||||
keymap[KEYCODE_DPAD_CENTER] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_1));
|
||||
keymap[KEYCODE_SEARCH] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_7));
|
||||
|
||||
keymap[KEYCODE_VOLUME_UP] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_2));
|
||||
keymap[KEYCODE_VOLUME_DOWN] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_3));
|
||||
|
||||
keymap[KEYCODE_HOME] = SDL_KEY(HOME); // Cannot be used in application
|
||||
|
||||
// On some devices pressing Camera key will generate Camera keyevent, but releasing it will generate Focus keyevent.
|
||||
keymap[KEYCODE_CAMERA] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_6));
|
||||
keymap[KEYCODE_FOCUS] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_6));
|
||||
|
||||
keymap[KEYCODE_CALL] = SDL_KEY(TAB);
|
||||
|
||||
keymap[KEYCODE_0] = SDL_KEY(0);
|
||||
keymap[KEYCODE_1] = SDL_KEY(1);
|
||||
keymap[KEYCODE_2] = SDL_KEY(2);
|
||||
keymap[KEYCODE_3] = SDL_KEY(3);
|
||||
keymap[KEYCODE_4] = SDL_KEY(4);
|
||||
keymap[KEYCODE_5] = SDL_KEY(5);
|
||||
keymap[KEYCODE_6] = SDL_KEY(6);
|
||||
keymap[KEYCODE_7] = SDL_KEY(7);
|
||||
keymap[KEYCODE_8] = SDL_KEY(8);
|
||||
keymap[KEYCODE_9] = SDL_KEY(9);
|
||||
keymap[KEYCODE_STAR] = SDL_KEY(KP_DIVIDE);
|
||||
keymap[KEYCODE_POUND] = SDL_KEY(KP_MULTIPLY);
|
||||
|
||||
keymap[KEYCODE_DPAD_UP] = SDL_KEY(UP);
|
||||
keymap[KEYCODE_DPAD_DOWN] = SDL_KEY(DOWN);
|
||||
keymap[KEYCODE_DPAD_LEFT] = SDL_KEY(LEFT);
|
||||
keymap[KEYCODE_DPAD_RIGHT] = SDL_KEY(RIGHT);
|
||||
|
||||
keymap[KEYCODE_SOFT_LEFT] = SDL_KEY(KP_4);
|
||||
keymap[KEYCODE_SOFT_RIGHT] = SDL_KEY(KP_6);
|
||||
keymap[KEYCODE_ENTER] = SDL_KEY(RETURN); //SDL_KEY(KP_ENTER);
|
||||
|
||||
|
||||
keymap[KEYCODE_CLEAR] = SDL_KEY(BACKSPACE);
|
||||
keymap[KEYCODE_A] = SDL_KEY(A);
|
||||
keymap[KEYCODE_B] = SDL_KEY(B);
|
||||
keymap[KEYCODE_C] = SDL_KEY(C);
|
||||
keymap[KEYCODE_D] = SDL_KEY(D);
|
||||
keymap[KEYCODE_E] = SDL_KEY(E);
|
||||
keymap[KEYCODE_F] = SDL_KEY(F);
|
||||
keymap[KEYCODE_G] = SDL_KEY(G);
|
||||
keymap[KEYCODE_H] = SDL_KEY(H);
|
||||
keymap[KEYCODE_I] = SDL_KEY(I);
|
||||
keymap[KEYCODE_J] = SDL_KEY(J);
|
||||
keymap[KEYCODE_K] = SDL_KEY(K);
|
||||
keymap[KEYCODE_L] = SDL_KEY(L);
|
||||
keymap[KEYCODE_M] = SDL_KEY(M);
|
||||
keymap[KEYCODE_N] = SDL_KEY(N);
|
||||
keymap[KEYCODE_O] = SDL_KEY(O);
|
||||
keymap[KEYCODE_P] = SDL_KEY(P);
|
||||
keymap[KEYCODE_Q] = SDL_KEY(Q);
|
||||
keymap[KEYCODE_R] = SDL_KEY(R);
|
||||
keymap[KEYCODE_S] = SDL_KEY(S);
|
||||
keymap[KEYCODE_T] = SDL_KEY(T);
|
||||
keymap[KEYCODE_U] = SDL_KEY(U);
|
||||
keymap[KEYCODE_V] = SDL_KEY(V);
|
||||
keymap[KEYCODE_W] = SDL_KEY(W);
|
||||
keymap[KEYCODE_X] = SDL_KEY(X);
|
||||
keymap[KEYCODE_Y] = SDL_KEY(Y);
|
||||
keymap[KEYCODE_Z] = SDL_KEY(Z);
|
||||
keymap[KEYCODE_COMMA] = SDL_KEY(COMMA);
|
||||
keymap[KEYCODE_PERIOD] = SDL_KEY(PERIOD);
|
||||
keymap[KEYCODE_TAB] = SDL_KEY(TAB);
|
||||
keymap[KEYCODE_SPACE] = SDL_KEY(SPACE);
|
||||
keymap[KEYCODE_DEL] = SDL_KEY(DELETE);
|
||||
keymap[KEYCODE_GRAVE] = SDL_KEY(GRAVE);
|
||||
keymap[KEYCODE_MINUS] = SDL_KEY(KP_MINUS);
|
||||
keymap[KEYCODE_PLUS] = SDL_KEY(KP_PLUS);
|
||||
keymap[KEYCODE_EQUALS] = SDL_KEY(EQUALS);
|
||||
keymap[KEYCODE_LEFT_BRACKET] = SDL_KEY(LEFTBRACKET);
|
||||
keymap[KEYCODE_RIGHT_BRACKET] = SDL_KEY(RIGHTBRACKET);
|
||||
keymap[KEYCODE_BACKSLASH] = SDL_KEY(BACKSLASH);
|
||||
keymap[KEYCODE_SEMICOLON] = SDL_KEY(SEMICOLON);
|
||||
keymap[KEYCODE_APOSTROPHE] = SDL_KEY(APOSTROPHE);
|
||||
keymap[KEYCODE_SLASH] = SDL_KEY(SLASH);
|
||||
keymap[KEYCODE_AT] = SDL_KEY(KP_PERIOD);
|
||||
|
||||
keymap[KEYCODE_MEDIA_PLAY_PAUSE] = SDL_KEY(KP_2);
|
||||
keymap[KEYCODE_MEDIA_STOP] = SDL_KEY(HELP);
|
||||
keymap[KEYCODE_MEDIA_NEXT] = SDL_KEY(KP_8);
|
||||
keymap[KEYCODE_MEDIA_PREVIOUS] = SDL_KEY(KP_5);
|
||||
keymap[KEYCODE_MEDIA_REWIND] = SDL_KEY(KP_1);
|
||||
keymap[KEYCODE_MEDIA_FAST_FORWARD] = SDL_KEY(KP_3);
|
||||
keymap[KEYCODE_MUTE] = SDL_KEY(KP_0);
|
||||
|
||||
keymap[KEYCODE_SYM] = SDL_KEY(LGUI);
|
||||
keymap[KEYCODE_NUM] = SDL_KEY(NUMLOCKCLEAR);
|
||||
|
||||
keymap[KEYCODE_ALT_LEFT] = SDL_KEY(KP_7);
|
||||
keymap[KEYCODE_ALT_RIGHT] = SDL_KEY(KP_9);
|
||||
|
||||
keymap[KEYCODE_SHIFT_LEFT] = SDL_KEY(F1);
|
||||
keymap[KEYCODE_SHIFT_RIGHT] = SDL_KEY(F2);
|
||||
|
||||
keymap[KEYCODE_EXPLORER] = SDL_KEY(F3);
|
||||
keymap[KEYCODE_ENVELOPE] = SDL_KEY(F4);
|
||||
|
||||
keymap[KEYCODE_HEADSETHOOK] = SDL_KEY(F5);
|
||||
keymap[KEYCODE_NOTIFICATION] = SDL_KEY(F6);
|
||||
|
||||
// Cannot be received by application, OS internal
|
||||
keymap[KEYCODE_ENDCALL] = SDL_KEY(LSHIFT);
|
||||
keymap[KEYCODE_POWER] = SDL_KEY(RALT);
|
||||
|
||||
keymap[KEYCODE_PAGE_UP] = SDL_KEY(PAGEUP);
|
||||
keymap[KEYCODE_PAGE_DOWN] = SDL_KEY(PAGEDOWN);
|
||||
keymap[KEYCODE_PICTSYMBOLS] = SDL_KEY(LSHIFT);
|
||||
keymap[KEYCODE_SWITCH_CHARSET] = SDL_KEY(LSHIFT);
|
||||
keymap[KEYCODE_BUTTON_A] = SDL_KEY(A);
|
||||
keymap[KEYCODE_BUTTON_B] = SDL_KEY(B);
|
||||
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));
|
||||
keymap[KEYCODE_BUTTON_Z] = SDL_KEY(Z);
|
||||
keymap[KEYCODE_BUTTON_L1] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_2));
|
||||
keymap[KEYCODE_BUTTON_R1] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_3));
|
||||
keymap[KEYCODE_BUTTON_L2] = SDL_KEY(LCTRL);
|
||||
keymap[KEYCODE_BUTTON_R2] = SDL_KEY(RCTRL);
|
||||
keymap[KEYCODE_BUTTON_THUMBL] = SDL_KEY(LALT);
|
||||
keymap[KEYCODE_BUTTON_THUMBR] = SDL_KEY(RALT);
|
||||
keymap[KEYCODE_BUTTON_START] = SDL_KEY(RETURN);
|
||||
keymap[KEYCODE_BUTTON_SELECT] = SDL_KEY(ESCAPE);
|
||||
keymap[KEYCODE_BUTTON_MODE] = SDL_KEY(SPACE);
|
||||
keymap[KEYCODE_ESCAPE] = SDL_KEY(ESCAPE);
|
||||
keymap[KEYCODE_FORWARD_DEL] = SDL_KEY(DELETE);
|
||||
keymap[KEYCODE_CTRL_LEFT] = SDL_KEY(LEFT);
|
||||
keymap[KEYCODE_CTRL_RIGHT] = SDL_KEY(RIGHT);
|
||||
keymap[KEYCODE_CAPS_LOCK] = SDL_KEY(CAPSLOCK);
|
||||
keymap[KEYCODE_SCROLL_LOCK] = SDL_KEY(SCROLLLOCK);
|
||||
keymap[KEYCODE_META_LEFT] = SDL_KEY(LEFT);
|
||||
keymap[KEYCODE_META_RIGHT] = SDL_KEY(RIGHT);
|
||||
keymap[KEYCODE_FUNCTION] = SDL_KEY(RGUI);
|
||||
keymap[KEYCODE_SYSRQ] = SDL_KEY(SYSREQ);
|
||||
keymap[KEYCODE_BREAK] = SDL_KEY(PAUSE);
|
||||
keymap[KEYCODE_MOVE_HOME] = SDL_KEY(HOME);
|
||||
keymap[KEYCODE_MOVE_END] = SDL_KEY(END);
|
||||
keymap[KEYCODE_INSERT] = SDL_KEY(INSERT);
|
||||
keymap[KEYCODE_FORWARD] = SDL_KEY(RIGHT);
|
||||
keymap[KEYCODE_MEDIA_PLAY] = SDL_KEY(F1);
|
||||
keymap[KEYCODE_MEDIA_PAUSE] = SDL_KEY(F2);
|
||||
keymap[KEYCODE_MEDIA_CLOSE] = SDL_KEY(F3);
|
||||
keymap[KEYCODE_MEDIA_EJECT] = SDL_KEY(F4);
|
||||
keymap[KEYCODE_MEDIA_RECORD] = SDL_KEY(F5);
|
||||
keymap[KEYCODE_F1] = SDL_KEY(F1);
|
||||
keymap[KEYCODE_F2] = SDL_KEY(F2);
|
||||
keymap[KEYCODE_F3] = SDL_KEY(F3);
|
||||
keymap[KEYCODE_F4] = SDL_KEY(F4);
|
||||
keymap[KEYCODE_F5] = SDL_KEY(F5);
|
||||
keymap[KEYCODE_F6] = SDL_KEY(F6);
|
||||
keymap[KEYCODE_F7] = SDL_KEY(F7);
|
||||
keymap[KEYCODE_F8] = SDL_KEY(F8);
|
||||
keymap[KEYCODE_F9] = SDL_KEY(F9);
|
||||
keymap[KEYCODE_F10] = SDL_KEY(F10);
|
||||
keymap[KEYCODE_F11] = SDL_KEY(F11);
|
||||
keymap[KEYCODE_F12] = SDL_KEY(F12);
|
||||
keymap[KEYCODE_NUM_LOCK] = SDL_KEY(NUMLOCKCLEAR);
|
||||
keymap[KEYCODE_NUMPAD_0] = SDL_KEY(KP_0);
|
||||
keymap[KEYCODE_NUMPAD_1] = SDL_KEY(KP_1);
|
||||
keymap[KEYCODE_NUMPAD_2] = SDL_KEY(KP_2);
|
||||
keymap[KEYCODE_NUMPAD_3] = SDL_KEY(KP_3);
|
||||
keymap[KEYCODE_NUMPAD_4] = SDL_KEY(KP_4);
|
||||
keymap[KEYCODE_NUMPAD_5] = SDL_KEY(KP_5);
|
||||
keymap[KEYCODE_NUMPAD_6] = SDL_KEY(KP_6);
|
||||
keymap[KEYCODE_NUMPAD_7] = SDL_KEY(KP_7);
|
||||
keymap[KEYCODE_NUMPAD_8] = SDL_KEY(KP_8);
|
||||
keymap[KEYCODE_NUMPAD_9] = SDL_KEY(KP_9);
|
||||
keymap[KEYCODE_NUMPAD_DIVIDE] = SDL_KEY(KP_DIVIDE);
|
||||
keymap[KEYCODE_NUMPAD_MULTIPLY] = SDL_KEY(KP_MULTIPLY);
|
||||
keymap[KEYCODE_NUMPAD_SUBTRACT] = SDL_KEY(KP_MINUS);
|
||||
keymap[KEYCODE_NUMPAD_ADD] = SDL_KEY(KP_PLUS);
|
||||
keymap[KEYCODE_NUMPAD_DOT] = SDL_KEY(KP_PERIOD);
|
||||
keymap[KEYCODE_NUMPAD_COMMA] = SDL_KEY(KP_PERIOD);
|
||||
keymap[KEYCODE_NUMPAD_ENTER] = SDL_KEY(KP_ENTER);
|
||||
keymap[KEYCODE_NUMPAD_EQUALS] = SDL_KEY(KP_EQUALS);
|
||||
keymap[KEYCODE_NUMPAD_LEFT_PAREN] = SDL_KEY(KP_DIVIDE);
|
||||
keymap[KEYCODE_NUMPAD_RIGHT_PAREN] = SDL_KEY(KP_MULTIPLY);
|
||||
keymap[KEYCODE_VOLUME_MUTE] = SDL_KEY(F13);
|
||||
keymap[KEYCODE_INFO] = SDL_KEY(F14);
|
||||
keymap[KEYCODE_CHANNEL_UP] = SDL_KEY(UP);
|
||||
keymap[KEYCODE_CHANNEL_DOWN] = SDL_KEY(DOWN);
|
||||
keymap[KEYCODE_ZOOM_IN] = SDL_KEY(PAGEUP);
|
||||
keymap[KEYCODE_ZOOM_OUT] = SDL_KEY(PAGEDOWN);
|
||||
keymap[KEYCODE_TV] = SDL_KEY(F15);
|
||||
keymap[KEYCODE_WINDOW] = SDL_KEY(F1);
|
||||
keymap[KEYCODE_GUIDE] = SDL_KEY(F2);
|
||||
keymap[KEYCODE_DVR] = SDL_KEY(F3);
|
||||
keymap[KEYCODE_BOOKMARK] = SDL_KEY(F4);
|
||||
keymap[KEYCODE_CAPTIONS] = SDL_KEY(F5);
|
||||
keymap[KEYCODE_SETTINGS] = SDL_KEY(F6);
|
||||
keymap[KEYCODE_TV_POWER] = SDL_KEY(F7);
|
||||
keymap[KEYCODE_TV_INPUT] = SDL_KEY(F8);
|
||||
keymap[KEYCODE_STB_POWER] = SDL_KEY(F9);
|
||||
keymap[KEYCODE_STB_INPUT] = SDL_KEY(F10);
|
||||
keymap[KEYCODE_AVR_POWER] = SDL_KEY(F11);
|
||||
keymap[KEYCODE_AVR_INPUT] = SDL_KEY(F12);
|
||||
keymap[KEYCODE_PROG_RED] = SDL_KEY(F13);
|
||||
keymap[KEYCODE_PROG_GREEN] = SDL_KEY(F14);
|
||||
keymap[KEYCODE_PROG_YELLOW] = SDL_KEY(F15);
|
||||
keymap[KEYCODE_PROG_BLUE] = SDL_KEY(F1);
|
||||
keymap[KEYCODE_APP_SWITCH] = SDL_KEY(F2);
|
||||
keymap[KEYCODE_BUTTON_1] = SDL_KEY(A);
|
||||
keymap[KEYCODE_BUTTON_2] = SDL_KEY(B);
|
||||
keymap[KEYCODE_BUTTON_3] = SDL_KEY(C);
|
||||
keymap[KEYCODE_BUTTON_4] = SDL_KEY(D);
|
||||
keymap[KEYCODE_BUTTON_5] = SDL_KEY(E);
|
||||
keymap[KEYCODE_BUTTON_6] = SDL_KEY(F);
|
||||
keymap[KEYCODE_BUTTON_7] = SDL_KEY(G);
|
||||
keymap[KEYCODE_BUTTON_8] = SDL_KEY(H);
|
||||
keymap[KEYCODE_BUTTON_9] = SDL_KEY(I);
|
||||
keymap[KEYCODE_BUTTON_10] = SDL_KEY(J);
|
||||
keymap[KEYCODE_BUTTON_11] = SDL_KEY(K);
|
||||
keymap[KEYCODE_BUTTON_12] = SDL_KEY(L);
|
||||
keymap[KEYCODE_BUTTON_13] = SDL_KEY(M);
|
||||
keymap[KEYCODE_BUTTON_14] = SDL_KEY(N);
|
||||
keymap[KEYCODE_BUTTON_15] = SDL_KEY(O);
|
||||
keymap[KEYCODE_BUTTON_16] = SDL_KEY(P);
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
../../../../sdl-1.3/src/video/android/touchscreenfont.h
|
||||
@@ -1,349 +0,0 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
|
||||
This file written by Ryan C. Gordon (icculus@icculus.org)
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
#include "SDL_version.h"
|
||||
|
||||
#include "SDL_rwops.h"
|
||||
#include "SDL_timer.h"
|
||||
#include "SDL_audio.h"
|
||||
#include "../SDL_audiomem.h"
|
||||
#include "../SDL_audio_c.h"
|
||||
#include "../SDL_audiodev_c.h"
|
||||
#include "SDL_androidaudio.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_thread.h"
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include <string.h> // for memset()
|
||||
#include <pthread.h>
|
||||
|
||||
#define _THIS SDL_AudioDevice *this
|
||||
|
||||
/* Audio driver functions */
|
||||
|
||||
static void ANDROIDAUD_WaitAudio(_THIS);
|
||||
static void ANDROIDAUD_PlayAudio(_THIS);
|
||||
static Uint8 *ANDROIDAUD_GetAudioBuf(_THIS);
|
||||
static void ANDROIDAUD_CloseAudio(_THIS);
|
||||
static void ANDROIDAUD_ThreadInit(_THIS);
|
||||
static void ANDROIDAUD_ThreadDeinit(_THIS);
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
|
||||
static int ANDROIDAUD_OpenAudio(_THIS, const char *devname, int iscapture);
|
||||
|
||||
static void ANDROIDAUD_DeleteDevice()
|
||||
{
|
||||
}
|
||||
|
||||
static int ANDROIDAUD_CreateDevice(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
|
||||
/* Set the function pointers */
|
||||
impl->OpenDevice = ANDROIDAUD_OpenAudio;
|
||||
impl->WaitDevice = ANDROIDAUD_WaitAudio;
|
||||
impl->PlayDevice = ANDROIDAUD_PlayAudio;
|
||||
impl->GetDeviceBuf = ANDROIDAUD_GetAudioBuf;
|
||||
impl->CloseDevice = ANDROIDAUD_CloseAudio;
|
||||
impl->ThreadInit = ANDROIDAUD_ThreadInit;
|
||||
impl->WaitDone = ANDROIDAUD_ThreadDeinit;
|
||||
impl->Deinitialize = ANDROIDAUD_DeleteDevice;
|
||||
impl->OnlyHasDefaultOutputDevice = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
AudioBootStrap ANDROIDAUD_bootstrap = {
|
||||
"android", "SDL Android audio driver",
|
||||
ANDROIDAUD_CreateDevice, 0
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
static int ANDROIDAUD_OpenAudio(_THIS, SDL_AudioSpec *spec);
|
||||
|
||||
static int ANDROIDAUD_Available(void)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void ANDROIDAUD_DeleteDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_AudioDevice *ANDROIDAUD_CreateDevice(int devindex)
|
||||
{
|
||||
SDL_AudioDevice *this;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
|
||||
if ( this ) {
|
||||
SDL_memset(this, 0, (sizeof *this));
|
||||
this->hidden = NULL;
|
||||
} else {
|
||||
SDL_OutOfMemory();
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Set the function pointers */
|
||||
this->OpenAudio = ANDROIDAUD_OpenAudio;
|
||||
this->WaitAudio = ANDROIDAUD_WaitAudio;
|
||||
this->PlayAudio = ANDROIDAUD_PlayAudio;
|
||||
this->GetAudioBuf = ANDROIDAUD_GetAudioBuf;
|
||||
this->CloseAudio = ANDROIDAUD_CloseAudio;
|
||||
this->ThreadInit = ANDROIDAUD_ThreadInit;
|
||||
this->WaitDone = ANDROIDAUD_ThreadDeinit;
|
||||
this->free = ANDROIDAUD_DeleteDevice;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
AudioBootStrap ANDROIDAUD_bootstrap = {
|
||||
"android", "SDL Android audio driver",
|
||||
ANDROIDAUD_Available, ANDROIDAUD_CreateDevice
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static unsigned char * audioBuffer = NULL;
|
||||
static size_t audioBufferSize = 0;
|
||||
|
||||
// Extremely wicked JNI environment to call Java functions from C code
|
||||
static jbyteArray audioBufferJNI = NULL;
|
||||
static JavaVM *jniVM = NULL;
|
||||
static jobject JavaAudioThread = NULL;
|
||||
static jmethodID JavaInitAudio = NULL;
|
||||
static jmethodID JavaDeinitAudio = NULL;
|
||||
static jmethodID JavaPauseAudioPlayback = NULL;
|
||||
static jmethodID JavaResumeAudioPlayback = NULL;
|
||||
|
||||
|
||||
static Uint8 *ANDROIDAUD_GetAudioBuf(_THIS)
|
||||
{
|
||||
return(audioBuffer);
|
||||
}
|
||||
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
static int ANDROIDAUD_OpenAudio (_THIS, const char *devname, int iscapture)
|
||||
{
|
||||
SDL_AudioSpec *audioFormat = &this->spec;
|
||||
|
||||
#else
|
||||
static int ANDROIDAUD_OpenAudio (_THIS, SDL_AudioSpec *spec)
|
||||
{
|
||||
SDL_AudioSpec *audioFormat = spec;
|
||||
#endif
|
||||
|
||||
int bytesPerSample;
|
||||
JNIEnv * jniEnv = NULL;
|
||||
|
||||
this->hidden = NULL;
|
||||
|
||||
if( ! (audioFormat->format == AUDIO_S8 || audioFormat->format == AUDIO_S16) )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "Application requested unsupported audio format - only S8 and S16 are supported");
|
||||
return (-1); // TODO: enable format conversion? Don't know how to do that in SDL
|
||||
}
|
||||
|
||||
bytesPerSample = (audioFormat->format & 0xFF) / 8;
|
||||
audioFormat->format = ( bytesPerSample == 2 ) ? AUDIO_S16 : AUDIO_S8;
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_OpenAudio(): app requested audio bytespersample %d freq %d channels %d samples %d", bytesPerSample, audioFormat->freq, (int)audioFormat->channels, (int)audioFormat->samples);
|
||||
|
||||
if(audioFormat->samples <= 0)
|
||||
audioFormat->samples = 128; // Some sane value
|
||||
if( audioFormat->samples > 32768 ) // Why anyone need so huge audio buffer?
|
||||
{
|
||||
audioFormat->samples = 32768;
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_OpenAudio(): limiting samples size to ", (int)audioFormat->samples);
|
||||
}
|
||||
|
||||
SDL_CalculateAudioSpec(audioFormat);
|
||||
|
||||
|
||||
(*jniVM)->AttachCurrentThread(jniVM, &jniEnv, NULL);
|
||||
|
||||
if( !jniEnv )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "ANDROIDAUD_OpenAudio: Java VM AttachCurrentThread() failed");
|
||||
return (-1); // TODO: enable format conversion? Don't know how to do that in SDL
|
||||
}
|
||||
|
||||
// The returned audioBufferSize may be huge, up to 100 Kb for 44100 because user may have selected large audio buffer to get rid of choppy sound
|
||||
audioBufferSize = (*jniEnv)->CallIntMethod( jniEnv, JavaAudioThread, JavaInitAudio,
|
||||
(jint)audioFormat->freq, (jint)audioFormat->channels,
|
||||
(jint)(( bytesPerSample == 2 ) ? 1 : 0), (jint)(audioFormat->size) );
|
||||
|
||||
if( audioBufferSize == 0 )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_OpenAudio(): failed to get audio buffer from JNI");
|
||||
ANDROIDAUD_CloseAudio(this);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* We cannot call DetachCurrentThread() from main thread or we'll crash */
|
||||
/* (*jniVM)->DetachCurrentThread(jniVM); */
|
||||
|
||||
audioFormat->samples = audioBufferSize / bytesPerSample / audioFormat->channels;
|
||||
audioFormat->size = audioBufferSize;
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_OpenAudio(): app opened audio bytespersample %d freq %d channels %d bufsize %d", bytesPerSample, audioFormat->freq, (int)audioFormat->channels, audioBufferSize);
|
||||
|
||||
SDL_CalculateAudioSpec(audioFormat);
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
return(1);
|
||||
#else
|
||||
return(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ANDROIDAUD_CloseAudio(_THIS)
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_CloseAudio()");
|
||||
JNIEnv * jniEnv = NULL;
|
||||
(*jniVM)->AttachCurrentThread(jniVM, &jniEnv, NULL);
|
||||
|
||||
(*jniEnv)->DeleteGlobalRef(jniEnv, audioBufferJNI);
|
||||
audioBufferJNI = NULL;
|
||||
audioBuffer = NULL;
|
||||
audioBufferSize = 0;
|
||||
|
||||
(*jniEnv)->CallIntMethod( jniEnv, JavaAudioThread, JavaDeinitAudio );
|
||||
|
||||
/* We cannot call DetachCurrentThread() from main thread or we'll crash */
|
||||
/* (*jniVM)->DetachCurrentThread(jniVM); */
|
||||
|
||||
}
|
||||
|
||||
/* This function waits until it is possible to write a full sound buffer */
|
||||
static void ANDROIDAUD_WaitAudio(_THIS)
|
||||
{
|
||||
/* We will block in PlayAudio(), do nothing here */
|
||||
}
|
||||
|
||||
static JNIEnv * jniEnvPlaying = NULL;
|
||||
static jmethodID JavaFillBuffer = NULL;
|
||||
|
||||
static void ANDROIDAUD_ThreadInit(_THIS)
|
||||
{
|
||||
jclass JavaAudioThreadClass = NULL;
|
||||
jmethodID JavaInitThread = NULL;
|
||||
jmethodID JavaGetBuffer = NULL;
|
||||
jboolean isCopy = JNI_TRUE;
|
||||
|
||||
(*jniVM)->AttachCurrentThread(jniVM, &jniEnvPlaying, NULL);
|
||||
|
||||
JavaAudioThreadClass = (*jniEnvPlaying)->GetObjectClass(jniEnvPlaying, JavaAudioThread);
|
||||
JavaFillBuffer = (*jniEnvPlaying)->GetMethodID(jniEnvPlaying, JavaAudioThreadClass, "fillBuffer", "()I");
|
||||
|
||||
/* HACK: raise our own thread priority to max to get rid of "W/AudioFlinger: write blocked for 54 msecs" errors */
|
||||
JavaInitThread = (*jniEnvPlaying)->GetMethodID(jniEnvPlaying, JavaAudioThreadClass, "initAudioThread", "()I");
|
||||
(*jniEnvPlaying)->CallIntMethod( jniEnvPlaying, JavaAudioThread, JavaInitThread );
|
||||
|
||||
JavaGetBuffer = (*jniEnvPlaying)->GetMethodID(jniEnvPlaying, JavaAudioThreadClass, "getBuffer", "()[B");
|
||||
audioBufferJNI = (*jniEnvPlaying)->CallObjectMethod( jniEnvPlaying, JavaAudioThread, JavaGetBuffer );
|
||||
audioBufferJNI = (*jniEnvPlaying)->NewGlobalRef(jniEnvPlaying, audioBufferJNI);
|
||||
audioBuffer = (unsigned char *) (*jniEnvPlaying)->GetByteArrayElements(jniEnvPlaying, audioBufferJNI, &isCopy);
|
||||
if( !audioBuffer )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "ANDROIDAUD_ThreadInit() JNI::GetByteArrayElements() failed! we will crash now");
|
||||
return;
|
||||
}
|
||||
if( isCopy == JNI_TRUE )
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "ANDROIDAUD_ThreadInit(): JNI returns a copy of byte array - no audio will be played");
|
||||
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_ThreadInit()");
|
||||
SDL_memset(audioBuffer, this->spec.silence, this->spec.size);
|
||||
};
|
||||
|
||||
static void ANDROIDAUD_ThreadDeinit(_THIS)
|
||||
{
|
||||
(*jniVM)->DetachCurrentThread(jniVM);
|
||||
};
|
||||
|
||||
static void ANDROIDAUD_PlayAudio(_THIS)
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_PlayAudio()");
|
||||
jboolean isCopy = JNI_TRUE;
|
||||
|
||||
(*jniEnvPlaying)->ReleaseByteArrayElements(jniEnvPlaying, audioBufferJNI, (jbyte *)audioBuffer, 0);
|
||||
audioBuffer = NULL;
|
||||
|
||||
(*jniEnvPlaying)->CallIntMethod( jniEnvPlaying, JavaAudioThread, JavaFillBuffer );
|
||||
|
||||
audioBuffer = (unsigned char *) (*jniEnvPlaying)->GetByteArrayElements(jniEnvPlaying, audioBufferJNI, &isCopy);
|
||||
if( !audioBuffer )
|
||||
__android_log_print(ANDROID_LOG_ERROR, "libSDL", "ANDROIDAUD_PlayAudio() JNI::GetByteArrayElements() failed! we will crash now");
|
||||
|
||||
if( isCopy == JNI_TRUE )
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROIDAUD_PlayAudio() JNI returns a copy of byte array - that's slow");
|
||||
}
|
||||
|
||||
int SDL_ANDROID_PauseAudioPlayback(void)
|
||||
{
|
||||
JNIEnv * jniEnv = NULL;
|
||||
(*jniVM)->AttachCurrentThread(jniVM, &jniEnv, NULL);
|
||||
return (*jniEnv)->CallIntMethod( jniEnv, JavaAudioThread, JavaPauseAudioPlayback );
|
||||
};
|
||||
int SDL_ANDROID_ResumeAudioPlayback(void)
|
||||
{
|
||||
JNIEnv * jniEnv = NULL;
|
||||
(*jniVM)->AttachCurrentThread(jniVM, &jniEnv, NULL);
|
||||
return (*jniEnv)->CallIntMethod( jniEnv, JavaAudioThread, JavaResumeAudioPlayback );
|
||||
};
|
||||
|
||||
|
||||
#ifndef SDL_JAVA_PACKAGE_PATH
|
||||
#error You have to define SDL_JAVA_PACKAGE_PATH to your package path with dots replaced with underscores, for example "com_example_SanAngeles"
|
||||
#endif
|
||||
#define JAVA_EXPORT_NAME2(name,package) Java_##package##_##name
|
||||
#define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package)
|
||||
#define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH)
|
||||
|
||||
JNIEXPORT jint JNICALL JAVA_EXPORT_NAME(AudioThread_nativeAudioInitJavaCallbacks) (JNIEnv * jniEnv, jobject thiz)
|
||||
{
|
||||
jclass JavaAudioThreadClass = NULL;
|
||||
JavaAudioThread = (*jniEnv)->NewGlobalRef(jniEnv, thiz);
|
||||
JavaAudioThreadClass = (*jniEnv)->GetObjectClass(jniEnv, JavaAudioThread);
|
||||
JavaInitAudio = (*jniEnv)->GetMethodID(jniEnv, JavaAudioThreadClass, "initAudio", "(IIII)I");
|
||||
JavaDeinitAudio = (*jniEnv)->GetMethodID(jniEnv, JavaAudioThreadClass, "deinitAudio", "()I");
|
||||
JavaPauseAudioPlayback = (*jniEnv)->GetMethodID(jniEnv, JavaAudioThreadClass, "pauseAudioPlayback", "()I");
|
||||
JavaResumeAudioPlayback = (*jniEnv)->GetMethodID(jniEnv, JavaAudioThreadClass, "resumeAudioPlayback", "()I");
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
jniVM = vm;
|
||||
return JNI_VERSION_1_2;
|
||||
};
|
||||
|
||||
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)
|
||||
{
|
||||
/* TODO: free JavaAudioThread */
|
||||
jniVM = vm;
|
||||
};
|
||||
|
||||
1
project/jni/sdl-1.3/src/audio/android/SDL_androidaudio.c
Symbolic link
1
project/jni/sdl-1.3/src/audio/android/SDL_androidaudio.c
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/audio/android/SDL_androidaudio.c
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
#include "SDL_config.h"
|
||||
|
||||
#ifndef _SDL_androidaudio_h
|
||||
#define _SDL_androidaudio_h
|
||||
|
||||
#include "../SDL_sysaudio.h"
|
||||
|
||||
struct SDL_PrivateAudioData {
|
||||
};
|
||||
|
||||
#endif /* _SDL_androidaudio_h */
|
||||
1
project/jni/sdl-1.3/src/audio/android/SDL_androidaudio.h
Symbolic link
1
project/jni/sdl-1.3/src/audio/android/SDL_androidaudio.h
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/audio/android/SDL_androidaudio.h
|
||||
File diff suppressed because it is too large
Load Diff
1
project/jni/sdl-1.3/src/video/android/SDL_androidinput.c
Symbolic link
1
project/jni/sdl-1.3/src/video/android/SDL_androidinput.c
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/video/android/SDL_androidinput.c
|
||||
@@ -1,206 +0,0 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
#ifndef _SDL_ANDROIDINPUT_H_
|
||||
#define _SDL_ANDROIDINPUT_H_
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
||||
#include "SDL_version.h"
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_mouse.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../SDL_pixels_c.h"
|
||||
#include "SDL_events.h"
|
||||
#if (SDL_VERSION_ATLEAST(1,3,0))
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
#include "../../events/SDL_mouse_c.h"
|
||||
#include "SDL_keycode.h"
|
||||
#include "SDL_scancode.h"
|
||||
//#include "SDL_compat.h"
|
||||
#else
|
||||
#include "SDL_keysym.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#endif
|
||||
#include "SDL_joystick.h"
|
||||
#include "../../joystick/SDL_sysjoystick.h"
|
||||
#include "../../joystick/SDL_joystick_c.h"
|
||||
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "SDL_androidvideo.h"
|
||||
#include "javakeycodes.h"
|
||||
|
||||
/* JNI-C++ wrapper stuff */
|
||||
|
||||
// Special key to signal that key should be handled by Java internally, such as Volume Up/Down keys
|
||||
#define SDLK_NO_REMAP 512
|
||||
#define SDL_SCANCODE_NO_REMAP SDLK_NO_REMAP
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
|
||||
#define SDL_KEY2(X) SDL_SCANCODE_ ## X
|
||||
#define SDL_KEY(X) SDL_KEY2(X)
|
||||
typedef SDL_Scancode SDL_scancode;
|
||||
typedef SDL_Keycode SDLKey;
|
||||
typedef SDL_Keysym SDL_keysym;
|
||||
|
||||
#else
|
||||
|
||||
#define SDL_KEY2(X) SDLK_ ## X
|
||||
#define SDL_KEY(X) SDL_KEY2(X)
|
||||
|
||||
// Randomly redefining SDL 1.3 scancodes to SDL 1.2 keycodes
|
||||
#define KP_0 KP0
|
||||
#define KP_1 KP1
|
||||
#define KP_2 KP2
|
||||
#define KP_3 KP3
|
||||
#define KP_4 KP4
|
||||
#define KP_5 KP5
|
||||
#define KP_6 KP6
|
||||
#define KP_7 KP7
|
||||
#define KP_8 KP8
|
||||
#define KP_9 KP9
|
||||
#define NUMLOCKCLEAR NUMLOCK
|
||||
#define GRAVE DOLLAR
|
||||
#define APOSTROPHE QUOTE
|
||||
#define LGUI LMETA
|
||||
#define RGUI RMETA
|
||||
#define SCROLLLOCK SCROLLOCK
|
||||
// Overkill haha
|
||||
#define A a
|
||||
#define B b
|
||||
#define C c
|
||||
#define D d
|
||||
#define E e
|
||||
#define F f
|
||||
#define G g
|
||||
#define H h
|
||||
#define I i
|
||||
#define J j
|
||||
#define K k
|
||||
#define L l
|
||||
#define M m
|
||||
#define N n
|
||||
#define O o
|
||||
#define P p
|
||||
#define Q q
|
||||
#define R r
|
||||
#define S s
|
||||
#define T t
|
||||
#define U u
|
||||
#define V v
|
||||
#define W w
|
||||
#define X x
|
||||
#define Y y
|
||||
#define Z z
|
||||
|
||||
typedef SDLKey SDL_scancode;
|
||||
#define SDL_GetKeyboardState SDL_GetKeyState
|
||||
|
||||
#endif
|
||||
|
||||
#define SDL_KEY_VAL(X) X
|
||||
|
||||
enum MOUSE_ACTION { MOUSE_DOWN = 0, MOUSE_UP = 1, MOUSE_MOVE = 2, MOUSE_HOVER = 3 };
|
||||
|
||||
extern int SDL_ANDROID_processTouchscreenKeyboard(int x, int y, int action, int pointerId);
|
||||
extern int SDL_ANDROID_isTouchscreenKeyboardUsed;
|
||||
|
||||
#ifndef SDL_ANDROID_KEYCODE_0
|
||||
#define SDL_ANDROID_KEYCODE_0 RETURN
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_1
|
||||
#define SDL_ANDROID_KEYCODE_1 END
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_2
|
||||
#define SDL_ANDROID_KEYCODE_2 NO_REMAP
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_3
|
||||
#define SDL_ANDROID_KEYCODE_3 NO_REMAP
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_4
|
||||
#define SDL_ANDROID_KEYCODE_4 LCTRL
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_5
|
||||
#define SDL_ANDROID_KEYCODE_5 ESCAPE
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_6
|
||||
#define SDL_ANDROID_KEYCODE_6 RSHIFT
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_7
|
||||
#define SDL_ANDROID_KEYCODE_7 SDL_ANDROID_KEYCODE_1
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_8
|
||||
#define SDL_ANDROID_KEYCODE_8 LALT
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_KEYCODE_9
|
||||
#define SDL_ANDROID_KEYCODE_9 RALT
|
||||
#endif
|
||||
|
||||
// Touchscreen keyboard keys + zoom and rotate keycodes
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_0
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_0 SDL_ANDROID_KEYCODE_0
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_1
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_1 SDL_ANDROID_KEYCODE_1
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_2
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_2 PAGEUP
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_3
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_3 PAGEDOWN
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_4
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_4 SDL_ANDROID_KEYCODE_6
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_5
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_5 SDL_ANDROID_KEYCODE_7
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_6
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_6 SDL_ANDROID_KEYCODE_4
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_7
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_7 SDL_ANDROID_KEYCODE_5
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_8
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_8 SDL_ANDROID_KEYCODE_8
|
||||
#endif
|
||||
#ifndef SDL_ANDROID_SCREENKB_KEYCODE_9
|
||||
#define SDL_ANDROID_SCREENKB_KEYCODE_9 SDL_ANDROID_KEYCODE_9
|
||||
#endif
|
||||
|
||||
// Queue events to main thread
|
||||
extern void SDL_ANDROID_MainThreadPushMouseMotion(int x, int y);
|
||||
extern void SDL_ANDROID_MainThreadPushMouseButton(int pressed, int button);
|
||||
extern void SDL_ANDROID_MainThreadPushKeyboardKey(int pressed, SDL_scancode key);
|
||||
extern void SDL_ANDROID_MainThreadPushMultitouchButton(int id, int pressed, int x, int y, int force); // SDL 1.3 only
|
||||
extern void SDL_ANDROID_MainThreadPushMultitouchMotion(int id, int x, int y, int force); // SDL 1.3 only
|
||||
extern void SDL_ANDROID_MainThreadPushJoystickAxis(int joy, int axis, int value);
|
||||
extern void SDL_ANDROID_MainThreadPushJoystickButton(int joy, int button, int pressed);
|
||||
extern void SDL_ANDROID_MainThreadPushJoystickBall(int joy, int ball, int x, int y);
|
||||
extern void SDL_ANDROID_MainThreadPushText( int ascii, int unicode );
|
||||
extern void SDL_android_init_keymap(SDLKey *SDL_android_keymap);
|
||||
extern void SDL_ANDROID_MainThreadPushMouseWheel( int x, int y ); // SDL 1.3 only
|
||||
extern void SDL_ANDROID_MainThreadPushAppActive(int active);
|
||||
#endif
|
||||
1
project/jni/sdl-1.3/src/video/android/SDL_androidinput.h
Symbolic link
1
project/jni/sdl-1.3/src/video/android/SDL_androidinput.h
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/video/android/SDL_androidinput.h
|
||||
@@ -1,402 +0,0 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <string.h> // for memset()
|
||||
|
||||
#include "SDL_config.h"
|
||||
#include "SDL_version.h"
|
||||
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_mouse.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "SDL_android.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../SDL_pixels_c.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "SDL_androidvideo.h"
|
||||
#include "jniwrapperstuff.h"
|
||||
|
||||
|
||||
// The device screen dimensions to draw on
|
||||
int SDL_ANDROID_sWindowWidth = 0;
|
||||
int SDL_ANDROID_sWindowHeight = 0;
|
||||
|
||||
int SDL_ANDROID_sRealWindowWidth = 0;
|
||||
int SDL_ANDROID_sRealWindowHeight = 0;
|
||||
|
||||
SDL_Rect SDL_ANDROID_ForceClearScreenRect = { 0, 0, 0, 0 };
|
||||
|
||||
// Extremely wicked JNI environment to call Java functions from C code
|
||||
static JNIEnv* JavaEnv = NULL;
|
||||
static jclass JavaRendererClass = NULL;
|
||||
static jobject JavaRenderer = NULL;
|
||||
static jmethodID JavaSwapBuffers = NULL;
|
||||
static jmethodID JavaShowScreenKeyboard = NULL;
|
||||
static jmethodID JavaToggleScreenKeyboardWithoutTextInput = NULL;
|
||||
static jmethodID JavaGetAdvertisementParams = NULL;
|
||||
static jmethodID JavaSetAdvertisementVisible = NULL;
|
||||
static jmethodID JavaSetAdvertisementPosition = NULL;
|
||||
static jmethodID JavaRequestNewAdvertisement = NULL;
|
||||
static int glContextLost = 0;
|
||||
static int showScreenKeyboardDeferred = 0;
|
||||
static const char * showScreenKeyboardOldText = "";
|
||||
static int showScreenKeyboardSendBackspace = 0;
|
||||
int SDL_ANDROID_VideoLinearFilter = 0;
|
||||
int SDL_ANDROID_VideoMultithreaded = 0;
|
||||
int SDL_ANDROID_VideoForceSoftwareMode = 0;
|
||||
int SDL_ANDROID_CompatibilityHacks = 0;
|
||||
int SDL_ANDROID_BYTESPERPIXEL = 2;
|
||||
int SDL_ANDROID_BITSPERPIXEL = 16;
|
||||
int SDL_ANDROID_UseGles2 = 0;
|
||||
int SDL_ANDROID_ShowMouseCursor = 0;
|
||||
|
||||
static void appPutToBackgroundCallbackDefault(void)
|
||||
{
|
||||
SDL_ANDROID_PauseAudioPlayback();
|
||||
}
|
||||
static void appRestoredCallbackDefault(void)
|
||||
{
|
||||
SDL_ANDROID_ResumeAudioPlayback();
|
||||
}
|
||||
|
||||
static SDL_ANDROID_ApplicationPutToBackgroundCallback_t appPutToBackgroundCallback = appPutToBackgroundCallbackDefault;
|
||||
static SDL_ANDROID_ApplicationPutToBackgroundCallback_t appRestoredCallback = appRestoredCallbackDefault;
|
||||
static SDL_ANDROID_ApplicationPutToBackgroundCallback_t openALPutToBackgroundCallback = NULL;
|
||||
static SDL_ANDROID_ApplicationPutToBackgroundCallback_t openALRestoredCallback = NULL;
|
||||
|
||||
int SDL_ANDROID_CallJavaSwapBuffers()
|
||||
{
|
||||
if( !glContextLost )
|
||||
{
|
||||
SDL_ANDROID_drawTouchscreenKeyboard();
|
||||
}
|
||||
|
||||
// Clear part of screen not used by SDL - on Android the screen contains garbage after each frame
|
||||
if( SDL_ANDROID_ForceClearScreenRect.w != 0 && SDL_ANDROID_ForceClearScreenRect.h != 0 )
|
||||
{
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrthox( 0, (SDL_ANDROID_sRealWindowWidth) * 0x10000, SDL_ANDROID_sRealWindowHeight * 0x10000, 0, 0, 1 * 0x10000 );
|
||||
glColor4x(0, 0, 0, 0x10000);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
GLshort vertices[] = { SDL_ANDROID_ForceClearScreenRect.x, SDL_ANDROID_ForceClearScreenRect.y,
|
||||
SDL_ANDROID_ForceClearScreenRect.x + SDL_ANDROID_ForceClearScreenRect.w, SDL_ANDROID_ForceClearScreenRect.y,
|
||||
SDL_ANDROID_ForceClearScreenRect.x + SDL_ANDROID_ForceClearScreenRect.w, SDL_ANDROID_ForceClearScreenRect.y + SDL_ANDROID_ForceClearScreenRect.h,
|
||||
SDL_ANDROID_ForceClearScreenRect.x, SDL_ANDROID_ForceClearScreenRect.y + SDL_ANDROID_ForceClearScreenRect.h };
|
||||
glVertexPointer(2, GL_SHORT, 0, vertices);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
if( ! (*JavaEnv)->CallIntMethod( JavaEnv, JavaRenderer, JavaSwapBuffers ) )
|
||||
return 0;
|
||||
if( glContextLost )
|
||||
{
|
||||
glContextLost = 0;
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "OpenGL context recreated, refreshing textures");
|
||||
SDL_ANDROID_VideoContextRecreated();
|
||||
appRestoredCallback();
|
||||
if(openALRestoredCallback)
|
||||
openALRestoredCallback();
|
||||
}
|
||||
if( showScreenKeyboardDeferred )
|
||||
{
|
||||
showScreenKeyboardDeferred = 0;
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaShowScreenKeyboard, (*JavaEnv)->NewStringUTF(JavaEnv, showScreenKeyboardOldText), showScreenKeyboardSendBackspace );
|
||||
}
|
||||
SDL_ANDROID_ProcessDeferredEvents();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeResize) ( JNIEnv* env, jobject thiz, jint w, jint h, jint keepRatio )
|
||||
{
|
||||
if( SDL_ANDROID_sWindowWidth == 0 )
|
||||
{
|
||||
SDL_ANDROID_sRealWindowWidth = w;
|
||||
SDL_ANDROID_sRealWindowHeight = h;
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
// Not supported in SDL 1.3
|
||||
#else
|
||||
if( keepRatio )
|
||||
{
|
||||
// TODO: tweak that parameters when app calls SetVideoMode(), not here - app may request something else than 640x480, it's okay for most apps though
|
||||
SDL_ANDROID_sWindowWidth = (SDL_ANDROID_sFakeWindowWidth*h)/SDL_ANDROID_sFakeWindowHeight;
|
||||
SDL_ANDROID_sWindowHeight = h;
|
||||
SDL_ANDROID_ForceClearScreenRect.x = SDL_ANDROID_sWindowWidth;
|
||||
SDL_ANDROID_ForceClearScreenRect.y = 0;
|
||||
SDL_ANDROID_ForceClearScreenRect.w = w - SDL_ANDROID_sWindowWidth;
|
||||
SDL_ANDROID_ForceClearScreenRect.h = h;
|
||||
|
||||
if(SDL_ANDROID_sWindowWidth >= w)
|
||||
{
|
||||
SDL_ANDROID_sWindowWidth = w;
|
||||
SDL_ANDROID_sWindowHeight = (SDL_ANDROID_sFakeWindowHeight*w)/SDL_ANDROID_sFakeWindowWidth;
|
||||
SDL_ANDROID_ForceClearScreenRect.x = 0;
|
||||
SDL_ANDROID_ForceClearScreenRect.y = SDL_ANDROID_sWindowHeight;
|
||||
SDL_ANDROID_ForceClearScreenRect.w = w;
|
||||
SDL_ANDROID_ForceClearScreenRect.h = SDL_ANDROID_sWindowHeight - h; // OpenGL vertical coord is inverted
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SDL_ANDROID_ForceClearScreenRect.w = 0;
|
||||
SDL_ANDROID_ForceClearScreenRect.h = 0;
|
||||
SDL_ANDROID_ForceClearScreenRect.x = 0;
|
||||
SDL_ANDROID_ForceClearScreenRect.y = 0;
|
||||
SDL_ANDROID_sWindowWidth = w;
|
||||
SDL_ANDROID_sWindowHeight = h;
|
||||
}
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Physical screen resolution is %dx%d, virtual screen %dx%d", w, h, SDL_ANDROID_sWindowWidth, SDL_ANDROID_sWindowHeight );
|
||||
SDL_ANDROID_TouchscreenCalibrationWidth = SDL_ANDROID_sWindowWidth;
|
||||
SDL_ANDROID_TouchscreenCalibrationHeight = SDL_ANDROID_sWindowHeight;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeDone) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "quitting...");
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
SDL_SendQuit();
|
||||
#else
|
||||
SDL_PrivateQuit();
|
||||
#endif
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "quit OK");
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeGlContextLost) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "OpenGL context lost, waiting for new OpenGL context");
|
||||
glContextLost = 1;
|
||||
appPutToBackgroundCallback();
|
||||
if(openALPutToBackgroundCallback)
|
||||
openALPutToBackgroundCallback();
|
||||
|
||||
SDL_ANDROID_VideoContextLost();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeGlContextLostAsyncEvent) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "OpenGL context lost - sending SDL_ACTIVEEVENT");
|
||||
SDL_ANDROID_MainThreadPushAppActive(0);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeGlContextRecreated) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "OpenGL context recreated, sending SDL_ACTIVEEVENT");
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
//if( ANDROID_CurrentWindow )
|
||||
// SDL_SendWindowEvent(ANDROID_CurrentWindow, SDL_WINDOWEVENT_RESTORED, 0, 0);
|
||||
#else
|
||||
SDL_PrivateAppActive(1, SDL_APPACTIVE|SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS);
|
||||
#endif
|
||||
}
|
||||
|
||||
int SDL_ANDROID_ToggleScreenKeyboardWithoutTextInput(void)
|
||||
{
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaToggleScreenKeyboardWithoutTextInput );
|
||||
return 1;
|
||||
}
|
||||
|
||||
volatile static textInputFinished = 0;
|
||||
void SDL_ANDROID_TextInputFinished()
|
||||
{
|
||||
textInputFinished = 1;
|
||||
};
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#else
|
||||
extern int SDL_Flip(SDL_Surface *screen);
|
||||
extern SDL_Surface *SDL_GetVideoSurface(void);
|
||||
#endif
|
||||
|
||||
void SDL_ANDROID_CallJavaShowScreenKeyboard(const char * oldText, char * outBuf, int outBufLen)
|
||||
{
|
||||
if( !outBuf )
|
||||
{
|
||||
showScreenKeyboardDeferred = 1;
|
||||
showScreenKeyboardOldText = oldText;
|
||||
showScreenKeyboardSendBackspace = 1;
|
||||
// Move mouse by 1 pixel to force screen update
|
||||
int x, y;
|
||||
SDL_GetMouseState( &x, &y );
|
||||
SDL_ANDROID_MainThreadPushMouseMotion(x > 0 ? x-1 : 0, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
textInputFinished = 0;
|
||||
SDL_ANDROID_TextInputInit(outBuf, outBufLen);
|
||||
|
||||
if( SDL_ANDROID_VideoMultithreaded )
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#else
|
||||
// Dirty hack: we may call (*JavaEnv)->CallVoidMethod(...) only from video thread
|
||||
showScreenKeyboardDeferred = 1;
|
||||
showScreenKeyboardOldText = oldText;
|
||||
showScreenKeyboardSendBackspace = 0;
|
||||
SDL_Flip(SDL_GetVideoSurface());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaShowScreenKeyboard, (*JavaEnv)->NewStringUTF(JavaEnv, oldText), 0 );
|
||||
|
||||
while( !textInputFinished )
|
||||
SDL_Delay(100);
|
||||
textInputFinished = 0;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeInitJavaCallbacks) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
JavaEnv = env;
|
||||
JavaRenderer = (*JavaEnv)->NewGlobalRef( JavaEnv, thiz );
|
||||
|
||||
JavaRendererClass = (*JavaEnv)->GetObjectClass(JavaEnv, thiz);
|
||||
JavaSwapBuffers = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "swapBuffers", "()I");
|
||||
JavaShowScreenKeyboard = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "showScreenKeyboard", "(Ljava/lang/String;I)V");
|
||||
JavaToggleScreenKeyboardWithoutTextInput = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "showScreenKeyboardWithoutTextInputField", "()V");
|
||||
// TODO: implement it
|
||||
JavaGetAdvertisementParams = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "getAdvertisementParams", "([I)V");
|
||||
JavaSetAdvertisementVisible = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "setAdvertisementVisible", "(I)V");
|
||||
JavaSetAdvertisementPosition = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "setAdvertisementPosition", "(II)V");
|
||||
JavaRequestNewAdvertisement = (*JavaEnv)->GetMethodID(JavaEnv, JavaRendererClass, "requestNewAdvertisement", "()V");
|
||||
|
||||
ANDROID_InitOSKeymap();
|
||||
}
|
||||
|
||||
int SDL_ANDROID_SetApplicationPutToBackgroundCallback(
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t appPutToBackground,
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t appRestored )
|
||||
{
|
||||
appPutToBackgroundCallback = appPutToBackgroundCallbackDefault;
|
||||
appRestoredCallback = appRestoredCallbackDefault;
|
||||
|
||||
if( appPutToBackground )
|
||||
appPutToBackgroundCallback = appPutToBackground;
|
||||
|
||||
if( appRestoredCallback )
|
||||
appRestoredCallback = appRestored;
|
||||
}
|
||||
|
||||
extern int SDL_ANDROID_SetOpenALPutToBackgroundCallback(
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t PutToBackground,
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t Restored );
|
||||
|
||||
int SDL_ANDROID_SetOpenALPutToBackgroundCallback(
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t PutToBackground,
|
||||
SDL_ANDROID_ApplicationPutToBackgroundCallback_t Restored )
|
||||
{
|
||||
openALPutToBackgroundCallback = PutToBackground;
|
||||
openALRestoredCallback = Restored;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetVideoLinearFilter) (JNIEnv* env, jobject thiz)
|
||||
{
|
||||
SDL_ANDROID_VideoLinearFilter = 1;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetVideoMultithreaded) (JNIEnv* env, jobject thiz)
|
||||
{
|
||||
SDL_ANDROID_VideoMultithreaded = 1;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetVideoForceSoftwareMode) (JNIEnv* env, jobject thiz)
|
||||
{
|
||||
SDL_ANDROID_VideoForceSoftwareMode = 1;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetCompatibilityHacks) (JNIEnv* env, jobject thiz)
|
||||
{
|
||||
SDL_ANDROID_CompatibilityHacks = 1;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetVideoDepth) (JNIEnv* env, jobject thiz, jint bpp, jint UseGles2)
|
||||
{
|
||||
SDL_ANDROID_BITSPERPIXEL = bpp;
|
||||
SDL_ANDROID_BYTESPERPIXEL = SDL_ANDROID_BITSPERPIXEL / 8;
|
||||
SDL_ANDROID_UseGles2 = UseGles2;
|
||||
}
|
||||
|
||||
int SDLCALL SDL_ANDROID_GetAdvertisementParams(int * visible, SDL_Rect * position)
|
||||
{
|
||||
jint arr[5];
|
||||
jintArray elemArr = (*JavaEnv)->NewIntArray(JavaEnv, 5);
|
||||
if (elemArr == NULL)
|
||||
return 0;
|
||||
(*JavaEnv)->SetIntArrayRegion(JavaEnv, elemArr, 0, 5, arr);
|
||||
(*JavaEnv)->CallVoidMethod(JavaEnv, JavaRenderer, JavaGetAdvertisementParams, elemArr);
|
||||
(*JavaEnv)->GetIntArrayRegion(JavaEnv, elemArr, 0, 5, arr);
|
||||
(*JavaEnv)->DeleteLocalRef(JavaEnv, elemArr);
|
||||
if(visible)
|
||||
*visible = arr[0];
|
||||
if(position)
|
||||
{
|
||||
position->x = arr[1];
|
||||
position->y = arr[2];
|
||||
position->w = arr[3];
|
||||
position->h = arr[4];
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
int SDLCALL SDL_ANDROID_SetAdvertisementVisible(int visible)
|
||||
{
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaSetAdvertisementVisible, (jint)visible );
|
||||
return 1;
|
||||
}
|
||||
int SDLCALL SDL_ANDROID_SetAdvertisementPosition(int left, int top)
|
||||
{
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaSetAdvertisementPosition, (jint)left, (jint)top );
|
||||
return 1;
|
||||
}
|
||||
int SDLCALL SDL_ANDROID_RequestNewAdvertisement(void)
|
||||
{
|
||||
(*JavaEnv)->CallVoidMethod( JavaEnv, JavaRenderer, JavaRequestNewAdvertisement );
|
||||
return 1;
|
||||
}
|
||||
1
project/jni/sdl-1.3/src/video/android/SDL_androidvideo.c
Symbolic link
1
project/jni/sdl-1.3/src/video/android/SDL_androidvideo.c
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/video/android/SDL_androidvideo.c
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
SDL - Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2009 Sam Lantinga
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Sam Lantinga
|
||||
slouken@libsdl.org
|
||||
*/
|
||||
#ifndef _SDL_androidvideo_h
|
||||
#define _SDL_androidvideo_h
|
||||
|
||||
#include "SDL_version.h"
|
||||
#include "SDL_config.h"
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_events.h"
|
||||
|
||||
enum ScreenZoom { ZOOM_NONE = 0, ZOOM_MAGNIFIER = 1, ZOOM_SCREEN_TRANSFORM = 2, ZOOM_FULLSCREEN_MAGNIFIER = 3 };
|
||||
|
||||
extern int SDL_ANDROID_sWindowWidth;
|
||||
extern int SDL_ANDROID_sWindowHeight;
|
||||
extern int SDL_ANDROID_sRealWindowWidth;
|
||||
extern int SDL_ANDROID_sRealWindowHeight;
|
||||
extern int SDL_ANDROID_sFakeWindowWidth; // SDL 1.2 only
|
||||
extern int SDL_ANDROID_sFakeWindowHeight; // SDL 1.2 only
|
||||
extern int SDL_ANDROID_TouchscreenCalibrationWidth;
|
||||
extern int SDL_ANDROID_TouchscreenCalibrationHeight;
|
||||
extern int SDL_ANDROID_TouchscreenCalibrationX;
|
||||
extern int SDL_ANDROID_TouchscreenCalibrationY;
|
||||
extern int SDL_ANDROID_VideoLinearFilter;
|
||||
extern int SDL_ANDROID_VideoMultithreaded;
|
||||
extern int SDL_ANDROID_VideoForceSoftwareMode;
|
||||
extern int SDL_ANDROID_CompatibilityHacks;
|
||||
extern int SDL_ANDROID_ShowMouseCursor;
|
||||
extern int SDL_ANDROID_UseGles2;
|
||||
extern int SDL_ANDROID_BYTESPERPIXEL;
|
||||
extern int SDL_ANDROID_BITSPERPIXEL;
|
||||
extern void SDL_ANDROID_TextInputInit(char * buffer, int len);
|
||||
extern void SDL_ANDROID_TextInputFinished();
|
||||
extern SDL_Surface *SDL_CurrentVideoSurface;
|
||||
extern SDL_Rect SDL_ANDROID_ForceClearScreenRect;
|
||||
extern int SDL_ANDROID_ShowScreenUnderFinger;
|
||||
extern SDL_Rect SDL_ANDROID_ShowScreenUnderFingerRect, SDL_ANDROID_ShowScreenUnderFingerRectSrc;
|
||||
extern int SDL_ANDROID_CallJavaSwapBuffers();
|
||||
extern void SDL_ANDROID_CallJavaShowScreenKeyboard(const char * oldText, char * outBuf, int outBufLen);
|
||||
extern int SDL_ANDROID_drawTouchscreenKeyboard();
|
||||
extern void SDL_ANDROID_VideoContextLost();
|
||||
extern void SDL_ANDROID_VideoContextRecreated();
|
||||
extern void SDL_ANDROID_processAndroidTrackballDampening();
|
||||
extern void SDL_ANDROID_processMoveMouseWithKeyboard();
|
||||
extern int SDL_ANDROID_InsideVideoThread();
|
||||
extern void SDL_ANDROID_initFakeStdout();
|
||||
extern SDL_VideoDevice *ANDROID_CreateDevice_1_3(int devindex);
|
||||
extern void SDL_ANDROID_ProcessDeferredEvents();
|
||||
extern void SDL_ANDROID_WarpMouse(int x, int y);
|
||||
extern void SDL_ANDROID_DrawMouseCursor(int x, int y, int size, int alpha);
|
||||
extern void SDL_ANDROID_DrawMouseCursorIfNeeded();
|
||||
extern void SDL_ANDROID_CallJavaTogglePlainAndroidSoftKeyboardInput();
|
||||
|
||||
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
extern SDL_Window * ANDROID_CurrentWindow;
|
||||
#endif
|
||||
|
||||
// Exports from SDL_androidinput.c - SDL_androidinput.h is too encumbered
|
||||
enum { MAX_MULTITOUCH_POINTERS = 16 };
|
||||
extern void ANDROID_InitOSKeymap();
|
||||
extern int SDL_ANDROID_isJoystickUsed;
|
||||
// Events have to be sent only from main thread from PumpEvents(), so we'll buffer them here
|
||||
extern void SDL_ANDROID_PumpEvents();
|
||||
|
||||
|
||||
#endif /* _SDL_androidvideo_h */
|
||||
1
project/jni/sdl-1.3/src/video/android/SDL_androidvideo.h
Symbolic link
1
project/jni/sdl-1.3/src/video/android/SDL_androidvideo.h
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/video/android/SDL_androidvideo.h
|
||||
File diff suppressed because it is too large
Load Diff
1
project/jni/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c
Symbolic link
1
project/jni/sdl-1.3/src/video/android/SDL_touchscreenkeyboard.c
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c
|
||||
@@ -1,33 +0,0 @@
|
||||
#ifndef __ATAN2I_H__
|
||||
#define __ATAN2I_H__
|
||||
#include <math.h>
|
||||
|
||||
// Fast arctan2, returns angle in radians as integer, with fractional part in lower 16 bits
|
||||
// Stolen from http://www.dspguru.com/dsp/tricks/fixed-point-atan2-with-self-normalization , precision is said to be 0.07 rads
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
enum { atan2i_coeff_1 = ((int)(M_PI*65536.0/4)), atan2i_coeff_2 = (3*atan2i_coeff_1), atan2i_PI = (int)(M_PI * 65536.0) };
|
||||
|
||||
static inline int atan2i(int y, int x)
|
||||
{
|
||||
int angle;
|
||||
int abs_y = abs(y);
|
||||
if( abs_y == 0 )
|
||||
abs_y = 1;
|
||||
if (x>=0)
|
||||
{
|
||||
angle = atan2i_coeff_1 - atan2i_coeff_1 * (x - abs_y) / (x + abs_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
angle = atan2i_coeff_2 - atan2i_coeff_1 * (x + abs_y) / (abs_y - x);
|
||||
}
|
||||
if (y < 0)
|
||||
return(-angle); // negate if in quad III or IV
|
||||
else
|
||||
return(angle);
|
||||
};
|
||||
|
||||
#endif
|
||||
1
project/jni/sdl-1.3/src/video/android/atan2i.h
Symbolic link
1
project/jni/sdl-1.3/src/video/android/atan2i.h
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/video/android/atan2i.h
|
||||
@@ -1,215 +0,0 @@
|
||||
#ifndef _JAVA_KEY_CODES_H_
|
||||
#define _JAVA_KEY_CODES_H_
|
||||
|
||||
// Keycodes ripped from Java SDK
|
||||
enum KEYCODES_ANDROID
|
||||
{
|
||||
KEYCODE_UNKNOWN = 0,
|
||||
KEYCODE_SOFT_LEFT = 1,
|
||||
KEYCODE_SOFT_RIGHT = 2,
|
||||
KEYCODE_HOME = 3,
|
||||
KEYCODE_BACK = 4,
|
||||
KEYCODE_CALL = 5,
|
||||
KEYCODE_ENDCALL = 6,
|
||||
KEYCODE_0 = 7,
|
||||
KEYCODE_1 = 8,
|
||||
KEYCODE_2 = 9,
|
||||
KEYCODE_3 = 10,
|
||||
KEYCODE_4 = 11,
|
||||
KEYCODE_5 = 12,
|
||||
KEYCODE_6 = 13,
|
||||
KEYCODE_7 = 14,
|
||||
KEYCODE_8 = 15,
|
||||
KEYCODE_9 = 16,
|
||||
KEYCODE_STAR = 17,
|
||||
KEYCODE_POUND = 18,
|
||||
KEYCODE_DPAD_UP = 19,
|
||||
KEYCODE_DPAD_DOWN = 20,
|
||||
KEYCODE_DPAD_LEFT = 21,
|
||||
KEYCODE_DPAD_RIGHT = 22,
|
||||
KEYCODE_DPAD_CENTER = 23,
|
||||
KEYCODE_VOLUME_UP = 24,
|
||||
KEYCODE_VOLUME_DOWN = 25,
|
||||
KEYCODE_POWER = 26,
|
||||
KEYCODE_CAMERA = 27,
|
||||
KEYCODE_CLEAR = 28,
|
||||
KEYCODE_A = 29,
|
||||
KEYCODE_B = 30,
|
||||
KEYCODE_C = 31,
|
||||
KEYCODE_D = 32,
|
||||
KEYCODE_E = 33,
|
||||
KEYCODE_F = 34,
|
||||
KEYCODE_G = 35,
|
||||
KEYCODE_H = 36,
|
||||
KEYCODE_I = 37,
|
||||
KEYCODE_J = 38,
|
||||
KEYCODE_K = 39,
|
||||
KEYCODE_L = 40,
|
||||
KEYCODE_M = 41,
|
||||
KEYCODE_N = 42,
|
||||
KEYCODE_O = 43,
|
||||
KEYCODE_P = 44,
|
||||
KEYCODE_Q = 45,
|
||||
KEYCODE_R = 46,
|
||||
KEYCODE_S = 47,
|
||||
KEYCODE_T = 48,
|
||||
KEYCODE_U = 49,
|
||||
KEYCODE_V = 50,
|
||||
KEYCODE_W = 51,
|
||||
KEYCODE_X = 52,
|
||||
KEYCODE_Y = 53,
|
||||
KEYCODE_Z = 54,
|
||||
KEYCODE_COMMA = 55,
|
||||
KEYCODE_PERIOD = 56,
|
||||
KEYCODE_ALT_LEFT = 57,
|
||||
KEYCODE_ALT_RIGHT = 58,
|
||||
KEYCODE_SHIFT_LEFT = 59,
|
||||
KEYCODE_SHIFT_RIGHT = 60,
|
||||
KEYCODE_TAB = 61,
|
||||
KEYCODE_SPACE = 62,
|
||||
KEYCODE_SYM = 63,
|
||||
KEYCODE_EXPLORER = 64,
|
||||
KEYCODE_ENVELOPE = 65,
|
||||
KEYCODE_ENTER = 66,
|
||||
KEYCODE_DEL = 67,
|
||||
KEYCODE_GRAVE = 68,
|
||||
KEYCODE_MINUS = 69,
|
||||
KEYCODE_EQUALS = 70,
|
||||
KEYCODE_LEFT_BRACKET = 71,
|
||||
KEYCODE_RIGHT_BRACKET = 72,
|
||||
KEYCODE_BACKSLASH = 73,
|
||||
KEYCODE_SEMICOLON = 74,
|
||||
KEYCODE_APOSTROPHE = 75,
|
||||
KEYCODE_SLASH = 76,
|
||||
KEYCODE_AT = 77,
|
||||
KEYCODE_NUM = 78,
|
||||
KEYCODE_HEADSETHOOK = 79,
|
||||
KEYCODE_FOCUS = 80,
|
||||
KEYCODE_PLUS = 81,
|
||||
KEYCODE_MENU = 82,
|
||||
KEYCODE_NOTIFICATION = 83,
|
||||
KEYCODE_SEARCH = 84,
|
||||
KEYCODE_MEDIA_PLAY_PAUSE= 85,
|
||||
KEYCODE_MEDIA_STOP = 86,
|
||||
KEYCODE_MEDIA_NEXT = 87,
|
||||
KEYCODE_MEDIA_PREVIOUS = 88,
|
||||
KEYCODE_MEDIA_REWIND = 89,
|
||||
KEYCODE_MEDIA_FAST_FORWARD = 90,
|
||||
KEYCODE_MUTE = 91,
|
||||
KEYCODE_PAGE_UP = 92,
|
||||
KEYCODE_PAGE_DOWN = 93,
|
||||
KEYCODE_PICTSYMBOLS = 94,
|
||||
KEYCODE_SWITCH_CHARSET = 95,
|
||||
KEYCODE_BUTTON_A = 96,
|
||||
KEYCODE_BUTTON_B = 97,
|
||||
KEYCODE_BUTTON_C = 98,
|
||||
KEYCODE_BUTTON_X = 99,
|
||||
KEYCODE_BUTTON_Y = 100,
|
||||
KEYCODE_BUTTON_Z = 101,
|
||||
KEYCODE_BUTTON_L1 = 102,
|
||||
KEYCODE_BUTTON_R1 = 103,
|
||||
KEYCODE_BUTTON_L2 = 104,
|
||||
KEYCODE_BUTTON_R2 = 105,
|
||||
KEYCODE_BUTTON_THUMBL = 106,
|
||||
KEYCODE_BUTTON_THUMBR = 107,
|
||||
KEYCODE_BUTTON_START = 108,
|
||||
KEYCODE_BUTTON_SELECT = 109,
|
||||
KEYCODE_BUTTON_MODE = 110,
|
||||
KEYCODE_ESCAPE = 111,
|
||||
KEYCODE_FORWARD_DEL = 112,
|
||||
KEYCODE_CTRL_LEFT = 113,
|
||||
KEYCODE_CTRL_RIGHT = 114,
|
||||
KEYCODE_CAPS_LOCK = 115,
|
||||
KEYCODE_SCROLL_LOCK = 116,
|
||||
KEYCODE_META_LEFT = 117,
|
||||
KEYCODE_META_RIGHT = 118,
|
||||
KEYCODE_FUNCTION = 119,
|
||||
KEYCODE_SYSRQ = 120,
|
||||
KEYCODE_BREAK = 121,
|
||||
KEYCODE_MOVE_HOME = 122,
|
||||
KEYCODE_MOVE_END = 123,
|
||||
KEYCODE_INSERT = 124,
|
||||
KEYCODE_FORWARD = 125,
|
||||
KEYCODE_MEDIA_PLAY = 126,
|
||||
KEYCODE_MEDIA_PAUSE = 127,
|
||||
KEYCODE_MEDIA_CLOSE = 128,
|
||||
KEYCODE_MEDIA_EJECT = 129,
|
||||
KEYCODE_MEDIA_RECORD = 130,
|
||||
KEYCODE_F1 = 131,
|
||||
KEYCODE_F2 = 132,
|
||||
KEYCODE_F3 = 133,
|
||||
KEYCODE_F4 = 134,
|
||||
KEYCODE_F5 = 135,
|
||||
KEYCODE_F6 = 136,
|
||||
KEYCODE_F7 = 137,
|
||||
KEYCODE_F8 = 138,
|
||||
KEYCODE_F9 = 139,
|
||||
KEYCODE_F10 = 140,
|
||||
KEYCODE_F11 = 141,
|
||||
KEYCODE_F12 = 142,
|
||||
KEYCODE_NUM_LOCK = 143,
|
||||
KEYCODE_NUMPAD_0 = 144,
|
||||
KEYCODE_NUMPAD_1 = 145,
|
||||
KEYCODE_NUMPAD_2 = 146,
|
||||
KEYCODE_NUMPAD_3 = 147,
|
||||
KEYCODE_NUMPAD_4 = 148,
|
||||
KEYCODE_NUMPAD_5 = 149,
|
||||
KEYCODE_NUMPAD_6 = 150,
|
||||
KEYCODE_NUMPAD_7 = 151,
|
||||
KEYCODE_NUMPAD_8 = 152,
|
||||
KEYCODE_NUMPAD_9 = 153,
|
||||
KEYCODE_NUMPAD_DIVIDE = 154,
|
||||
KEYCODE_NUMPAD_MULTIPLY = 155,
|
||||
KEYCODE_NUMPAD_SUBTRACT = 156,
|
||||
KEYCODE_NUMPAD_ADD = 157,
|
||||
KEYCODE_NUMPAD_DOT = 158,
|
||||
KEYCODE_NUMPAD_COMMA = 159,
|
||||
KEYCODE_NUMPAD_ENTER = 160,
|
||||
KEYCODE_NUMPAD_EQUALS = 161,
|
||||
KEYCODE_NUMPAD_LEFT_PAREN = 162,
|
||||
KEYCODE_NUMPAD_RIGHT_PAREN = 163,
|
||||
KEYCODE_VOLUME_MUTE = 164,
|
||||
KEYCODE_INFO = 165,
|
||||
KEYCODE_CHANNEL_UP = 166,
|
||||
KEYCODE_CHANNEL_DOWN = 167,
|
||||
KEYCODE_ZOOM_IN = 168,
|
||||
KEYCODE_ZOOM_OUT = 169,
|
||||
KEYCODE_TV = 170,
|
||||
KEYCODE_WINDOW = 171,
|
||||
KEYCODE_GUIDE = 172,
|
||||
KEYCODE_DVR = 173,
|
||||
KEYCODE_BOOKMARK = 174,
|
||||
KEYCODE_CAPTIONS = 175,
|
||||
KEYCODE_SETTINGS = 176,
|
||||
KEYCODE_TV_POWER = 177,
|
||||
KEYCODE_TV_INPUT = 178,
|
||||
KEYCODE_STB_POWER = 179,
|
||||
KEYCODE_STB_INPUT = 180,
|
||||
KEYCODE_AVR_POWER = 181,
|
||||
KEYCODE_AVR_INPUT = 182,
|
||||
KEYCODE_PROG_RED = 183,
|
||||
KEYCODE_PROG_GREEN = 184,
|
||||
KEYCODE_PROG_YELLOW = 185,
|
||||
KEYCODE_PROG_BLUE = 186,
|
||||
KEYCODE_APP_SWITCH = 187,
|
||||
KEYCODE_BUTTON_1 = 188,
|
||||
KEYCODE_BUTTON_2 = 189,
|
||||
KEYCODE_BUTTON_3 = 190,
|
||||
KEYCODE_BUTTON_4 = 191,
|
||||
KEYCODE_BUTTON_5 = 192,
|
||||
KEYCODE_BUTTON_6 = 193,
|
||||
KEYCODE_BUTTON_7 = 194,
|
||||
KEYCODE_BUTTON_8 = 195,
|
||||
KEYCODE_BUTTON_9 = 196,
|
||||
KEYCODE_BUTTON_10 = 197,
|
||||
KEYCODE_BUTTON_11 = 198,
|
||||
KEYCODE_BUTTON_12 = 199,
|
||||
KEYCODE_BUTTON_13 = 200,
|
||||
KEYCODE_BUTTON_14 = 201,
|
||||
KEYCODE_BUTTON_15 = 202,
|
||||
KEYCODE_BUTTON_16 = 203,
|
||||
|
||||
KEYCODE_LAST = 255 // Android 2.3 added several new gaming keys, Android 3.1 added even more - plz keep in sync with Keycodes.java
|
||||
};
|
||||
|
||||
#endif
|
||||
1
project/jni/sdl-1.3/src/video/android/javakeycodes.h
Symbolic link
1
project/jni/sdl-1.3/src/video/android/javakeycodes.h
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/video/android/javakeycodes.h
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
/* JNI-C++ wrapper stuff */
|
||||
#ifndef _JNI_WRAPPER_STUFF_H_
|
||||
#define _JNI_WRAPPER_STUFF_H_
|
||||
|
||||
#ifndef SDL_JAVA_PACKAGE_PATH
|
||||
#error You have to define SDL_JAVA_PACKAGE_PATH to your package path with dots replaced with underscores, for example "com_example_SanAngeles"
|
||||
#endif
|
||||
#define JAVA_EXPORT_NAME2(name,package) Java_##package##_##name
|
||||
#define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package)
|
||||
#define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH)
|
||||
|
||||
#endif
|
||||
1
project/jni/sdl-1.3/src/video/android/jniwrapperstuff.h
Symbolic link
1
project/jni/sdl-1.3/src/video/android/jniwrapperstuff.h
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/video/android/jniwrapperstuff.h
|
||||
@@ -1,242 +0,0 @@
|
||||
#include "SDL_config.h"
|
||||
|
||||
#include "SDL_version.h"
|
||||
#include "SDL_androidinput.h"
|
||||
#include "SDL_screenkeyboard.h"
|
||||
|
||||
void SDL_android_init_keymap(SDLKey *SDL_android_keymap)
|
||||
{
|
||||
int i;
|
||||
SDLKey * keymap = SDL_android_keymap;
|
||||
|
||||
for (i=0; i<SDL_arraysize(SDL_android_keymap); ++i)
|
||||
SDL_android_keymap[i] = SDL_KEY(UNKNOWN);
|
||||
|
||||
keymap[KEYCODE_UNKNOWN] = SDL_KEY(UNKNOWN);
|
||||
|
||||
keymap[KEYCODE_BACK] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_5));
|
||||
|
||||
keymap[KEYCODE_MENU] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_4));
|
||||
|
||||
keymap[KEYCODE_DPAD_CENTER] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_1));
|
||||
keymap[KEYCODE_SEARCH] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_7));
|
||||
|
||||
keymap[KEYCODE_VOLUME_UP] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_2));
|
||||
keymap[KEYCODE_VOLUME_DOWN] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_3));
|
||||
|
||||
keymap[KEYCODE_HOME] = SDL_KEY(HOME); // Cannot be used in application
|
||||
|
||||
// On some devices pressing Camera key will generate Camera keyevent, but releasing it will generate Focus keyevent.
|
||||
keymap[KEYCODE_CAMERA] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_6));
|
||||
keymap[KEYCODE_FOCUS] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_KEYCODE_6));
|
||||
|
||||
keymap[KEYCODE_CALL] = SDL_KEY(TAB);
|
||||
|
||||
keymap[KEYCODE_0] = SDL_KEY(0);
|
||||
keymap[KEYCODE_1] = SDL_KEY(1);
|
||||
keymap[KEYCODE_2] = SDL_KEY(2);
|
||||
keymap[KEYCODE_3] = SDL_KEY(3);
|
||||
keymap[KEYCODE_4] = SDL_KEY(4);
|
||||
keymap[KEYCODE_5] = SDL_KEY(5);
|
||||
keymap[KEYCODE_6] = SDL_KEY(6);
|
||||
keymap[KEYCODE_7] = SDL_KEY(7);
|
||||
keymap[KEYCODE_8] = SDL_KEY(8);
|
||||
keymap[KEYCODE_9] = SDL_KEY(9);
|
||||
keymap[KEYCODE_STAR] = SDL_KEY(KP_DIVIDE);
|
||||
keymap[KEYCODE_POUND] = SDL_KEY(KP_MULTIPLY);
|
||||
|
||||
keymap[KEYCODE_DPAD_UP] = SDL_KEY(UP);
|
||||
keymap[KEYCODE_DPAD_DOWN] = SDL_KEY(DOWN);
|
||||
keymap[KEYCODE_DPAD_LEFT] = SDL_KEY(LEFT);
|
||||
keymap[KEYCODE_DPAD_RIGHT] = SDL_KEY(RIGHT);
|
||||
|
||||
keymap[KEYCODE_SOFT_LEFT] = SDL_KEY(KP_4);
|
||||
keymap[KEYCODE_SOFT_RIGHT] = SDL_KEY(KP_6);
|
||||
keymap[KEYCODE_ENTER] = SDL_KEY(RETURN); //SDL_KEY(KP_ENTER);
|
||||
|
||||
|
||||
keymap[KEYCODE_CLEAR] = SDL_KEY(BACKSPACE);
|
||||
keymap[KEYCODE_A] = SDL_KEY(A);
|
||||
keymap[KEYCODE_B] = SDL_KEY(B);
|
||||
keymap[KEYCODE_C] = SDL_KEY(C);
|
||||
keymap[KEYCODE_D] = SDL_KEY(D);
|
||||
keymap[KEYCODE_E] = SDL_KEY(E);
|
||||
keymap[KEYCODE_F] = SDL_KEY(F);
|
||||
keymap[KEYCODE_G] = SDL_KEY(G);
|
||||
keymap[KEYCODE_H] = SDL_KEY(H);
|
||||
keymap[KEYCODE_I] = SDL_KEY(I);
|
||||
keymap[KEYCODE_J] = SDL_KEY(J);
|
||||
keymap[KEYCODE_K] = SDL_KEY(K);
|
||||
keymap[KEYCODE_L] = SDL_KEY(L);
|
||||
keymap[KEYCODE_M] = SDL_KEY(M);
|
||||
keymap[KEYCODE_N] = SDL_KEY(N);
|
||||
keymap[KEYCODE_O] = SDL_KEY(O);
|
||||
keymap[KEYCODE_P] = SDL_KEY(P);
|
||||
keymap[KEYCODE_Q] = SDL_KEY(Q);
|
||||
keymap[KEYCODE_R] = SDL_KEY(R);
|
||||
keymap[KEYCODE_S] = SDL_KEY(S);
|
||||
keymap[KEYCODE_T] = SDL_KEY(T);
|
||||
keymap[KEYCODE_U] = SDL_KEY(U);
|
||||
keymap[KEYCODE_V] = SDL_KEY(V);
|
||||
keymap[KEYCODE_W] = SDL_KEY(W);
|
||||
keymap[KEYCODE_X] = SDL_KEY(X);
|
||||
keymap[KEYCODE_Y] = SDL_KEY(Y);
|
||||
keymap[KEYCODE_Z] = SDL_KEY(Z);
|
||||
keymap[KEYCODE_COMMA] = SDL_KEY(COMMA);
|
||||
keymap[KEYCODE_PERIOD] = SDL_KEY(PERIOD);
|
||||
keymap[KEYCODE_TAB] = SDL_KEY(TAB);
|
||||
keymap[KEYCODE_SPACE] = SDL_KEY(SPACE);
|
||||
keymap[KEYCODE_DEL] = SDL_KEY(DELETE);
|
||||
keymap[KEYCODE_GRAVE] = SDL_KEY(GRAVE);
|
||||
keymap[KEYCODE_MINUS] = SDL_KEY(KP_MINUS);
|
||||
keymap[KEYCODE_PLUS] = SDL_KEY(KP_PLUS);
|
||||
keymap[KEYCODE_EQUALS] = SDL_KEY(EQUALS);
|
||||
keymap[KEYCODE_LEFT_BRACKET] = SDL_KEY(LEFTBRACKET);
|
||||
keymap[KEYCODE_RIGHT_BRACKET] = SDL_KEY(RIGHTBRACKET);
|
||||
keymap[KEYCODE_BACKSLASH] = SDL_KEY(BACKSLASH);
|
||||
keymap[KEYCODE_SEMICOLON] = SDL_KEY(SEMICOLON);
|
||||
keymap[KEYCODE_APOSTROPHE] = SDL_KEY(APOSTROPHE);
|
||||
keymap[KEYCODE_SLASH] = SDL_KEY(SLASH);
|
||||
keymap[KEYCODE_AT] = SDL_KEY(KP_PERIOD);
|
||||
|
||||
keymap[KEYCODE_MEDIA_PLAY_PAUSE] = SDL_KEY(KP_2);
|
||||
keymap[KEYCODE_MEDIA_STOP] = SDL_KEY(HELP);
|
||||
keymap[KEYCODE_MEDIA_NEXT] = SDL_KEY(KP_8);
|
||||
keymap[KEYCODE_MEDIA_PREVIOUS] = SDL_KEY(KP_5);
|
||||
keymap[KEYCODE_MEDIA_REWIND] = SDL_KEY(KP_1);
|
||||
keymap[KEYCODE_MEDIA_FAST_FORWARD] = SDL_KEY(KP_3);
|
||||
keymap[KEYCODE_MUTE] = SDL_KEY(KP_0);
|
||||
|
||||
keymap[KEYCODE_SYM] = SDL_KEY(LGUI);
|
||||
keymap[KEYCODE_NUM] = SDL_KEY(NUMLOCKCLEAR);
|
||||
|
||||
keymap[KEYCODE_ALT_LEFT] = SDL_KEY(KP_7);
|
||||
keymap[KEYCODE_ALT_RIGHT] = SDL_KEY(KP_9);
|
||||
|
||||
keymap[KEYCODE_SHIFT_LEFT] = SDL_KEY(F1);
|
||||
keymap[KEYCODE_SHIFT_RIGHT] = SDL_KEY(F2);
|
||||
|
||||
keymap[KEYCODE_EXPLORER] = SDL_KEY(F3);
|
||||
keymap[KEYCODE_ENVELOPE] = SDL_KEY(F4);
|
||||
|
||||
keymap[KEYCODE_HEADSETHOOK] = SDL_KEY(F5);
|
||||
keymap[KEYCODE_NOTIFICATION] = SDL_KEY(F6);
|
||||
|
||||
// Cannot be received by application, OS internal
|
||||
keymap[KEYCODE_ENDCALL] = SDL_KEY(LSHIFT);
|
||||
keymap[KEYCODE_POWER] = SDL_KEY(RALT);
|
||||
|
||||
keymap[KEYCODE_PAGE_UP] = SDL_KEY(PAGEUP);
|
||||
keymap[KEYCODE_PAGE_DOWN] = SDL_KEY(PAGEDOWN);
|
||||
keymap[KEYCODE_PICTSYMBOLS] = SDL_KEY(LSHIFT);
|
||||
keymap[KEYCODE_SWITCH_CHARSET] = SDL_KEY(LSHIFT);
|
||||
keymap[KEYCODE_BUTTON_A] = SDL_KEY(A);
|
||||
keymap[KEYCODE_BUTTON_B] = SDL_KEY(B);
|
||||
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));
|
||||
keymap[KEYCODE_BUTTON_Z] = SDL_KEY(Z);
|
||||
keymap[KEYCODE_BUTTON_L1] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_2));
|
||||
keymap[KEYCODE_BUTTON_R1] = SDL_KEY(SDL_KEY_VAL(SDL_ANDROID_SCREENKB_KEYCODE_3));
|
||||
keymap[KEYCODE_BUTTON_L2] = SDL_KEY(LCTRL);
|
||||
keymap[KEYCODE_BUTTON_R2] = SDL_KEY(RCTRL);
|
||||
keymap[KEYCODE_BUTTON_THUMBL] = SDL_KEY(LALT);
|
||||
keymap[KEYCODE_BUTTON_THUMBR] = SDL_KEY(RALT);
|
||||
keymap[KEYCODE_BUTTON_START] = SDL_KEY(RETURN);
|
||||
keymap[KEYCODE_BUTTON_SELECT] = SDL_KEY(ESCAPE);
|
||||
keymap[KEYCODE_BUTTON_MODE] = SDL_KEY(SPACE);
|
||||
keymap[KEYCODE_ESCAPE] = SDL_KEY(ESCAPE);
|
||||
keymap[KEYCODE_FORWARD_DEL] = SDL_KEY(DELETE);
|
||||
keymap[KEYCODE_CTRL_LEFT] = SDL_KEY(LEFT);
|
||||
keymap[KEYCODE_CTRL_RIGHT] = SDL_KEY(RIGHT);
|
||||
keymap[KEYCODE_CAPS_LOCK] = SDL_KEY(CAPSLOCK);
|
||||
keymap[KEYCODE_SCROLL_LOCK] = SDL_KEY(SCROLLLOCK);
|
||||
keymap[KEYCODE_META_LEFT] = SDL_KEY(LEFT);
|
||||
keymap[KEYCODE_META_RIGHT] = SDL_KEY(RIGHT);
|
||||
keymap[KEYCODE_FUNCTION] = SDL_KEY(RGUI);
|
||||
keymap[KEYCODE_SYSRQ] = SDL_KEY(SYSREQ);
|
||||
keymap[KEYCODE_BREAK] = SDL_KEY(PAUSE);
|
||||
keymap[KEYCODE_MOVE_HOME] = SDL_KEY(HOME);
|
||||
keymap[KEYCODE_MOVE_END] = SDL_KEY(END);
|
||||
keymap[KEYCODE_INSERT] = SDL_KEY(INSERT);
|
||||
keymap[KEYCODE_FORWARD] = SDL_KEY(RIGHT);
|
||||
keymap[KEYCODE_MEDIA_PLAY] = SDL_KEY(F1);
|
||||
keymap[KEYCODE_MEDIA_PAUSE] = SDL_KEY(F2);
|
||||
keymap[KEYCODE_MEDIA_CLOSE] = SDL_KEY(F3);
|
||||
keymap[KEYCODE_MEDIA_EJECT] = SDL_KEY(F4);
|
||||
keymap[KEYCODE_MEDIA_RECORD] = SDL_KEY(F5);
|
||||
keymap[KEYCODE_F1] = SDL_KEY(F1);
|
||||
keymap[KEYCODE_F2] = SDL_KEY(F2);
|
||||
keymap[KEYCODE_F3] = SDL_KEY(F3);
|
||||
keymap[KEYCODE_F4] = SDL_KEY(F4);
|
||||
keymap[KEYCODE_F5] = SDL_KEY(F5);
|
||||
keymap[KEYCODE_F6] = SDL_KEY(F6);
|
||||
keymap[KEYCODE_F7] = SDL_KEY(F7);
|
||||
keymap[KEYCODE_F8] = SDL_KEY(F8);
|
||||
keymap[KEYCODE_F9] = SDL_KEY(F9);
|
||||
keymap[KEYCODE_F10] = SDL_KEY(F10);
|
||||
keymap[KEYCODE_F11] = SDL_KEY(F11);
|
||||
keymap[KEYCODE_F12] = SDL_KEY(F12);
|
||||
keymap[KEYCODE_NUM_LOCK] = SDL_KEY(NUMLOCKCLEAR);
|
||||
keymap[KEYCODE_NUMPAD_0] = SDL_KEY(KP_0);
|
||||
keymap[KEYCODE_NUMPAD_1] = SDL_KEY(KP_1);
|
||||
keymap[KEYCODE_NUMPAD_2] = SDL_KEY(KP_2);
|
||||
keymap[KEYCODE_NUMPAD_3] = SDL_KEY(KP_3);
|
||||
keymap[KEYCODE_NUMPAD_4] = SDL_KEY(KP_4);
|
||||
keymap[KEYCODE_NUMPAD_5] = SDL_KEY(KP_5);
|
||||
keymap[KEYCODE_NUMPAD_6] = SDL_KEY(KP_6);
|
||||
keymap[KEYCODE_NUMPAD_7] = SDL_KEY(KP_7);
|
||||
keymap[KEYCODE_NUMPAD_8] = SDL_KEY(KP_8);
|
||||
keymap[KEYCODE_NUMPAD_9] = SDL_KEY(KP_9);
|
||||
keymap[KEYCODE_NUMPAD_DIVIDE] = SDL_KEY(KP_DIVIDE);
|
||||
keymap[KEYCODE_NUMPAD_MULTIPLY] = SDL_KEY(KP_MULTIPLY);
|
||||
keymap[KEYCODE_NUMPAD_SUBTRACT] = SDL_KEY(KP_MINUS);
|
||||
keymap[KEYCODE_NUMPAD_ADD] = SDL_KEY(KP_PLUS);
|
||||
keymap[KEYCODE_NUMPAD_DOT] = SDL_KEY(KP_PERIOD);
|
||||
keymap[KEYCODE_NUMPAD_COMMA] = SDL_KEY(KP_PERIOD);
|
||||
keymap[KEYCODE_NUMPAD_ENTER] = SDL_KEY(KP_ENTER);
|
||||
keymap[KEYCODE_NUMPAD_EQUALS] = SDL_KEY(KP_EQUALS);
|
||||
keymap[KEYCODE_NUMPAD_LEFT_PAREN] = SDL_KEY(KP_DIVIDE);
|
||||
keymap[KEYCODE_NUMPAD_RIGHT_PAREN] = SDL_KEY(KP_MULTIPLY);
|
||||
keymap[KEYCODE_VOLUME_MUTE] = SDL_KEY(F13);
|
||||
keymap[KEYCODE_INFO] = SDL_KEY(F14);
|
||||
keymap[KEYCODE_CHANNEL_UP] = SDL_KEY(UP);
|
||||
keymap[KEYCODE_CHANNEL_DOWN] = SDL_KEY(DOWN);
|
||||
keymap[KEYCODE_ZOOM_IN] = SDL_KEY(PAGEUP);
|
||||
keymap[KEYCODE_ZOOM_OUT] = SDL_KEY(PAGEDOWN);
|
||||
keymap[KEYCODE_TV] = SDL_KEY(F15);
|
||||
keymap[KEYCODE_WINDOW] = SDL_KEY(F1);
|
||||
keymap[KEYCODE_GUIDE] = SDL_KEY(F2);
|
||||
keymap[KEYCODE_DVR] = SDL_KEY(F3);
|
||||
keymap[KEYCODE_BOOKMARK] = SDL_KEY(F4);
|
||||
keymap[KEYCODE_CAPTIONS] = SDL_KEY(F5);
|
||||
keymap[KEYCODE_SETTINGS] = SDL_KEY(F6);
|
||||
keymap[KEYCODE_TV_POWER] = SDL_KEY(F7);
|
||||
keymap[KEYCODE_TV_INPUT] = SDL_KEY(F8);
|
||||
keymap[KEYCODE_STB_POWER] = SDL_KEY(F9);
|
||||
keymap[KEYCODE_STB_INPUT] = SDL_KEY(F10);
|
||||
keymap[KEYCODE_AVR_POWER] = SDL_KEY(F11);
|
||||
keymap[KEYCODE_AVR_INPUT] = SDL_KEY(F12);
|
||||
keymap[KEYCODE_PROG_RED] = SDL_KEY(F13);
|
||||
keymap[KEYCODE_PROG_GREEN] = SDL_KEY(F14);
|
||||
keymap[KEYCODE_PROG_YELLOW] = SDL_KEY(F15);
|
||||
keymap[KEYCODE_PROG_BLUE] = SDL_KEY(F1);
|
||||
keymap[KEYCODE_APP_SWITCH] = SDL_KEY(F2);
|
||||
keymap[KEYCODE_BUTTON_1] = SDL_KEY(A);
|
||||
keymap[KEYCODE_BUTTON_2] = SDL_KEY(B);
|
||||
keymap[KEYCODE_BUTTON_3] = SDL_KEY(C);
|
||||
keymap[KEYCODE_BUTTON_4] = SDL_KEY(D);
|
||||
keymap[KEYCODE_BUTTON_5] = SDL_KEY(E);
|
||||
keymap[KEYCODE_BUTTON_6] = SDL_KEY(F);
|
||||
keymap[KEYCODE_BUTTON_7] = SDL_KEY(G);
|
||||
keymap[KEYCODE_BUTTON_8] = SDL_KEY(H);
|
||||
keymap[KEYCODE_BUTTON_9] = SDL_KEY(I);
|
||||
keymap[KEYCODE_BUTTON_10] = SDL_KEY(J);
|
||||
keymap[KEYCODE_BUTTON_11] = SDL_KEY(K);
|
||||
keymap[KEYCODE_BUTTON_12] = SDL_KEY(L);
|
||||
keymap[KEYCODE_BUTTON_13] = SDL_KEY(M);
|
||||
keymap[KEYCODE_BUTTON_14] = SDL_KEY(N);
|
||||
keymap[KEYCODE_BUTTON_15] = SDL_KEY(O);
|
||||
keymap[KEYCODE_BUTTON_16] = SDL_KEY(P);
|
||||
|
||||
}
|
||||
1
project/jni/sdl-1.3/src/video/android/keymap.c
Symbolic link
1
project/jni/sdl-1.3/src/video/android/keymap.c
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../sdl-1.2/src/video/android/keymap.c
|
||||
@@ -1 +0,0 @@
|
||||
../../../../fonteditor/touchscreenfont.h
|
||||
Reference in New Issue
Block a user