mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 10:58:42 +00:00
* refactoring #1012: Format specifiers should be used instead of string concatenation. * refactoring #1012: Format specifiers should be used instead of string concatenation. * refactoring #1012: Remove isInfoEnabled check
This commit is contained in:
@@ -39,12 +39,10 @@ public abstract class GameLoop {
|
||||
|
||||
protected final GameController controller;
|
||||
|
||||
private Thread gameThread;
|
||||
|
||||
/**
|
||||
* Initialize game status to be stopped.
|
||||
*/
|
||||
public GameLoop() {
|
||||
protected GameLoop() {
|
||||
controller = new GameController();
|
||||
status = GameStatus.STOPPED;
|
||||
}
|
||||
@@ -54,7 +52,7 @@ public abstract class GameLoop {
|
||||
*/
|
||||
public void run() {
|
||||
status = GameStatus.RUNNING;
|
||||
gameThread = new Thread(this::processGameLoop);
|
||||
Thread gameThread = new Thread(this::processGameLoop);
|
||||
gameThread.start();
|
||||
}
|
||||
|
||||
@@ -85,6 +83,8 @@ public abstract class GameLoop {
|
||||
Thread.sleep(lag);
|
||||
} catch (InterruptedException e) {
|
||||
logger.error(e.getMessage());
|
||||
/* Clean up whatever needs to be handled before interrupting */
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public abstract class GameLoop {
|
||||
*/
|
||||
protected void render() {
|
||||
var position = controller.getBulletPosition();
|
||||
logger.info("Current bullet position: " + position);
|
||||
logger.info("Current bullet position: {}", position);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user