project_files/Android-build/SDL-android-project/src/org/hedgewars/SDLActivity.java
equal
deleted
inserted
replaced
1 package org.hedgewars; |
1 package org.hedgewars; |
2 |
|
3 import java.io.IOException; |
|
4 import java.util.Iterator; |
|
5 import java.util.Map.Entry; |
|
6 |
2 |
7 import javax.microedition.khronos.egl.EGL10; |
3 import javax.microedition.khronos.egl.EGL10; |
8 import javax.microedition.khronos.egl.EGLConfig; |
4 import javax.microedition.khronos.egl.EGLConfig; |
9 import javax.microedition.khronos.egl.EGLContext; |
5 import javax.microedition.khronos.egl.EGLContext; |
10 import javax.microedition.khronos.egl.EGLDisplay; |
6 import javax.microedition.khronos.egl.EGLDisplay; |
37 */ |
33 */ |
38 public class SDLActivity extends Activity { |
34 public class SDLActivity extends Activity { |
39 |
35 |
40 // Main components |
36 // Main components |
41 private static SDLActivity mSingleton; |
37 private static SDLActivity mSingleton; |
42 private static SDLSurface mSurface; |
38 public static SDLSurface mSurface; |
43 |
39 |
44 // Audio |
40 // Audio |
45 private static Thread mAudioThread; |
41 private static Thread mAudioThread; |
46 private static AudioTrack mAudioTrack; |
42 private static AudioTrack mAudioTrack; |
47 |
43 |
231 |
227 |
232 /** |
228 /** |
233 Simple nativeInit() runnable |
229 Simple nativeInit() runnable |
234 */ |
230 */ |
235 class SDLMain implements Runnable { |
231 class SDLMain implements Runnable { |
|
232 private int surfaceWidth, surfaceHeight; |
|
233 public SDLMain(int width, int height){ |
|
234 surfaceWidth = width; |
|
235 surfaceHeight = height; |
|
236 } |
236 public void run() { |
237 public void run() { |
237 // Runs SDL_main() |
238 // Runs SDL_main() |
238 SDLActivity.nativeInit(new String[]{ "0", "533", "300", "0", "null", "xeli", "1", "1", "1", "0", "/sdcard/bla.hwd"}); |
239 |
|
240 SDLActivity.nativeInit(new String[]{ "0", String.valueOf(surfaceWidth), String.valueOf(surfaceHeight), "0", "null", "xeli", "1", "1", "1", "0", "/sdcard/bla.hwd"}); |
239 |
241 |
240 //Log.v("SDL", "SDL thread terminated"); |
242 //Log.v("SDL", "SDL thread terminated"); |
241 } |
243 } |
242 } |
244 } |
243 |
245 |
356 } |
358 } |
357 SDLActivity.onNativeResize(width, height, sdlFormat); |
359 SDLActivity.onNativeResize(width, height, sdlFormat); |
358 |
360 |
359 // Now start up the C app thread |
361 // Now start up the C app thread |
360 if (mSDLThread == null) { |
362 if (mSDLThread == null) { |
361 mSDLThread = new Thread(new SDLMain(), "SDLThread"); |
363 mSDLThread = new Thread(new SDLMain(width, height), "SDLThread"); |
362 mSDLThread.start(); |
364 mSDLThread.start(); |
363 } |
365 } |
364 } |
366 } |
365 |
367 |
366 // unused |
368 // unused |