Client.h

Go to the documentation of this file.
00001 //**********************************************************************
00002 //
00003 //  REGCOM: Regimental Command
00004 //  Copyright (C) 2008 Randi J. Relander
00005 //    <rjrelander@users.sourceforge.net>
00006 //
00007 //  This program is free software; you can redistribute it and/or
00008 //  modify it under the terms of the GNU General Public License
00009 //  as published by the Free Software Foundation; either version 3
00010 //  of the License, or (at your option) any later version.
00011 //  
00012 //  This program is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU General Public License for more details.
00016 //  
00017 //  You should have received a copy of the GNU General Public
00018 //  License along with this program.  If not, see 
00019 //  <http://www.gnu.org/licenses/>.
00020 //  
00021 //**********************************************************************
00022 
00023 #ifndef REGCOM_CLIENT_CLIENT_H
00024 #define REGCOM_CLIENT_CLIENT_H
00025 
00026 // LIBRARY INCLUDES
00027 #include "SDL.h"
00028 
00029 // PROJECT INCLUDES
00030 #include "regcom/common/Map.h"
00031 
00032 #include "regcom/gui/Desktop.h"
00033 #include "regcom/gui/Window.h"
00034 #include "regcom/gui/Point.h"
00035 
00036 // NAMESPACES
00037 namespace regcom {
00038 namespace client {
00039 
00040 // FORWARD REFERENCES
00041 class MapView;
00042 class Console;
00043 
00045 //  CLASS: Client
00051 class Client
00052 {
00053 public:
00054     
00055     // PUBLIC METHODS
00056 
00058     Client();
00059 
00061     virtual ~Client();
00062     
00064     int Run();
00065 
00067     enum USER_EVENT
00068     {
00069         USER_EVENT_ZOOM_IN            = 1,    
00070         USER_EVENT_ZOOM_OUT            = 2,    
00071         USER_EVENT_TOGGLE_GRID        = 3,    
00072         USER_EVENT_NEW_MAP            = 4,    
00073         USER_EVENT_QUIT_GAME        = 5        
00074     };
00075 
00076 protected:
00077 
00078     // PROTECTED METHODS
00079 
00081     void PollEvents();
00082 
00084     void OnActiveEvent(SDL_ActiveEvent sdlEvent);
00085 
00087     void OnKeyDown(SDL_KeyboardEvent sdlEvent);
00088 
00090     void OnKeyUp(SDL_KeyboardEvent sdlEvent);
00091 
00093     void OnMouseMotion(SDL_MouseMotionEvent sdlEvent);
00094 
00096     void OnMouseButtonDown(SDL_MouseButtonEvent sdlEvent);
00097 
00099     void OnMouseButtonUp(SDL_MouseButtonEvent sdlEvent);
00100 
00102     void OnVideoResize(SDL_ResizeEvent sdlEvent);
00103 
00105     void OnQuit(SDL_QuitEvent sdlEvent);
00106 
00108     void OnUserEvent(SDL_UserEvent sdlEvent);
00109 
00111     void OnSysWMEvent(SDL_SysWMEvent sdlEvent);
00112 
00114     void PushUserEvent(int code, void* pData1, void* pData2);
00115 
00116 private:
00117     
00118     // MEMBER VARIABLES
00119 
00121     bool m_Done;
00122 
00124     regcom::common::Map* m_pMap;
00125 
00127     gui::Desktop* m_pDesktop;
00128     
00130     MapView* m_pMapView;
00131 
00133     Console* m_pConsole;
00134 };
00135 
00136 } // namespace client
00137 } // namespace regcom
00138 
00139 #endif