Drag[en]gine Script Module DragonScript Script API  1.0
Game Class Reference

Base game class. More...

Inheritance diagram for Game:

Public Member Functions

Management
void initGame ()
 Called by game engine to init game. More...
 
void cleanUp ()
 Called by the game engine to clean up before the game exits. More...
 
void eventKeyPress (int keycode, int modifiers, int keychar)
 Process key press event. More...
 
void eventKeyRelease (int keycode, int modifiers, int keychar)
 Process key release event. More...
 
void eventKeyType (int keycode, int modifiers, int keychar)
 Process key type event. More...
 
void eventMousePress (int button, int modifiers)
 Process mouse button press event. More...
 
void eventMouseRelease (int button, int modifiers)
 Process mouse button release event. More...
 
void eventMouseRelease (int dx, int dy, int button, int modifiers)
 Process mouse button move event. More...
 
void onFrameUpdate ()
 Called by the game engine at the beginning of each frame update. More...
 
void onResizeRenderWindow ()
 Size of the render window changed. More...
 
void resourceLoaded (String path, int resourceType, Object resource)
 A resource finsished loading in the background. More...
 
int getArgumentCount ()
 Number of command line arguments given to the game. More...
 
String getArgumentAt (int index)
 Command line argument given to the game. More...
 

Protected Member Functions

Constructors
Game new ()
 Create game. More...
 

Detailed Description

Base game class.

This is the basic game object for your game application. You have to create a single subclass. of this class handling your game. The DragonScript script module examines all scripts for the presence of this one subclass and creates a single instance from it. The single instance is also available from Engine.getGame().

This is a native class. You have to subclass this class exactly once.

Author
Roland Pl├╝ss
Version
1.0
Date
2015

Member Function Documentation

§ cleanUp()

void cleanUp ( )

Called by the game engine to clean up before the game exits.

Make sure to free all data acquired during the run of the game. This is the last method called in the script before the engine terminates.

§ eventKeyPress()

void eventKeyPress ( int  keycode,
int  modifiers,
int  keychar 
)

Process key press event.

§ eventKeyRelease()

void eventKeyRelease ( int  keycode,
int  modifiers,
int  keychar 
)

Process key release event.

§ eventKeyType()

void eventKeyType ( int  keycode,
int  modifiers,
int  keychar 
)

Process key type event.

§ eventMousePress()

void eventMousePress ( int  button,
int  modifiers 
)

Process mouse button press event.

§ eventMouseRelease() [1/2]

void eventMouseRelease ( int  button,
int  modifiers 
)

Process mouse button release event.

§ eventMouseRelease() [2/2]

void eventMouseRelease ( int  dx,
int  dy,
int  button,
int  modifiers 
)

Process mouse button move event.

§ getArgumentAt()

String getArgumentAt ( int  index)

Command line argument given to the game.

Exceptions
EOutOfBoundaryindex is less than 0 or larger than or equal to getArgumentCount().

§ getArgumentCount()

int getArgumentCount ( )

Number of command line arguments given to the game.

§ initGame()

void initGame ( )

Called by game engine to init game.

This function has to load all data needed to start working. Do not enter a loop inside this method. The game engine handles the game loop.

§ new()

Game new ( )
protected

Create game.

§ onFrameUpdate()

void onFrameUpdate ( )

Called by the game engine at the beginning of each frame update.

Use this method to advance your game by Engine.getElapsedTime() seconds.

§ onResizeRenderWindow()

void onResizeRenderWindow ( )

Size of the render window changed.

§ resourceLoaded()

void resourceLoaded ( String  path,
int  resourceType,
Object  resource 
)

A resource finsished loading in the background.

This method is called if you use asynchronois resource file loading like for example Model.loadAsynchron(). If loading failed resource is null.


The documentation for this class was generated from the following file: