public abstract class Game
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
private static Display |
display |
|
private static boolean |
drawDebug |
|
private static double |
fps |
|
private static InputHandler |
inputHandler |
|
private static desertcookie.util.LogWriter |
logWriter |
|
private static double |
maxFps |
|
private static double |
maxTps |
|
private static boolean |
run |
|
private static GameSceneHandler |
sceneHandler |
|
private static double |
tps |
Constructor | Description |
---|---|
Game() |
Konstruiert neues Game mit Standardwerten für FPS- und TPS-Limit von 60Hz.
|
Modifier and Type | Method | Description |
---|---|---|
private static void |
drawDebug(SimpleGraphics graphics) |
Rendert ein einfaches Debug-Menü.
|
static Display |
getDisplay() |
|
boolean |
getDrawDebug() |
|
static double |
getFps() |
|
static InputHandler |
getInputHandler() |
|
static desertcookie.util.LogWriter |
getLogWriter() |
|
double |
getMaxFps() |
|
double |
getMaxTps() |
|
static GameSceneHandler |
getSceneHandler() |
|
static double |
getTps() |
|
boolean |
isRunning() |
|
private static void |
renderLoop() |
Render Loop (Game Loop 1).
|
void |
setDrawDebug(boolean drawDebug) |
Setzt die Eigenschaft des Spiels, ob ein einfaches Debug-Menü mit TPS, FPS und Cursorposition gerendert werden soll.
|
void |
setMaxFps(double maxFps) |
Setzt die Anzahl der maximal zugelassenen Bilder pro Sekunde.
|
void |
setMaxTps(double maxTps) |
Setzt die Anzahl der maximal zugelassenen Ticks pro Sekunde.
|
private static void |
sleep(long time) |
Lässt den aufrufenden Thread für die angegebene Zeit pausieren.
|
void |
startGame() |
Startet das Spiel.
|
static void |
stopGame() |
Stoppt das Spiel.
|
private static void |
updateLoop() |
Update Loop (Game Loop 2).
|
private static Display display
private static GameSceneHandler sceneHandler
private static InputHandler inputHandler
private static desertcookie.util.LogWriter logWriter
private static boolean run
private static double maxTps
private static double maxFps
private static double tps
private static double fps
private static boolean drawDebug
public Game()
public static Display getDisplay()
public static GameSceneHandler getSceneHandler()
public static InputHandler getInputHandler()
public static desertcookie.util.LogWriter getLogWriter()
public static double getTps()
public static double getFps()
public boolean isRunning()
true
wenn der Game Loop momentan läuft.public double getMaxTps()
public void setMaxTps(double maxTps)
maxTps
- Maximale Ticks pro Sekundepublic double getMaxFps()
public void setMaxFps(double maxFps)
maxFps
- Maximale Bilder pro Sekundepublic boolean getDrawDebug()
true
wenn das Debug-Menü gerendert werden soll.public void setDrawDebug(boolean drawDebug)
drawDebug
- true
um das Debug-Menü gerendert werden sollpublic void startGame()
public static void stopGame()
private static void updateLoop()
private static void renderLoop()
private static void sleep(long time)
time
- Zeit in Nanosekundenprivate static void drawDebug(SimpleGraphics graphics)
graphics
- Schnittstelle für Rendering