The window is changed to reflect the actual screen dimensions, for now.

Implemented SDL_SetWindowTitle(), which turned out to be fairly complex
This commit is contained in:
Sam Lantinga 2011-01-13 15:10:17 -08:00
parent 82e985a8ba
commit 9fa1d4876d
8 changed files with 180 additions and 43 deletions

View file

@ -67,6 +67,25 @@ public class SDLActivity extends Activity {
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 @@ public class SDLActivity extends Activity {
// Java functions called from C
private static void createGLContext() {
public static void createGLContext() {
mSurface.initEGL();
}
@ -89,6 +109,11 @@ public class SDLActivity extends Activity {
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 @@ public class SDLActivity extends Activity {
}
mAudioThread = null;
Log.v("SDL", "Finished waiting for audio thread");
//Log.v("SDL", "Finished waiting for audio thread");
}
if (mAudioTrack != null) {