FlixelAndroidLauncher
View sourceclass
org.flixelgdx.backend.android.FlixelAndroidLauncher
Launches the Android version of the FlixelGDX game.
The developer creates a subclass of FlixelGame and an Android launcher activity that extends AndroidApplication. In onCreate, create the game instance and call FlixelAndroidLauncher.launch(FlixelGame, AndroidApplication).
Constructors
FlixelAndroidLauncher()
Methods
launch(FlixelGame, AndroidApplication)
Launches the Android version of the game in RELEASE mode.
Parameters:
| Name | Description |
|---|---|
game | The game instance to launch. |
activity | The Android application activity. |
launch(FlixelGame, AndroidApplication, FlixelRuntimeMode)
Launches the Android version of the game with the given runtime mode.
Call this from the onCreate method of your AndroidApplication activity. Create your FlixelGame subclass instance and pass it here along with the activity (typically this).
Parameters:
| Name | Description |
|---|---|
game | The game instance to launch (e.g. new MyGame(...)). |
activity | The Android application activity (must extend AndroidApplication). |
runtimeMode | The FlixelRuntimeMode for this session (TEST, DEBUG, or RELEASE). |
launch(FlixelGame, AndroidApplication, FlixelRuntimeMode, Runnable)
Launches the Android version of the game with an optional pre-initialization callback.
onBeforeInitialize fires after all default FlixelGDX backend services (alerter, audio, etc.) have been registered but before Flixel.initialize is called. Use it to override any of those defaults without needing to duplicate the rest of the launcher wiring:
public class MyAndroidLauncher extends AndroidApplication {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FlixelAndroidLauncher.launch(
new MyGame("My Game", 800, 600, new InitialState()),
this,
FlixelRuntimeMode.RELEASE,
() -> Flixel.alerter = myCustomAlerter
);
}
}
Parameters:
| Name | Description |
|---|---|
game | The game instance to launch (e.g. new MyGame(...)). |
activity | The Android application activity (must extend AndroidApplication). |
runtimeMode | The FlixelRuntimeMode for this session (TEST, DEBUG, or RELEASE). |
onBeforeInitialize | Optional callback invoked just before Flixel.initialize. Pass null to skip. |