duncan
Mom and Dad were wrong!
Public Member Functions
client::GameState Class Reference

#include <gamestate.h>

Inheritance diagram for client::GameState:
Inheritance graph
[legend]
Collaboration diagram for client::GameState:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GameState ()
void resize (unsigned int, unsigned int)
void set_ip (const std::string &)
void set_name (const std::string &)
void set_dim (unsigned int, unsigned int)
void on_packet (net::data_t *, size_t, net::index_t)
void on_connect (net::index_t)
void on_disconnect (net::index_t)
void on_press (unsigned int, bool)
void on_release (unsigned int, bool)
void on_progress (double, double)
void on_push ()
void on_pop ()
void on_active ()
State::Action update ()
void draw ()

Detailed Description

The main game state.

Connect to a server and provide an interface for the user to player the game.

Author:
Harry Slatyer

see LICENSE


Constructor & Destructor Documentation

GameState::GameState ( )

Initialise members.


Member Function Documentation

void GameState::draw ( ) [virtual]

Draw the world and the chat.

Reimplemented from client::State.

void GameState::on_active ( ) [virtual]

Set action to default.

Reimplemented from client::State.

void GameState::on_connect ( net::index_t  peer) [virtual]

Handle a successful connection to the server.

Parameters:
peerpeer id of server

Reimplemented from net::PacketListener.

void GameState::on_disconnect ( net::index_t  peer) [virtual]

Handle a disconnection from the server.

Parameters:
peerpeer id of server

Reimplemented from net::PacketListener.

void GameState::on_packet ( net::data_t buf,
size_t  size,
net::index_t  peer 
) [virtual]

Handle any packets sent from the server.

Parameters:
bufpacket data
sizesize (in bytes) of the packet
peerpeer id of server (should be 0)

Reimplemented from net::PacketListener.

void GameState::on_pop ( ) [virtual]

Disconnect from the server when this state is popped.

Reimplemented from client::State.

void GameState::on_press ( unsigned int  wh,
bool  repeat 
) [virtual]

Handle key presses.

Parameters:
whpressed key
repeatwhether the keypress was due to auto-repeat

Reimplemented from client::InputListener.

void GameState::on_progress ( double  dlnow,
double  dltot 
) [virtual]

Display the progress of any downloads.

Parameters:
dlnowcurrent number of bytes downloaded
dltottotal size of file to be downloaded

Reimplemented from dl::DownloadListener.

void GameState::on_push ( ) [virtual]

Attempt to connect to the server when this state is pushed.

Reimplemented from client::State.

void GameState::on_release ( unsigned int  wh,
bool  repeat 
) [virtual]

Handle key releases.

Parameters:
whreleased key
repeatwhether the key release was due to auto-repeat

Reimplemented from client::InputListener.

void GameState::resize ( unsigned int  r,
unsigned int  c 
) [virtual]

Resize the windows.

Parameters:
rnumber of rows
cnumber of columns

Reimplemented from client::State.

void GameState::set_dim ( unsigned int  r,
unsigned int  c 
)

Set the dimensions of the window.

Parameters:
rnumber of rows
cnumber of columns
void GameState::set_ip ( const std::string &  str)

Set the IP address of the server.

Parameters:
strIP address of the server
void GameState::set_name ( const std::string &  str)

Set the player's name.

Parameters:
strname of player
State::Action GameState::update ( ) [virtual]

Update the connection in order to receive any packets.

Reimplemented from client::State.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations