EventPump.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /* GG is a GUI for SDL and OpenGL.
00003    Copyright (C) 2003-2008 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@gmail.com */
00025    
00031 #ifndef _GG_EventPump_h_
00032 #define _GG_EventPump_h_
00033 
00034 #include <GG/GUI.h>
00035 
00036 
00037 namespace GG {
00038 
00043 struct GG_API EventPumpState
00044 {
00045     EventPumpState(); 
00046 
00047     unsigned int last_FPS_time;    
00048     unsigned int last_frame_time;  
00049     unsigned int most_recent_time; 
00050     std::size_t  frames;           
00051 };
00052 
00058 class GG_API EventPumpBase
00059 {
00060 protected:
00071     void LoopBody(GUI* gui, EventPumpState& state, bool do_non_rendering, bool do_rendering);
00072 
00074     static EventPumpState& State();
00075 };
00076 
00120 class GG_API EventPump : public EventPumpBase
00121 {
00122 public:
00123     virtual ~EventPump() {} 
00124 
00127     virtual void operator()();
00128 };
00129 
00134 class GG_API ModalEventPump : public EventPump
00135 {
00136 public:
00137     ModalEventPump(const bool& done); 
00138     virtual void operator()();
00139 
00140 protected:
00142     bool Done() const;
00143 
00144 private:
00145     const bool& m_done;
00146 };
00147 
00148 } // namespace GG
00149 
00150 #endif // _GG_EventPump_h_

Generated on Sat Mar 26 07:08:37 2011 for GG by  doxygen 1.5.9