From b4db4d71fefad3ad5f7b898e4c8732dac2b4809b Mon Sep 17 00:00:00 2001 From: pelya Date: Thu, 24 May 2012 13:52:22 +0300 Subject: [PATCH] Fixed no video output in SDL 1.3, it seems that there are no more critical bugs in it. --- .../application/sdl-1.3-test/AndroidAppSettings.cfg | 2 +- .../application/sdl-1.3-test/testspriteminimal.c | 5 ++++- .../src/video/android/SDL_androidvideo-1.3.c | 13 ++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/project/jni/application/sdl-1.3-test/AndroidAppSettings.cfg b/project/jni/application/sdl-1.3-test/AndroidAppSettings.cfg index e8df10d7a..d994ebd83 100644 --- a/project/jni/application/sdl-1.3-test/AndroidAppSettings.cfg +++ b/project/jni/application/sdl-1.3-test/AndroidAppSettings.cfg @@ -20,7 +20,7 @@ AppNeedsTwoButtonMouse=y ShowMouseCursor=n ForceRelativeMouseMode=n AppNeedsArrowKeys=n -AppNeedsTextInput=n +AppNeedsTextInput=y AppUsesJoystick=n AppHandlesJoystickSensitivity=n AppUsesMultitouch=y diff --git a/project/jni/application/sdl-1.3-test/testspriteminimal.c b/project/jni/application/sdl-1.3-test/testspriteminimal.c index e92aa931e..df0de3d3b 100644 --- a/project/jni/application/sdl-1.3-test/testspriteminimal.c +++ b/project/jni/application/sdl-1.3-test/testspriteminimal.c @@ -136,6 +136,9 @@ main(int argc, char *argv[]) if (SDL_CreateWindowAndRenderer(WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer) < 0) { quit(2); } + SDL_RendererInfo info; + SDL_GetRendererInfo(renderer, &info); + fprintf(stderr, "Renderer: %s flags %d max texture %dx%d\n", info.name, info.flags, info.max_texture_width, info.max_texture_height); if (LoadSprite("icon.bmp", renderer) < 0) { quit(2); @@ -166,7 +169,7 @@ main(int argc, char *argv[]) } } MoveSprites(window, renderer, sprite); - fprintf(stderr, "Frame rendered, you see nothing on screen, that's bug in SDL, lalala\n"); + //fprintf(stderr, "Frame rendered, you see nothing on screen, that's bug in SDL, lalala\n"); } quit(0); diff --git a/project/jni/sdl-1.3/src/video/android/SDL_androidvideo-1.3.c b/project/jni/sdl-1.3/src/video/android/SDL_androidvideo-1.3.c index e07fb43ca..6669554ae 100644 --- a/project/jni/sdl-1.3/src/video/android/SDL_androidvideo-1.3.c +++ b/project/jni/sdl-1.3/src/video/android/SDL_androidvideo-1.3.c @@ -67,6 +67,8 @@ static void ANDROID_PumpEvents(_THIS); static int ANDROID_CreateWindow(_THIS, SDL_Window * window); static void ANDROID_DestroyWindow(_THIS, SDL_Window * window); +static void ANDROID_StartTextInput(_THIS); + void * glLibraryHandle = NULL; void * gl2LibraryHandle = NULL; @@ -119,6 +121,8 @@ static SDL_VideoDevice *ANDROID_CreateDevice(int devindex) device->CreateWindow = ANDROID_CreateWindow; device->DestroyWindow = ANDROID_DestroyWindow; + device->StartTextInput = ANDROID_StartTextInput; + device->free = ANDROID_DeleteDevice; glLibraryHandle = dlopen("libGLESv1_CM.so", RTLD_NOW | RTLD_GLOBAL); @@ -245,8 +249,9 @@ int ANDROID_CreateWindow(_THIS, SDL_Window * window) window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */ window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */ + window->flags &= ~SDL_WINDOW_HIDDEN; window->flags |= SDL_WINDOW_SHOWN; /* only one window on Android */ - window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ + window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ __android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROID_CreateWindow(): ANDROID_CurrentWindow %p", ANDROID_CurrentWindow); @@ -257,6 +262,12 @@ void ANDROID_DestroyWindow(_THIS, SDL_Window * window) ANDROID_CurrentWindow = NULL; }; +void ANDROID_StartTextInput(_THIS) +{ + SDL_ANDROID_ToggleScreenKeyboardTextInput(""); +} + + static void* ANDROID_GL_GetProcAddress(_THIS, const char *proc) { void * func = dlsym(glLibraryHandle, proc);