ASR::Client Class Reference

#include <Client.h>

Collaboration diagram for ASR::Client:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Client (RenderWindow *window)
 ~Client ()
void createCamera ()
TeamcreateTeam (const String &teamName, const ColourValue &teamColor)

Private Member Functions

void _createGUI ()

Private Attributes

RTSCameramRTSCamera
RTSCameraUpdatermCameraUpdater
UnitSelectermUnitSelecter
TeammTeam
ClientUpdatermUpdater
RenderWindow * mWindow
CEGUI::OgreCEGUIRenderer * mGUIRenderer
CEGUI::System * mGUISystem
CEGUI::Window * mGUIWindow

Friends

class ClientUpdater

Detailed Description

Definition at line 25 of file Client.h.


Constructor & Destructor Documentation

ASR::Client::Client ( RenderWindow *  window  ) 

Definition at line 23 of file Client.cpp.

References mGUIRenderer, mGUISystem, mGUIWindow, mTeam, mUnitSelecter, and mUpdater.

00024                 : mWindow ( window )
00025         {
00026                 // GUI
00027                 mGUIRenderer = NULL;
00028                 mGUISystem = NULL;
00029                 mGUIWindow = NULL;
00030 
00031                 mTeam = NULL;
00032                 mUnitSelecter = NULL;
00033                 mUpdater = NULL;
00034         }

ASR::Client::~Client (  ) 

Definition at line 38 of file Client.cpp.

References mCameraUpdater, mGUIRenderer, mGUISystem, mGUIWindow, mRTSCamera, mUnitSelecter, and mUpdater.

00039         {
00040                 // GUI
00041                 if ( mGUIWindow )
00042                         CEGUI::WindowManager::getSingleton().destroyWindow( mGUIWindow );
00043                 if ( mGUISystem )
00044                         delete mGUISystem;
00045                 if ( mGUIRenderer )
00046                         delete mGUIRenderer;
00047 
00048                 delete mUnitSelecter;
00049                 delete mUpdater;
00050 
00051                 delete mCameraUpdater;
00052                 delete mRTSCamera;
00053         }


Member Function Documentation

void ASR::Client::_createGUI (  )  [private]

Definition at line 76 of file Client.cpp.

References ASR::Game::getSingleton(), mGUIRenderer, mGUISystem, mGUIWindow, and mWindow.

Referenced by createCamera().

00077         {
00078                 mGUIRenderer = new CEGUI::OgreCEGUIRenderer ( mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, Game::getSingleton ().getSceneManager () );
00079                 mGUISystem = new CEGUI::System ( mGUIRenderer );
00080 
00081                 CEGUI::Logger::getSingleton().setLoggingLevel( CEGUI::Informative );
00082 
00083                 CEGUI::SchemeManager::getSingleton().loadScheme ( (CEGUI::utf8*)"TaharezLook.scheme" );
00084                 mGUISystem->setDefaultMouseCursor( (CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*) "MouseArrow" );
00085                 mGUISystem->setDefaultFont( (CEGUI::utf8*)"Tahoma-12" );
00086 
00087                 mGUIWindow = CEGUI::WindowManager::getSingleton().createWindow ( (CEGUI::utf8*)"DefaultWindow", (CEGUI::utf8*)"Sheet");
00088                 mGUISystem->setGUISheet( mGUIWindow );
00089         }

void ASR::Client::createCamera (  ) 

Definition at line 57 of file Client.cpp.

References _createGUI(), ASR::Game::addUpdater(), ASR::RTSCamera::getCamera(), ASR::Game::getSingleton(), mCameraUpdater, mGUIRenderer, mRTSCamera, mWindow, and ASR::RTSCamera::setAspectRatio().

Referenced by TutorialApplication::createCamera().

00058         {
00059                 mRTSCamera = new RTSCamera ( Game::getSingleton ().getSceneManager () );
00060 
00061                 // Create one viewport, entire window
00062                 Viewport* vp = mWindow->addViewport(mRTSCamera->getCamera());
00063                 vp->setBackgroundColour(ColourValue(0.1,0.1,0.1));
00064 
00065                 // Alter the camera aspect ratio to match the viewport
00066                 mRTSCamera->setAspectRatio( Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
00067 
00068                 _createGUI ();
00069 
00070                 mCameraUpdater = new RTSCameraUpdater ( mRTSCamera, mGUIRenderer );
00071                 Game::getSingleton ().addUpdater ( mCameraUpdater );
00072         }

Team * ASR::Client::createTeam ( const String &  teamName,
const ColourValue &  teamColor 
)

Definition at line 93 of file Client.cpp.

References ASR::Game::addUpdater(), ClientUpdater, ASR::Level::createTeam(), ASR::RTSCamera::getCamera(), ASR::Game::getSingleton(), ASR::Level::getSingleton(), mRTSCamera, mTeam, mUnitSelecter, and mUpdater.

Referenced by TutorialApplication::_createTeamA().

00094         {
00095                 OgreAssert ( mTeam == NULL, "Client already has a team" );
00096 
00097                 mTeam = Level::getSingleton().createTeam ( teamName, teamColor );
00098 
00099                 mUnitSelecter = new UnitSelecter ( mTeam, mRTSCamera->getCamera() );
00100                 Game::getSingleton ().addUpdater ( mUnitSelecter );
00101 
00102                 mUpdater = new ClientUpdater ( this );
00103                 Game::getSingleton ().addUpdater ( mUpdater );
00104 
00105                 return mTeam;
00106         }


Friends And Related Function Documentation

friend class ClientUpdater [friend]

Definition at line 27 of file Client.h.

Referenced by createTeam().


Member Data Documentation

RTSCameraUpdater* ASR::Client::mCameraUpdater [private]

Definition at line 33 of file Client.h.

Referenced by createCamera(), and ~Client().

CEGUI::OgreCEGUIRenderer* ASR::Client::mGUIRenderer [private]

Definition at line 42 of file Client.h.

Referenced by _createGUI(), Client(), createCamera(), and ~Client().

CEGUI::System* ASR::Client::mGUISystem [private]

Definition at line 43 of file Client.h.

Referenced by _createGUI(), Client(), and ~Client().

CEGUI::Window* ASR::Client::mGUIWindow [private]

Definition at line 44 of file Client.h.

Referenced by _createGUI(), Client(), and ~Client().

RTSCamera* ASR::Client::mRTSCamera [private]

Definition at line 32 of file Client.h.

Referenced by createCamera(), createTeam(), and ~Client().

Team* ASR::Client::mTeam [private]

Definition at line 36 of file Client.h.

Referenced by ASR::ClientUpdater::_findVisibleObjects(), Client(), and createTeam().

UnitSelecter* ASR::Client::mUnitSelecter [private]

Definition at line 34 of file Client.h.

Referenced by Client(), createTeam(), and ~Client().

ClientUpdater* ASR::Client::mUpdater [private]

Definition at line 37 of file Client.h.

Referenced by Client(), createTeam(), and ~Client().

RenderWindow* ASR::Client::mWindow [private]

Definition at line 41 of file Client.h.

Referenced by _createGUI(), and createCamera().


The documentation for this class was generated from the following files:
Generated on Sun Jun 25 19:23:43 2006 for Valors End by  doxygen 1.4.7