public abstract class PortableApplication extends Object implements TouchInterface, KeyboardInterface, GameInterface, GestureInterface
gdx2d applications.
To get the functionality required you simply have to overload the required methods.TouchInterface,
KeyboardInterface,
GameInterface| Modifier and Type | Field and Description |
|---|---|
static boolean |
CreateLwjglApplication |
protected boolean |
onAndroid
Deprecated.
|
| Constructor and Description |
|---|
PortableApplication()
Creates an application using
gdx2d. |
PortableApplication(boolean onAndroid)
Deprecated.
|
PortableApplication(boolean onAndroid,
int width,
int height)
Deprecated.
|
PortableApplication(boolean onAndroid,
int width,
int height,
boolean fullScreen)
Deprecated.
|
PortableApplication(int width,
int height)
Creates an application using
gdx2d. |
PortableApplication(int width,
int height,
boolean fullScreen)
Create a full-screen
gdx2d application. |
| Modifier and Type | Method and Description |
|---|---|
void |
exit()
Schedule an exit from the application.
|
AndroidResolver |
getAndroidResolver()
Return the
AndroidResolver to use Android actions. |
int |
getWindowHeight()
Rendering surface information
|
int |
getWindowWidth()
Rendering surface information
|
boolean |
onAndroid()
Detect android
|
void |
onClick(int x,
int y,
int button)
Invoked when the pointer (mouse or touch) is pressed (once).
|
void |
onDispose()
Called when the application stops.
|
void |
onDrag(int x,
int y)
Invoked when the pointer (mouse or touch) is moved and down.
|
void |
onFling(float velocityX,
float velocityY,
int button)
Called when the user dragged a finger over the screen and lifted it.
|
void |
onGameLogicUpdate()
Called when the logic has to be updated.
|
void |
onKeyDown(int keycode)
Invoked when a key is typed.
|
void |
onKeyUp(int keycode)
Invoked when a key is released.
|
void |
onLongPress(float x,
float y)
Called on long press on Android.
|
void |
onPan(float x,
float y,
float deltaX,
float deltaY)
Called when the user drags a finger over the screen on Android.
|
void |
onPause()
Invoked when the application is paused.
|
void |
onPinch(Vector2 initialPointer1,
Vector2 initialPointer2,
Vector2 pointer1,
Vector2 pointer2)
Called when a user performs a pinch zoom gesture on Android.
|
void |
onRelease(int x,
int y,
int button)
Invoked when the pointer (mouse or touch) is released.
|
void |
onResume()
Called when the application is restarted.
|
void |
onScroll(int amount)
Invoked when the mouse scroll (wheel) has been moved.
|
void |
onTap(float x,
float y,
int count,
int button)
Invoked for a tap gesture on Android.
|
void |
onZoom(float initialDistance,
float distance)
Called when the user performs a pinch zoom gesture on Android.
|
void |
setAndroidResolver(AndroidResolver resolver)
Set the
AndroidResolver when the application is created on
Android. |
void |
setTitle(String title)
Change the title of the application window (works only on desktop).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonGraphicRender, onInit@Deprecated protected final boolean onAndroid
public static boolean CreateLwjglApplication
@Deprecated public PortableApplication(boolean onAndroid)
gdx2d.
Use a default windows size.onAndroid - true if running on Android, false otherwisepublic PortableApplication()
gdx2d.
Use a default windows size.@Deprecated public PortableApplication(boolean onAndroid, int width, int height)
gdx2d.
Screen dimension are ignored when running on Android.onAndroid - true if running on Android, false otherwisewidth - The width of the screen (only for desktop)height - The height of the screen (only for desktop)public PortableApplication(int width,
int height)
gdx2d.
Screen dimension are ignored when running on Android.width - The width of the screen (only for desktop)height - The height of the screen (only for desktop)public PortableApplication(int width,
int height,
boolean fullScreen)
gdx2d application.width - The width of the screenheight - The height of the screenfullScreen - Indicates if the application should be launched full
screen on desktop, or in default resolution@Deprecated public PortableApplication(boolean onAndroid, int width, int height, boolean fullScreen)
gdx2d, running full screen or not on desktop.
Screen dimension are ignored when running on Android.onAndroid - true if running on Android, false otherwisewidth - The width of the screen (only for desktop)height - The height of the screen (only for desktop)fullScreen - true to create a fullscreen application (only for desktop)public boolean onAndroid()
public void setTitle(String title)
title - the application titlepublic int getWindowHeight()
public int getWindowWidth()
public void exit()
onPause() and onDispose() some time in the future,
it will not immediately finish your application.public void onClick(int x,
int y,
int button)
TouchInterfaceInput.Buttons.LEFT.onClick in interface TouchInterfacex - the screen X coordinate (origin is the lower left corner)y - the screen Y coordinate (origin is the lower left corner)button - Input.Buttons.LEFT or
Input.Buttons.RIGHT button clickedTouchInterface.onClick(int, int, int)public void onDrag(int x,
int y)
TouchInterfaceonDrag in interface TouchInterfacex - the screen X coordinate (origin is the lower left corner)y - the screen Y coordinate (origin is the lower left corner)TouchInterface.onDrag(int, int)public void onRelease(int x,
int y,
int button)
TouchInterfaceInput.Buttons.LEFT.onRelease in interface TouchInterfacex - the screen X coordinate (origin is the lower left corner)y - the screen Y coordinate (origin is the lower left corner)button - Input.Buttons.LEFT or
Input.Buttons.RIGHT button clickedTouchInterface.onRelease(int, int, int)public void onScroll(int amount)
TouchInterfaceonScroll in interface TouchInterfaceamount - the scroll amountTouchInterface.onScroll(int)public void onKeyDown(int keycode)
KeyboardInterfaceInput.Keys to read the key code.onKeyDown in interface KeyboardInterfacekeycode - the code key, see Input.KeysKeyboardInterface.onKeyDown(int)public void onKeyUp(int keycode)
KeyboardInterfaceInput.Keys to read the key code.onKeyUp in interface KeyboardInterfacekeycode - the code key, see Input.KeysKeyboardInterface.onKeyUp(int)public void onDispose()
GameInterfaceonDispose in interface GameInterfaceGameInterface.onDispose()public void onPause()
GameInterfaceonPause in interface GameInterfaceGameInterface.onPause()public void onGameLogicUpdate()
GameInterfaceonGameLogicUpdate in interface GameInterfaceGameInterface.onGameLogicUpdate()public void onResume()
GameInterfaceonResume in interface GameInterfaceGameInterface.onResume()public void onZoom(float initialDistance,
float distance)
GestureInterfaceonZoom in interface GestureInterfaceinitialDistance - distance between fingers when the gesture starteddistance - current distance between fingersGestureInterface.onZoom(float, float)public void onTap(float x,
float y,
int count,
int button)
GestureInterfaceonTap in interface GestureInterfacex - the screen X coordinate (origin is the lower left corner)y - the screen Y coordinate (origin is the lower left corner)count - the number of tapsbutton - Input.Buttons.LEFT or
Input.Buttons.RIGHT button clickedGestureInterface.onTap(float, float, int, int)public void onPinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2)
GestureInterfaceonPinch in interface GestureInterfaceinitialPointer1 - finger 1 initial positioninitialPointer2 - finger 2 initial positionpointer1 - finger 1 current positionpointer2 - finger 2 current positionGestureInterface.onPinch(Vector2, Vector2, Vector2, Vector2)public void onPan(float x,
float y,
float deltaX,
float deltaY)
GestureInterfaceonPan in interface GestureInterfacex - the screen X coordinate (origin is the lower left corner)y - the screen Y coordinate (origin is the lower left corner)deltaX - the difference in pixels to the last drag event on xdeltaY - the difference in pixels to the last drag event on yGestureInterface.onPan(float, float, float, float)public void onLongPress(float x,
float y)
GestureInterfaceonLongPress in interface GestureInterfacex - the screen X coordinate (origin is the lower left corner)y - the screen Y coordinate (origin is the lower left corner)GestureInterface.onLongPress(float, float)public void onFling(float velocityX,
float velocityY,
int button)
GestureInterfaceonFling in interface GestureInterfacevelocityX - velocity on the X axis in secondsvelocityY - velocity on the Y axis in secondsbutton - Input.Buttons.LEFT or
Input.Buttons.RIGHT button clickedGestureInterface.onFling(float, float, int)public AndroidResolver getAndroidResolver()
AndroidResolver to use Android actions.public void setAndroidResolver(AndroidResolver resolver)
AndroidResolver when the application is created on
Android. The resolver must be create in an Android Activity with its
Contextresolver - the Android resolverCopyright © 2014-2016 gdx2d - https://github.com/hevs-isi/gdx2d