00001 #ifndef MERCURYWINDOW_H
00002 #define MERCURYWINDOW_H
00003
00004 #include "MercuryTimer.h"
00005 #include "MercuryString.h"
00006 #include "MercuryMessages.h"
00007
00008 enum RendererType
00009 {
00010 RT_NONE,
00011 RT_OGL,
00012 RT_D3D,
00013 RT_SW,
00014 };
00015
00016 class MercuryWindow : public MercuryMessageHandler {
00017 public:
00018 virtual ~MercuryWindow();
00019 MercuryWindow(int width, int height, bool fullscreenflag);
00020 virtual bool MakeWindow(const char* title, int width, int height, int bits, bool fullscreenflag) = 0;
00021 void SetDemensions(int width, int height);
00022 inline void SetFullscreen(bool fullscreen) { m_fullscreen = fullscreen; }
00023 inline bool IsMinimized() const { return m_minimized; }
00024
00025 virtual void DestroyWindow() = 0;
00026 virtual bool RestoreDevice() = 0;
00027
00028 virtual bool MakeRenderCurrent() = 0;
00029 virtual bool MakeRender(const char* title, int width, int height, int bits, bool fullscreenflag, RendererType brt ) = 0;
00030 virtual void DestroyWindowAndRender() = 0;
00031 void SwapBuffers();
00032
00033 inline int GetWidth() { return m_width; }
00034 inline int GetHeight() { return m_height; }
00035 virtual bool Update(const float dTime) = 0;
00036 void SetTitle(const char* title);
00037 inline char* GetTitle() { return m_title; }
00038 virtual bool HasFocus() { return true; }
00039
00040 virtual void Message( int Message, PStack & data, const MString & name );
00041 virtual unsigned char * GetBackDirectBuffer() { return NULL; }
00042
00043
00044 void * m_hWnd;
00045 protected:
00046 virtual void SwapBuffersInternal() = 0;
00047
00048 int m_width;
00049 int m_height;
00050 double m_aspect;
00051 bool m_fullscreen;
00052 bool m_minimized;
00053 int m_bits;
00054 unsigned int m_pixelFormat;
00055
00056 bool m_alt_held;
00057
00058 MercuryTimer m_lastSwap_t;
00059 private:
00060 void ClearTitle();
00061 char* m_title;
00062
00063 MercuryTimer m_tFrameTimer;
00064 bool m_bEnableFrameTimer;
00065 float m_fSimFramerate;
00066
00067 };
00068
00069 #endif
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097