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 @@
extern "C" {
#include "events/SDL_events_c.h"
#include "video/android/SDL_androidkeyboard.h"
#include "video/android/SDL_androidvideo.h"
}
/*******************************************************************************
......@@ -49,9 +50,6 @@ jmethodID midFlipBuffers;
jmethodID midEnableFeature;
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
bool bRenderingEnabled = false;
......@@ -145,21 +143,12 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeQuit( JNIEnv* env,
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
extern "C" void Java_org_libsdl_app_SDLActivity_onNativeResize(
JNIEnv* env, jobject obj, jint width,
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(
......@@ -229,3 +218,5 @@ extern "C" void Android_UpdateAudioBuffer(unsigned char *buf, int len)
__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);
/* Android driver bootstrap functions */
//These are filled in with real values in Android_SetScreenResolution on
//init (before SDL_Main())
static int iScreenWidth = 320;
static int iScreenHeight = 240;
// These are filled in with real values in Android_SetScreenResolution on
// init (before SDL_main())
static Uint32 iScreenFormat = SDL_PIXELFORMAT_UNKNOWN;
static int iScreenWidth = 0;
static int iScreenHeight = 0;
static int
......@@ -122,8 +123,7 @@ Android_VideoInit(_THIS)
{
SDL_DisplayMode mode;
/* Use a fake 32-bpp desktop mode */
mode.format = SDL_PIXELFORMAT_BGR888;
mode.format = iScreenFormat;
mode.w = iScreenWidth;
mode.h = iScreenHeight;
mode.refresh_rate = 0;
......@@ -146,11 +146,12 @@ Android_VideoQuit(_THIS)
{
}
void Android_SetScreenResolution(int width, int height){
void
Android_SetScreenResolution(int width, int height, Uint32 format)
{
iScreenWidth = width;
iScreenHeight = height;
iScreenFormat = format;
}
/* vi: set ts=4 sw=4 expandtab: */
......@@ -26,6 +26,9 @@
#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: */
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