comparison src/SDL_android.cpp @ 4981:55b82067815b

Fill in the video mode with the correct screen format
author Sam Lantinga <slouken@libsdl.org>
date Wed, 12 Jan 2011 14:29:01 -0800
parents d9fdff945ec9
children 58b6bb4a45e9
comparison
equal deleted inserted replaced
4980:d9fdff945ec9 4981:55b82067815b
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 23
24 extern "C" { 24 extern "C" {
25 #include "events/SDL_events_c.h" 25 #include "events/SDL_events_c.h"
26 #include "video/android/SDL_androidkeyboard.h" 26 #include "video/android/SDL_androidkeyboard.h"
27 #include "video/android/SDL_androidvideo.h"
27 } 28 }
28 29
29 /******************************************************************************* 30 /*******************************************************************************
30 This file links the Java side of Android with libsdl 31 This file links the Java side of Android with libsdl
31 *******************************************************************************/ 32 *******************************************************************************/
46 //method signatures 47 //method signatures
47 jmethodID midCreateGLContext; 48 jmethodID midCreateGLContext;
48 jmethodID midFlipBuffers; 49 jmethodID midFlipBuffers;
49 jmethodID midEnableFeature; 50 jmethodID midEnableFeature;
50 jmethodID midUpdateAudio; 51 jmethodID midUpdateAudio;
51
52 extern "C" void Android_SetScreenResolution(int width, int height);
53 extern "C" int SDL_SendQuit();
54 52
55 //If we're not the active app, don't try to render 53 //If we're not the active app, don't try to render
56 bool bRenderingEnabled = false; 54 bool bRenderingEnabled = false;
57 55
58 //Feature IDs 56 //Feature IDs
143 141
144 // Inject a SDL_QUIT event 142 // Inject a SDL_QUIT event
145 SDL_SendQuit(); 143 SDL_SendQuit();
146 } 144 }
147 145
148 // Screen size
149 extern "C" void Java_org_libsdl_app_SDLActivity_nativeSetScreenSize(
150 JNIEnv* env, jobject obj, jint width, jint height)
151 {
152 __android_log_print(ANDROID_LOG_INFO, "SDL",
153 "SDL: Set screen size on init: %d/%d\n", width, height);
154 Android_SetScreenResolution(width, height);
155 }
156
157 // Resize 146 // Resize
158 extern "C" void Java_org_libsdl_app_SDLActivity_onNativeResize( 147 extern "C" void Java_org_libsdl_app_SDLActivity_onNativeResize(
159 JNIEnv* env, jobject obj, jint width, 148 JNIEnv* env, jobject obj, jint width,
160 jint height, jint format) 149 jint height, jint format)
161 { 150 {
162 /* FIXME: What is the relationship between this and the window? */ 151 Android_SetScreenResolution(width, height, format);
163 } 152 }
164 153
165 extern "C" void Java_org_libsdl_app_SDLActivity_onNativeAccel( 154 extern "C" void Java_org_libsdl_app_SDLActivity_onNativeAccel(
166 JNIEnv* env, jobject obj, 155 JNIEnv* env, jobject obj,
167 jfloat x, jfloat y, jfloat z) 156 jfloat x, jfloat y, jfloat z)
227 midUpdateAudio, arr ); 216 midUpdateAudio, arr );
228 217
229 __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL: invoked\n"); 218 __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL: invoked\n");
230 219
231 } 220 }
221
222 /* vi: set ts=4 sw=4 expandtab: */