SDLGUI.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /* GG is a GUI for SDL and OpenGL.
00003    Copyright (C) 2003 T. Zachary Laine
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public License
00007    as published by the Free Software Foundation; either version 2.1
00008    of the License, or (at your option) any later version.
00009    
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014     
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA
00019 
00020    If you do not wish to comply with the terms of the LGPL please
00021    contact the author as other terms are available for a fee.
00022     
00023    Zach Laine
00024    whatwasthataddress@hotmail.com */
00025 
00029 #ifndef _GG_SDLGUI_h_
00030 #define _GG_SDLGUI_h_
00031 
00032 #include <GG/GUI.h>
00033 
00034 #include <SDL/SDL.h>
00035 
00036 
00037 #ifdef _MSC_VER
00038 # ifdef GIGI_SDL_EXPORTS
00039 #  define GG_SDL_API __declspec(dllexport)
00040 # else
00041 #  define GG_SDL_API __declspec(dllimport)
00042 # endif
00043 #else
00044 # define GG_SDL_API
00045 #endif
00046 
00047 namespace GG {
00048 
00074 class GG_SDL_API SDLGUI : public GG::GUI
00075 {
00076 public: 
00078     explicit SDLGUI(int w = 1024, int h = 768, bool calc_FPS = false, const std::string& app_name = "GG"); 
00079     virtual ~SDLGUI();
00081  
00083     virtual int    AppWidth() const;
00084     virtual int    AppHeight() const;
00085     virtual int    Ticks() const;
00087  
00089     void           operator()();      
00090     virtual void   Exit(int code);
00091 
00092     virtual void   Enter2DMode() = 0;
00093     virtual void   Exit2DMode() = 0;
00095 
00096     static SDLGUI* GetGUI();                             
00097     static GG::Key GGKeyFromSDLKey(const SDL_keysym& key); 
00098 
00099 protected:
00100     void SetAppSize(const GG::Pt& size);
00101 
00102     // these are called at the beginning of the gui's execution
00103     virtual void   SDLInit();        
00104     virtual void   GLInit();         
00105     virtual void   Initialize() = 0; 
00106 
00107     virtual void   HandleSystemEvents();
00108     virtual void   HandleNonGGEvent(const SDL_Event& event); 
00109 
00110     virtual void   RenderBegin();
00111     virtual void   RenderEnd();
00112 
00113     // these are called at the end of the gui's execution
00114     virtual void   FinalCleanup();   
00115     virtual void   SDLQuit();        
00116 
00117     virtual void   Run();
00118 
00119 private:
00120     int            m_app_width;      
00121     int            m_app_height;
00122 };
00123 
00124 } // namespace GG
00125 
00126 #endif // _GG_SDLGUI_h_
00127 

Generated on Wed Mar 26 14:35:42 2008 for GG by  doxygen 1.5.2