00001 #ifndef MERCURYSCREEN_H
00002 #define MERCURYSCREEN_H
00003
00004 #include "MercuryObject.h"
00005 #include "MercuryModel.h"
00006 #include "MercurySprite.h"
00007 #include "MercuryCamera.h"
00008 #include "MercuryDisplay.h"
00009
00011 class MercuryScreen : public MercuryObject
00012 {
00013 public:
00014 MercuryScreen( const MercuryScreen & MercuryScreen );
00015 MercuryScreen();
00016 MercuryScreen( const MString &name );
00017 virtual ~MercuryScreen();
00018 virtual void Init();
00019 virtual void Update(const float dTime);
00020 virtual void Message( int Message, PStack & data, const MString & name );
00021 virtual void Render();
00022
00023 virtual bool RemoveObject(MercuryObject* object, bool bAllowDelete = true );
00024
00025 void AddPerspObject(MercuryObject* object, bool bParentDelete = false);
00026 void AddOrthoObject(MercuryObject* object, bool bParentDelete = false);
00027
00028 virtual MercuryObject * Spawn( const MString & sClass, const MString & sName, PROJECTIONTYPE projection = PERSPECTIVE );
00029
00030 MercuryCamera* GetCamera() { return m_pCamera; }
00031
00032 CLASS_RTTI( MercuryScreen, MercuryObject );
00033
00034 protected:
00035 void UpdatePerspectiveObjects(float dTime);
00036 void UpdateOrthoObjects(float dTime);
00037
00038 void RenderPerspectiveObjects();
00039 void RenderOrthoObjects();
00040
00041 void CreateProjections();
00042
00043 MercuryObject* m_pBackground;
00044 MercuryCamera* m_pCamera;
00045
00046 bool m_useLighting;
00047
00048 Projection m_perspProjection;
00049 Projection m_orthoProjection;
00050 private:
00051
00052 MercuryObject m_PerspObjects;
00053 MercuryObject m_OrthoObjects;
00054 };
00055
00056
00057
00058
00059
00060 typedef MercuryScreen* (*NewScreenFunction)(const MString& sClassName);
00061 void RegisterMercuryScreen( const MString& sClassName, NewScreenFunction pfn );
00062
00063 #define REGISTER_SCREEN_CLASS( className ) \
00064 static MercuryScreen* Create##className( const MString &sName ) \
00065 { MercuryScreen *pRet = new className( sName ); pRet->Init(); return pRet; } \
00066 struct Register##className { \
00067 Register##className() { RegisterMercuryScreen( #className,Create##className); } \
00068 }; \
00069 static Register##className register_##className; \
00070 REGISTER_OBJECT_TYPE( className );
00071
00072 extern std::map< MString, NewScreenFunction > *ToMakeScreens;
00073
00074
00075
00076 #endif
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108