Commit 25101525 authored by Sam Lantinga's avatar Sam Lantinga

Fill in the video mode with the correct screen format

parent a410db1a
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
extern "C" { extern "C" {
#include "events/SDL_events_c.h" #include "events/SDL_events_c.h"
#include "video/android/SDL_androidkeyboard.h" #include "video/android/SDL_androidkeyboard.h"
#include "video/android/SDL_androidvideo.h"
} }
/******************************************************************************* /*******************************************************************************
...@@ -49,9 +50,6 @@ jmethodID midFlipBuffers; ...@@ -49,9 +50,6 @@ jmethodID midFlipBuffers;
jmethodID midEnableFeature; jmethodID midEnableFeature;
jmethodID midUpdateAudio; jmethodID midUpdateAudio;
extern "C" void Android_SetScreenResolution(int width, int height);
extern "C" int SDL_SendQuit();
//If we're not the active app, don't try to render //If we're not the active app, don't try to render
bool bRenderingEnabled = false; bool bRenderingEnabled = false;
...@@ -145,21 +143,12 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeQuit( JNIEnv* env, ...@@ -145,21 +143,12 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeQuit( JNIEnv* env,
SDL_SendQuit(); SDL_SendQuit();
} }
// Screen size
extern "C" void Java_org_libsdl_app_SDLActivity_nativeSetScreenSize(
JNIEnv* env, jobject obj, jint width, jint height)
{
__android_log_print(ANDROID_LOG_INFO, "SDL",
"SDL: Set screen size on init: %d/%d\n", width, height);
Android_SetScreenResolution(width, height);
}
// Resize // Resize
extern "C" void Java_org_libsdl_app_SDLActivity_onNativeResize( extern "C" void Java_org_libsdl_app_SDLActivity_onNativeResize(
JNIEnv* env, jobject obj, jint width, JNIEnv* env, jobject obj, jint width,
jint height, jint format) jint height, jint format)
{ {
/* FIXME: What is the relationship between this and the window? */ Android_SetScreenResolution(width, height, format);
} }
extern "C" void Java_org_libsdl_app_SDLActivity_onNativeAccel( extern "C" void Java_org_libsdl_app_SDLActivity_onNativeAccel(
...@@ -229,3 +218,5 @@ extern "C" void Android_UpdateAudioBuffer(unsigned char *buf, int len) ...@@ -229,3 +218,5 @@ extern "C" void Android_UpdateAudioBuffer(unsigned char *buf, int len)
__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL: invoked\n"); __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL: invoked\n");
} }
/* vi: set ts=4 sw=4 expandtab: */
...@@ -56,10 +56,11 @@ extern void Android_GL_DeleteContext(_THIS, SDL_GLContext context); ...@@ -56,10 +56,11 @@ extern void Android_GL_DeleteContext(_THIS, SDL_GLContext context);
/* Android driver bootstrap functions */ /* Android driver bootstrap functions */
//These are filled in with real values in Android_SetScreenResolution on // These are filled in with real values in Android_SetScreenResolution on
//init (before SDL_Main()) // init (before SDL_main())
static int iScreenWidth = 320; static Uint32 iScreenFormat = SDL_PIXELFORMAT_UNKNOWN;
static int iScreenHeight = 240; static int iScreenWidth = 0;
static int iScreenHeight = 0;
static int static int
...@@ -122,8 +123,7 @@ Android_VideoInit(_THIS) ...@@ -122,8 +123,7 @@ Android_VideoInit(_THIS)
{ {
SDL_DisplayMode mode; SDL_DisplayMode mode;
/* Use a fake 32-bpp desktop mode */ mode.format = iScreenFormat;
mode.format = SDL_PIXELFORMAT_BGR888;
mode.w = iScreenWidth; mode.w = iScreenWidth;
mode.h = iScreenHeight; mode.h = iScreenHeight;
mode.refresh_rate = 0; mode.refresh_rate = 0;
...@@ -146,11 +146,12 @@ Android_VideoQuit(_THIS) ...@@ -146,11 +146,12 @@ Android_VideoQuit(_THIS)
{ {
} }
void
void Android_SetScreenResolution(int width, int height){ Android_SetScreenResolution(int width, int height, Uint32 format)
{
iScreenWidth = width; iScreenWidth = width;
iScreenHeight = height; iScreenHeight = height;
iScreenFormat = format;
} }
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#endif /* _SDL_ndsvideo_h */ /* Called by the JNI layer when the screen changes size or format */
extern void Android_SetScreenResolution(int width, int height, Uint32 format);
#endif /* _SDL_androidvideo_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment