SDL 1.2 compiles, runs, but does not output anything on screen
This commit is contained in:
@@ -1 +1 @@
|
||||
../sdl/sdl-1.3
|
||||
../sdl/sdl-1.2
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "SDL_thread.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../SDL_pixels_c.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
|
||||
#include "SDL_androidvideo.h"
|
||||
|
||||
@@ -41,6 +40,7 @@
|
||||
#include <math.h>
|
||||
#include <string.h> // for memset()
|
||||
|
||||
#define _THIS SDL_VideoDevice *this
|
||||
|
||||
/* Initialization/Query functions */
|
||||
static int ANDROID_VideoInit(_THIS, SDL_PixelFormat *vformat);
|
||||
@@ -56,6 +56,7 @@ static void ANDROID_UnlockHWSurface(_THIS, SDL_Surface *surface);
|
||||
static void ANDROID_FreeHWSurface(_THIS, SDL_Surface *surface);
|
||||
static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface);
|
||||
static void ANDROID_GL_SwapBuffers(_THIS);
|
||||
static void ANDROID_PumpEvents(_THIS);
|
||||
|
||||
// Stubs to get rid of crashing in OpenGL mode
|
||||
// The implementation dependent data for the window manager cursor
|
||||
@@ -115,8 +116,6 @@ static jobject JavaRenderer = NULL;
|
||||
static jmethodID JavaSwapBuffers = NULL;
|
||||
|
||||
|
||||
static SDLKey keymap[KEYCODE_LAST+1];
|
||||
|
||||
static void SdlGlRenderInit();
|
||||
|
||||
|
||||
@@ -379,8 +378,6 @@ static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface)
|
||||
|
||||
SDL_ANDROID_CallJavaSwapBuffers();
|
||||
|
||||
processAndroidTrackballKeyDelays( -1, 0 );
|
||||
|
||||
SDL_Delay(10);
|
||||
|
||||
return(0);
|
||||
|
||||
@@ -18,6 +18,7 @@ LOCAL_CFLAGS := -I$(LOCAL_PATH)/include \
|
||||
SDL_SRCS := \
|
||||
src/*.c \
|
||||
src/audio/*.c \
|
||||
src/cdrom/*.c \
|
||||
src/cpuinfo/*.c \
|
||||
src/events/*.c \
|
||||
src/file/*.c \
|
||||
@@ -32,6 +33,7 @@ SDL_SRCS := \
|
||||
src/thread/pthread/*.c \
|
||||
src/timer/unix/*.c \
|
||||
src/audio/android/*.c \
|
||||
src/cdrom/dummy/*.c \
|
||||
src/video/android/*.c \
|
||||
src/joystick/dummy/*.c \
|
||||
src/haptic/dummy/*.c \
|
||||
|
||||
@@ -121,7 +121,7 @@ static SDL_AudioDevice *ANDROIDAUD_CreateDevice(int devindex)
|
||||
}
|
||||
|
||||
AudioBootStrap ANDROIDAUD_bootstrap = {
|
||||
ANDROIDAUD_DRIVER_NAME, "SDL Android audio driver",
|
||||
"android", "SDL Android audio driver",
|
||||
ANDROIDAUD_Available, ANDROIDAUD_CreateDevice
|
||||
};
|
||||
|
||||
@@ -144,9 +144,17 @@ static Uint8 *ANDROIDAUD_GetAudioBuf(_THIS)
|
||||
return(audioBuffer);
|
||||
}
|
||||
|
||||
static int ANDROIDAUD_OpenAudio(_THIS, const char *devname, int iscapture)
|
||||
|
||||
#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;
|
||||
|
||||
@@ -157,7 +165,7 @@ static int ANDROIDAUD_OpenAudio(_THIS, const char *devname, int iscapture)
|
||||
}
|
||||
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
|
||||
|
||||
if( ! (this->spec.format == AUDIO_S8 || this->spec.format == AUDIO_S16) )
|
||||
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
|
||||
|
||||
@@ -36,13 +36,19 @@
|
||||
#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_androidvideo.h"
|
||||
#include "SDL_scancode.h"
|
||||
#include "SDL_compat.h"
|
||||
#else
|
||||
#include "SDL_keysym.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#endif
|
||||
|
||||
#include "SDL_androidvideo.h"
|
||||
|
||||
|
||||
static SDLKey keymap[KEYCODE_LAST+1];
|
||||
@@ -85,6 +91,13 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
|
||||
|
||||
#define SDL_KEY(X) SDL_SCANCODE_ ## X
|
||||
|
||||
static SDL_scancode TranslateKey(int scancode, SDL_keysym *keysym)
|
||||
{
|
||||
if ( scancode >= SDL_arraysize(keymap) )
|
||||
scancode = KEYCODE_UNKNOWN;
|
||||
return keymap[scancode];
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define SDL_KEY2(X) SDLK_ ## X
|
||||
@@ -105,26 +118,73 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
|
||||
#define KP_9 KP9
|
||||
#define NUMLOCKCLEAR NUMLOCK
|
||||
#define GRAVE DOLLAR
|
||||
#define APOSTROPHE QUOTE
|
||||
#define LGUI LMETA
|
||||
// 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
|
||||
|
||||
#define SDL_scancode SDLKey
|
||||
|
||||
static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym)
|
||||
{
|
||||
/* Sanity check */
|
||||
if ( scancode >= SDL_arraysize(keymap) )
|
||||
scancode = KEYCODE_UNKNOWN;
|
||||
|
||||
/* Set the keysym information */
|
||||
keysym->scancode = scancode;
|
||||
keysym->sym = keymap[scancode];
|
||||
keysym->mod = KMOD_NONE;
|
||||
|
||||
/* If UNICODE is on, get the UNICODE value for the key */
|
||||
keysym->unicode = 0;
|
||||
if ( SDL_TranslateUNICODE ) {
|
||||
/* Populate the unicode field with the ASCII value */
|
||||
keysym->unicode = scancode;
|
||||
}
|
||||
return(keysym);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static SDL_scancode TranslateKey(int scancode)
|
||||
{
|
||||
if ( scancode >= SDL_arraysize(keymap) )
|
||||
scancode = KEYCODE_UNKNOWN;
|
||||
return keymap[scancode];
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint key, jint action )
|
||||
{
|
||||
//if( ! processAndroidTrackballKeyDelays(key, action) )
|
||||
SDL_SendKeyboardKey( action ? SDL_PRESSED : SDL_RELEASED, TranslateKey(key) );
|
||||
SDL_keysym keysym;
|
||||
SDL_SendKeyboardKey( action ? SDL_PRESSED : SDL_RELEASED, TranslateKey(key ,&keysym) );
|
||||
}
|
||||
|
||||
|
||||
static void updateOrientation ( float accX, float accY, float accZ )
|
||||
{
|
||||
SDL_keysym keysym;
|
||||
// TODO: use accelerometer as joystick, make this configurable
|
||||
// Currenly it's used as cursor + KP7/KP9 keys
|
||||
static const float dx = 0.04, dy = 0.1, dz = 0.1;
|
||||
@@ -140,7 +200,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "Accelerometer: press left, acc %f mid %f d %f", accX, midX, dx);
|
||||
pressLeft = 1;
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, SDL_SCANCODE_LEFT );
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_DPAD_LEFT, &keysym) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -149,7 +209,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "Accelerometer: release left, acc %f mid %f d %f", accX, midX, dx);
|
||||
pressLeft = 0;
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, SDL_SCANCODE_LEFT );
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_LEFT, &keysym) );
|
||||
}
|
||||
}
|
||||
if( accX < midX - dx*2 )
|
||||
@@ -161,7 +221,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "Accelerometer: press right, acc %f mid %f d %f", accX, midX, dx);
|
||||
pressRight = 1;
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, SDL_SCANCODE_RIGHT );
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_DPAD_RIGHT, &keysym) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -170,7 +230,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "Accelerometer: release right, acc %f mid %f d %f", accX, midX, dx);
|
||||
pressRight = 0;
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, SDL_SCANCODE_RIGHT );
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_RIGHT, &keysym) );
|
||||
}
|
||||
}
|
||||
if( accX > midX + dx*2 )
|
||||
@@ -182,7 +242,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "Accelerometer: press up, acc %f mid %f d %f", accY, midY, dy);
|
||||
pressUp = 1;
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, SDL_SCANCODE_DOWN );
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_DPAD_DOWN, &keysym) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -191,7 +251,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "Accelerometer: release up, acc %f mid %f d %f", accY, midY, dy);
|
||||
pressUp = 0;
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, SDL_SCANCODE_DOWN );
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_DOWN, &keysym) );
|
||||
}
|
||||
}
|
||||
if( accY < midY - dy*2 )
|
||||
@@ -203,7 +263,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "Accelerometer: press down, acc %f mid %f d %f", accY, midY, dy);
|
||||
pressDown = 1;
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, SDL_SCANCODE_UP );
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_DPAD_UP, &keysym) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -212,7 +272,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
{
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "Accelerometer: release down, acc %f mid %f d %f", accY, midY, dy);
|
||||
pressDown = 0;
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, SDL_SCANCODE_UP );
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_UP, &keysym) );
|
||||
}
|
||||
}
|
||||
if( accY > midY + dy*2 )
|
||||
@@ -223,7 +283,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
if( !pressL )
|
||||
{
|
||||
pressL = 1;
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, SDL_SCANCODE_KP_7 );
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_ALT_LEFT, &keysym) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -231,7 +291,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
if( pressL )
|
||||
{
|
||||
pressL = 0;
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, SDL_SCANCODE_KP_7 );
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_ALT_LEFT, &keysym) );
|
||||
}
|
||||
}
|
||||
if( accZ < midZ - dz*2 )
|
||||
@@ -242,7 +302,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
if( !pressR )
|
||||
{
|
||||
pressR = 1;
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, SDL_SCANCODE_KP_9 );
|
||||
SDL_SendKeyboardKey( SDL_PRESSED, TranslateKey(KEYCODE_ALT_RIGHT, &keysym) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -250,7 +310,7 @@ static void updateOrientation ( float accX, float accY, float accZ )
|
||||
if( pressR )
|
||||
{
|
||||
pressR = 0;
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, SDL_SCANCODE_KP_9 );
|
||||
SDL_SendKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_ALT_RIGHT, &keysym) );
|
||||
}
|
||||
}
|
||||
if( accZ > midZ + dz*2 )
|
||||
@@ -397,10 +457,12 @@ void ANDROID_InitOSKeymap()
|
||||
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);
|
||||
|
||||
// TODO: Too lazy to define that
|
||||
|
||||
/*
|
||||
keymap[KEYCODE_ALT_LEFT] = SDL_KEY(AC_BACK);
|
||||
keymap[KEYCODE_ALT_RIGHT] = SDL_KEY(AC_FORWARD);
|
||||
keymap[KEYCODE_SHIFT_LEFT] = SDL_KEY(VOLUMEUP);
|
||||
keymap[KEYCODE_SHIFT_RIGHT] = SDL_KEY(VOLUMEDOWN);
|
||||
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
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_video.h"
|
||||
#include "SDL_mouse.h"
|
||||
#include "SDL_mutex.h"
|
||||
#include "SDL_thread.h"
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../SDL_pixels_c.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
|
||||
#include "SDL_androidvideo.h"
|
||||
|
||||
|
||||
/* Initialization/Query functions */
|
||||
static int ANDROID_VideoInit(_THIS);
|
||||
static int ANDROID_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
|
||||
static void ANDROID_GetDisplayModes(_THIS, SDL_VideoDisplay * display);
|
||||
static int ANDROID_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
|
||||
static void ANDROID_VideoQuit(_THIS);
|
||||
|
||||
static void ANDROID_GL_SwapBuffers(_THIS, SDL_Window * window);
|
||||
// Stubs
|
||||
static SDL_GLContext ANDROID_GL_CreateContext(_THIS, SDL_Window * window);
|
||||
static int ANDROID_GL_MakeCurrent (_THIS, SDL_Window * window, SDL_GLContext context);
|
||||
static void ANDROID_GL_DeleteContext (_THIS, SDL_GLContext context);
|
||||
static void ANDROID_PumpEvents(_THIS);
|
||||
|
||||
/* ANDROID driver bootstrap functions */
|
||||
|
||||
static int ANDROID_Available(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void ANDROID_DeleteDevice(SDL_VideoDevice *device)
|
||||
{
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_VideoDevice *ANDROID_CreateDevice(int devindex)
|
||||
{
|
||||
SDL_VideoDevice *device;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
|
||||
if ( device ) {
|
||||
SDL_memset(device, 0, sizeof (*device));
|
||||
}
|
||||
if ( (device == NULL) ) {
|
||||
SDL_OutOfMemory();
|
||||
if ( device ) {
|
||||
SDL_free(device);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Set the function pointers */
|
||||
device->VideoInit = ANDROID_VideoInit;
|
||||
device->GetDisplayBounds = ANDROID_GetDisplayBounds;
|
||||
device->GetDisplayModes = ANDROID_GetDisplayModes;
|
||||
device->SetDisplayMode = ANDROID_SetDisplayMode;
|
||||
device->PumpEvents = ANDROID_PumpEvents;
|
||||
device->VideoQuit = ANDROID_VideoQuit;
|
||||
device->free = ANDROID_DeleteDevice;
|
||||
|
||||
device->GL_SwapWindow = ANDROID_GL_SwapBuffers;
|
||||
device->GL_CreateContext = ANDROID_GL_CreateContext;
|
||||
device->GL_MakeCurrent = ANDROID_GL_MakeCurrent;
|
||||
device->GL_DeleteContext = ANDROID_GL_DeleteContext;
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
VideoBootStrap ANDROID_bootstrap = {
|
||||
"android", "SDL Android video driver",
|
||||
ANDROID_Available, ANDROID_CreateDevice
|
||||
};
|
||||
|
||||
|
||||
int ANDROID_VideoInit(_THIS)
|
||||
{
|
||||
SDL_VideoDisplay display;
|
||||
SDL_DisplayMode mode;
|
||||
|
||||
mode.w = SDL_ANDROID_sWindowWidth;
|
||||
mode.h = SDL_ANDROID_sWindowHeight;
|
||||
mode.refresh_rate = 0;
|
||||
mode.format = SDL_PIXELFORMAT_RGB565;
|
||||
mode.driverdata = NULL;
|
||||
|
||||
SDL_zero(display);
|
||||
display.desktop_mode = mode;
|
||||
display.current_mode = mode;
|
||||
display.driverdata = NULL;
|
||||
SDL_AddVideoDisplay(&display);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void ANDROID_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||
{
|
||||
SDL_DisplayMode mode;
|
||||
mode.w = SDL_ANDROID_sWindowWidth;
|
||||
mode.h = SDL_ANDROID_sWindowHeight;
|
||||
mode.refresh_rate = 0;
|
||||
mode.format = SDL_PIXELFORMAT_RGB565;
|
||||
mode.driverdata = NULL;
|
||||
SDL_AddDisplayMode(display, &mode);
|
||||
}
|
||||
|
||||
int ANDROID_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
|
||||
{
|
||||
rect->w = SDL_ANDROID_sWindowWidth;
|
||||
rect->h = SDL_ANDROID_sWindowHeight;
|
||||
return 1;
|
||||
};
|
||||
|
||||
int ANDROID_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
||||
{
|
||||
return 1;
|
||||
};
|
||||
|
||||
|
||||
/* Note: If we are terminated, this could be called in the middle of
|
||||
another SDL video routine -- notably UpdateRects.
|
||||
*/
|
||||
void ANDROID_VideoQuit(_THIS)
|
||||
{
|
||||
}
|
||||
|
||||
void ANDROID_PumpEvents(_THIS)
|
||||
{
|
||||
}
|
||||
|
||||
void ANDROID_GL_SwapBuffers(_THIS, SDL_Window * window)
|
||||
{
|
||||
SDL_ANDROID_CallJavaSwapBuffers();
|
||||
};
|
||||
|
||||
SDL_GLContext ANDROID_GL_CreateContext(_THIS, SDL_Window * window)
|
||||
{
|
||||
return (SDL_GLContext)1;
|
||||
};
|
||||
int ANDROID_GL_MakeCurrent (_THIS, SDL_Window * window, SDL_GLContext context)
|
||||
{
|
||||
return 1;
|
||||
};
|
||||
void ANDROID_GL_DeleteContext (_THIS, SDL_GLContext context)
|
||||
{
|
||||
};
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <string.h> // for memset()
|
||||
|
||||
#include "SDL_config.h"
|
||||
#include "SDL_version.h"
|
||||
|
||||
#include "SDL_video.h"
|
||||
#include "SDL_mouse.h"
|
||||
@@ -80,7 +81,11 @@ 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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user