SDL.java 925 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package org.libsdl.app;
  2. import android.content.Context;
  3. /**
  4. SDL library initialization
  5. */
  6. public class SDL {
  7. // This function should be called first and sets up the native code
  8. // so it can call into the Java classes
  9. public static void setupJNI() {
  10. SDLActivity.nativeSetupJNI();
  11. SDLAudioManager.nativeSetupJNI();
  12. SDLControllerManager.nativeSetupJNI();
  13. }
  14. // This function should be called each time the activity is started
  15. public static void initialize() {
  16. setContext(null);
  17. SDLActivity.initialize();
  18. SDLAudioManager.initialize();
  19. SDLControllerManager.initialize();
  20. }
  21. // This function stores the current activity (SDL or not)
  22. public static void setContext(Context context) {
  23. mContext = context;
  24. }
  25. public static Context getContext() {
  26. return mContext;
  27. }
  28. protected static Context mContext;
  29. }