Mercurial > sdl-ios-xcode
diff android-project/src/org/libsdl/app/SDLActivity.java @ 4998:a514bfe6952a
The window is changed to reflect the actual screen dimensions, for now.
Implemented SDL_SetWindowTitle(), which turned out to be fairly complex
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 13 Jan 2011 15:10:17 -0800 |
parents | 8d7315668e35 |
children | c66b2a778b7e |
line wrap: on
line diff
--- a/android-project/src/org/libsdl/app/SDLActivity.java Thu Jan 13 12:36:59 2011 -0800 +++ b/android-project/src/org/libsdl/app/SDLActivity.java Thu Jan 13 15:10:17 2011 -0800 @@ -67,6 +67,25 @@ super.onResume(); } + // Messages from the SDLMain thread + static int COMMAND_CHANGE_TITLE = 1; + + // Handler for the messages + Handler commandHandler = new Handler() { + public void handleMessage(Message msg) { + if (msg.arg1 == COMMAND_CHANGE_TITLE) { + setTitle((String)msg.obj); + } + } + }; + + // Send a message from the SDLMain thread + void sendCommand(int command, Object data) { + Message msg = commandHandler.obtainMessage(); + msg.arg1 = command; + msg.obj = data; + commandHandler.sendMessage(msg); + } // C functions we call public static native void nativeInit(); @@ -81,7 +100,8 @@ // Java functions called from C - private static void createGLContext() { + + public static void createGLContext() { mSurface.initEGL(); } @@ -89,6 +109,11 @@ mSurface.flipEGL(); } + public static void setActivityTitle(String title) { + // Called from SDLMain() thread and can't directly affect the view + mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title); + } + // Audio private static Object buf; @@ -177,7 +202,7 @@ } mAudioThread = null; - Log.v("SDL", "Finished waiting for audio thread"); + //Log.v("SDL", "Finished waiting for audio thread"); } if (mAudioTrack != null) {