mod_base_class.hh

Go to the documentation of this file.
00001 /*
00009  * LEGAL:   COPYRIGHT (C) 2004 JIM E. BROOKS
00010  *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
00011  *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
00012  *****************************************************************************/
00013 
00014 #ifndef MOD_BASE_CLASS_HH
00015 #define MOD_BASE_CLASS_HH 1
00016 
00017 #include "mod_base_settings.hh"
00018 #include "mod_base_events.hh"
00019 
00020 namespace mod_base {
00021 
00022 class ModuleMode;
00023 class EyeCraft;
00024 
00034 class Module
00035 {
00036 
00037 //------------------------------------------------------------------------------
00038 // Initialization:
00039 //------------------------------------------------------------------------------
00040 public:                     Module( void );
00041 public:     virtual         ~Module();
00042 public:     virtual void    Init( int argc, char** argv, const string& programName );
00043 public:     virtual void    Start( void );
00044 public:     virtual void    End( void );
00045 
00046 private:    void            InitPreCmdarg( void );
00047 private:    void            InitCmdarg( int argc, char** argv );
00048 private:    void            InitPostCmdarg( void );
00049 private:    void            SelfCheck( void );
00050 
00051 //------------------------------------------------------------------------------
00052 // Interface:
00053 //------------------------------------------------------------------------------
00054 public:     virtual ModuleMode&         GetModuleMode( void ) = 0;
00055 public:     virtual SharedPtr<Craft>        GetCurrentCraft( void );
00056 public:     SharedPtr0<EyeCraft>            GetEyeCraft( void );
00057 public:     void                        SetEyeCraft( SharedPtr0<EyeCraft> eyeCraft );
00058 public:     bool                        IfPause( void );
00059 public:     void                        SetPause( const bool pause );
00060 
00061 //------------------------------------------------------------------------------
00062 // Input queue, control:
00063 //------------------------------------------------------------------------------
00064 public:     void            AdjustResponse( const Percent response );
00065 public:     void            IncResponse( const int percent );
00066 private:    void            PulseInputQueue( void );
00067 private:    void            VentOverflowingInputQueue( void );
00068 public:     Joystick        mJoystick;
00069 
00070 //------------------------------------------------------------------------------
00071 // Configuration:
00072 //------------------------------------------------------------------------------
00073 protected:  virtual bool        SaveState( bool saveView ) = 0;
00074 protected:  virtual bool        LoadState( void ) = 0;
00075 protected:  bool                SaveStateBase( bool saveView, ConfigFile& config );
00076 protected:  bool                LoadStateBase( bool loadView, ConfigFile& config );
00077 protected:  virtual ConfigFile& GetConfigFile( void ) = 0;
00078 protected:  ConfigFile&         GetConfigFileBase( const string& programName );
00079 protected:  virtual void        CloseConfigFile( void );
00080 
00081 //------------------------------------------------------------------------------
00082 // Listeners and functors:
00083 //------------------------------------------------------------------------------
00084 private:
00085     // Functor registered with Timer singleton.
00086     struct TimerTickFunctor : public Timer::Functor
00087     {
00088         TimerTickFunctor( void ) { }
00089         void operator()( const Milliseconds millisecElapsed );
00090     };
00091     friend class TimerTickFunctor;
00092 
00093 //------------------------------------------------------------------------------
00094 // Data members:
00095 //------------------------------------------------------------------------------
00096 public:     mod_base::Events    mEvents;
00097 private:    uint                mSeed;
00098 private:    shptr0<EyeCraft>    mEyeCraft;      
00099 private:    bool                mPause;
00100 protected:  string              mCwd;
00101 public:     GFX::Light          mGlobalLight;
00102 public:     GFX::Material       mGlobalMaterial;
00103 };
00104 
00105 } // namespace mod_base
00106 
00107 #endif // MOD_BASE_CLASS_HH
Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:11 2007