#include <testGame.h>
TestGame maintains a list of all the Player and Building objects in the playing area, and interfaces with the specific platform's windowing system to respond to user input and render the current game display.
Public Member Functions | |
TestGame (bool server, const TNL::Address &bindAddress, const TNL::Address &pingAddress) | |
Constructor for TestGame, determines whether this game will be a client or a server, and what addresses to bind to and ping. | |
~TestGame () | |
Destroys a game, freeing all Player and Building objects associated with it. | |
void | createLocalConnection (TestGame *serverGame) |
createLocalConnection demonstrates the use of so-called "short circuit" connections for connecting to a server NetInterface in the same process as this client game. | |
void | tick () |
Called periodically by the platform windowing code, tick will update all the players in the simulation as well as tick() the game's network interface. | |
void | renderFrame (int width, int height) |
renderFrame is called by the platform windowing code to notify the game that it should render the current world using the specified window area. | |
void | moveMyPlayerTo (Position newPosition) |
moveMyPlayerTo is called by the platform windowing code in response to user input. | |
Data Fields | |
TNL::Vector< Player * > | players |
vector of player objects in the game | |
TNL::Vector< Building * > | buildings |
vector of buildings in the game | |
bool | isServer |
was this game created to be a server? | |
TestNetInterface * | myNetInterface |
network interface for this game | |
TNL::U32 | lastTime |
last time that tick() was called | |
TNL::SafePtr< Player > | serverPlayer |
the player that the server controls | |
TNL::SafePtr< Player > | clientPlayer |
the player that this client controls, if this game is a client |
|
Constructor for TestGame, determines whether this game will be a client or a server, and what addresses to bind to and ping. If this game is a server, it will construct 50 random buildings and 15 random AI players to populate the "world" with. TestGame also constructs an AsymmetricKey to demonstrate establishing secure connections with clients and servers. |
|
Destroys a game, freeing all Player and Building objects associated with it.
|
|
createLocalConnection demonstrates the use of so-called "short circuit" connections for connecting to a server NetInterface in the same process as this client game.
|
|
Called periodically by the platform windowing code, tick will update all the players in the simulation as well as tick() the game's network interface.
|
|
renderFrame is called by the platform windowing code to notify the game that it should render the current world using the specified window area.
|
|
moveMyPlayerTo is called by the platform windowing code in response to user input.
|
|
vector of player objects in the game
|
|
vector of buildings in the game
|
|
was this game created to be a server?
|
|
network interface for this game
|
|
last time that tick() was called
|
|
the player that the server controls
|
|
the player that this client controls, if this game is a client
|