public class GameViewThread
extends java.lang.Thread
It is prohibited to run CPU-intensive work on the UI Thread in Android, so we launch this separate thread whenever the UI is ready, and take it down any time the UI becomes un-ready.
The main Game Activity for the app is responsible for configuring this thread with
a GameView.IGameLogicService
and GameView.IRedrawService
to pass along
the actual update() and draw() calls.
Constructor and Description |
---|
GameViewThread(android.view.SurfaceHolder holder,
GameView.IGameLogicService gameLogic,
GameView.IRedrawService redrawService) |
Modifier and Type | Method and Description |
---|---|
void |
gracefulStop() |
void |
queueEvent(GameView.UIEvent e)
UI Events arrive on the UI thread and must be handed off to the worker thread
|
void |
run() |
void |
setEventScalingFactors(float xfactor,
float yfactor)
Set factors to normalize user input event coordinates into range 0.0-1.0
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public GameViewThread(android.view.SurfaceHolder holder, GameView.IGameLogicService gameLogic, GameView.IRedrawService redrawService)
public void setEventScalingFactors(float xfactor, float yfactor)
public void queueEvent(GameView.UIEvent e)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void gracefulStop()