Danbias/Code/Game/GameClient/GameClientState/GameClientState.h

57 lines
1.5 KiB
C
Raw Normal View History

#ifndef DANBIAS_CLIENT_GAMECLIENTSTATE_H
#define DANBIAS_CLIENT_GAMECLIENTSTATE_H
#define NOMINMAX
2014-02-17 11:27:43 +01:00
#include "SharedStateContent.h"
2014-02-11 14:47:57 +01:00
namespace DanBias { namespace Client
{
2014-02-12 10:43:06 +01:00
class GameClientState
2013-12-13 12:02:49 +01:00
{
2014-02-11 14:47:57 +01:00
public:
enum ClientState
{
2014-02-14 14:31:01 +01:00
ClientState_Main,
2014-02-11 14:47:57 +01:00
ClientState_Lan,
2014-02-13 13:30:14 +01:00
ClientState_Lobby,
2014-02-12 16:31:15 +01:00
ClientState_LobbyCreate,
2014-02-13 13:30:14 +01:00
ClientState_LobbyReady,
2014-02-14 14:31:01 +01:00
ClientState_NetLoad,
2014-02-11 14:47:57 +01:00
ClientState_Game,
ClientState_Same,
2014-02-12 16:31:15 +01:00
ClientState_Quit
2014-02-11 14:47:57 +01:00
};
typedef ::Oyster::Network::NetEvent<::Oyster::Network::NetworkClient*, ::Oyster::Network::NetworkClient::ClientEventArgs> NetEvent;
static const NetEvent event_processed;
2014-02-17 11:27:43 +01:00
GameClientState();
virtual ~GameClientState();
virtual bool Init( SharedStateContent &shared ) = 0;
virtual ClientState Update( float deltaTime ) = 0;
2014-02-11 14:47:57 +01:00
virtual bool Render() = 0;
virtual bool Release() = 0;
2014-02-12 16:31:15 +01:00
virtual void ChangeState( ClientState next ) = 0;
2014-02-12 10:43:06 +01:00
/******************************************************************
* @param message of the event
2014-02-19 13:15:19 +01:00
* @return message or a reference to GameClientState::event_processed.
******************************************************************/
virtual const NetEvent & DataRecieved( const NetEvent &message );
2014-02-11 14:47:57 +01:00
};
} }
namespace Utility { namespace DynamicMemory
{ // template specializationto allowuse of dynamicmemory tools
template<>
inline void SafeDeleteInstance( ::DanBias::Client::GameClientState *dynamicInstance )
{
if( dynamicInstance )
{
dynamicInstance->Release();
delete dynamicInstance;
}
}
} }
#endif