EventPump.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    
00030 #ifndef _GG_EventPump_h_
00031 #define _GG_EventPump_h_
00032 
00033 #include <GG/GUI.h>
00034 
00035 
00036 namespace GG {
00037 
00040 struct GG_API EventPumpState
00041 {
00042     EventPumpState(); 
00043 
00044     int last_FPS_time;    
00045     int last_frame_time;  
00046     int most_recent_time; 
00047     int frames;           
00048 };
00049 
00053 class GG_API EventPumpBase
00054 {
00055 protected:
00062     void LoopBody(GUI* gui, EventPumpState& state, bool do_non_rendering, bool do_rendering);
00063 
00065     static EventPumpState& State();
00066 };
00067 
00074 class GG_API EventPump : public EventPumpBase
00075 {
00076 public:
00077     virtual ~EventPump() {} 
00078 
00080     virtual void operator()();
00081 };
00082 
00086 class GG_API ModalEventPump : public EventPump
00087 {
00088 public:
00089     ModalEventPump(const bool& done); 
00090     virtual void operator()();
00091 
00092 protected:
00093     bool Done() const; 
00094 
00095 private:
00096     const bool& m_done;
00097 };
00098 
00099 } // namespace GG
00100 
00101 #endif // _GG_EventPump_h_

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