Class GameBase
java.lang.Object
GameBase
- All Implemented Interfaces:
 Runnable
- Direct Known Subclasses:
 Gameplay
Main class of game.
 Responsibility: main loop, game objects and window.
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddKeyListener(KeyListener listener)Add new key listener.protected voidScene awake on open the game.voiddestroy(GameObject gameObject)Destroy gameobject and invoke OnDestroy().voidfinish()Stop and finish main loop.protected floatDeltaTime of current frame.Get gameobjects in gameplay.voidinitialize(GameObject gameObject)Initialize gameobject on gameplay.protected voidDestroy scene after game objects.protected voidopenWindow(int widthOfWindow, int heightOfWindow, String title)protected voidRender scenes before game objects.voidrun()Main loop of game.protected voidInvoke before main loop.protected voidUpdate scene before game objects. 
- 
Field Details
- 
DEFAULT_WIDTH_OF_WINDOW
public static final int DEFAULT_WIDTH_OF_WINDOW- See Also:
 - Constant Field Values
 
 - 
DEFAULT_HEIGHT_OF_WINDOW
public static final int DEFAULT_HEIGHT_OF_WINDOW- See Also:
 - Constant Field Values
 
 - 
DESIRED_FPS
public final long DESIRED_FPS- See Also:
 - Constant Field Values
 
 - 
DESIRED_DELTA_LOOP
public final long DESIRED_DELTA_LOOP- See Also:
 - Constant Field Values
 
 - 
frame
 
 - 
 - 
Constructor Details
- 
GameBase
public GameBase()Awake of game. 
 - 
 - 
Method Details
- 
initialize
Initialize gameobject on gameplay. - 
destroy
Destroy gameobject and invoke OnDestroy(). - 
addKeyListener
Add new key listener.- Parameters:
 listener- - new key listener.
 - 
run
public void run()Main loop of game. - 
finish
public void finish()Stop and finish main loop. - 
getGameObjects
Get gameobjects in gameplay. - 
getDeltaTime
protected float getDeltaTime()DeltaTime of current frame. - 
openWindow
- Parameters:
 widthOfWindow-heightOfWindow-title-
 - 
awakeScene
protected void awakeScene()Scene awake on open the game. - 
startScene
protected void startScene()Invoke before main loop. - 
updateScene
protected void updateScene()Update scene before game objects. - 
onDestroyScene
protected void onDestroyScene()Destroy scene after game objects. - 
renderScene
Render scenes before game objects.- Parameters:
 g- - Graphics2D
 
 -