MainCamera.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(AFX_MAINCAMERA_H__97593EBB_5901_4D81_BAEB_8ADC76CFB627__INCLUDED_)
00022 #define AFX_MAINCAMERA_H__97593EBB_5901_4D81_BAEB_8ADC76CFB627__INCLUDED_
00023 
00024 #include <GLEXT/GLMenuI.h>
00025 #include <engine/GameStateI.h>
00026 #include <graph/TargetCamera.h>
00027 #include <common/Vector.h>
00028 #include <map>
00029 
00030 class MainCamera : public GameStateI, public GLMenuI
00031 {
00032 public:
00033         static MainCamera *instance();
00034 
00035         GLCamera &getCamera() { return targetCam_.getCamera(); }
00036         TargetCamera &getTarget() { return targetCam_; }
00037 
00038         bool getCameraSelected() { return mouseDown_ || keyDown_ || scrolling_; }
00039         bool getShowArena() { return showArena_; }
00040 
00041         // Inherited from GameStateI
00042         virtual void simulate(const unsigned state, 
00043                 float frameTime);
00044         virtual void draw(const unsigned state);
00045         virtual void mouseWheel(const unsigned state, 
00046                 int x, int y, int z, bool &skipRest);
00047         virtual void mouseDown(const unsigned state, 
00048                 GameState::MouseButton button, int x, int y, bool &skipRest);
00049         virtual void mouseUp(const unsigned state, 
00050                 GameState::MouseButton button, int x, int y, bool &skipRest);
00051         virtual void mouseDrag(const unsigned state, 
00052                 GameState::MouseButton button,
00053                 int mx, int my, int x, int y, bool &skipRest);
00054         virtual void keyboardCheck(
00055                 const unsigned state, float frameTime, 
00056                 char *buffer, unsigned int keyState,
00057                 KeyboardHistory::HistoryElement *history, int hisCount, 
00058                 bool &skipRest);
00059 
00060         // Inherited from GLMenuI
00061         virtual bool getEnabled(const char* menuName);
00062         virtual void menuSelection(const char* menuName, 
00063                 const int position, GLMenuItem &item);
00064         virtual bool getMenuItems(const char* menuName, 
00065                 std::list<GLMenuItem> &result);
00066 
00067         // Class to save the screen shots
00068         class SaveScreen : public GameStateI
00069         {
00070         public:
00071                 SaveScreen() : GameStateI("SaveScreen"), saveScreen_(false), saveScreenTest_(false) {}
00072                 virtual void draw(const unsigned state);
00073 
00074                 bool saveScreen_;
00075                 bool saveScreenTest_;
00076         } saveScreen_;
00077 
00078         class Precipitation : public GameStateI
00079         {
00080         public:
00081                 Precipitation() : GameStateI("Precipitation") {}
00082                 virtual void draw(const unsigned state);
00083         } precipitation_;
00084 
00085 protected:
00086         static MainCamera *instance_;
00087         bool mouseDown_, keyDown_, scrolling_, showArena_;
00088         TargetCamera targetCam_;
00089         // Quick key settings
00090         std::map<int, std::pair<Vector, Vector> > quickKeys_;
00091 
00092         void setQuick(int key);
00093         void useQuick(int key);
00094 
00095 private:
00096         MainCamera();
00097         virtual ~MainCamera();
00098 
00099 };
00100 
00101 #endif // !defined(AFX_MAINCAMERA_H__97593EBB_5901_4D81_BAEB_8ADC76CFB627__INCLUDED_)

Generated on Mon Feb 16 15:14:46 2009 for Scorched3D by  doxygen 1.5.3