Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef OVR_Win32_Platform_h
00025 #define OVR_Win32_Platform_h
00026
00027 #include "Platform.h"
00028 #include <windows.h>
00029
00030
00031 namespace OVR { namespace Render {
00032 class RenderDevice;
00033 struct DisplayId;
00034 }}
00035
00036 namespace OVR { namespace Platform { namespace Win32 {
00037
00038 class PlatformCore : public Platform::PlatformCore
00039 {
00040 HWND hWnd;
00041 HINSTANCE hInstance;
00042 bool Quit;
00043 int ExitCode;
00044 int Width, Height;
00045
00046 MouseMode MMode;
00047 POINT WindowCenter;
00048 HCURSOR Cursor;
00049 int Modifiers;
00050 String WindowTitle;
00051
00052
00053 static LRESULT CALLBACK systemWindowProc(HWND window, UINT msg, WPARAM wp, LPARAM lp);
00054
00055 LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp);
00056
00057 public:
00058 PlatformCore(Application* app, HINSTANCE hinst);
00059 ~PlatformCore();
00060
00061 bool SetupWindow(int w, int h);
00062 void DestroyWindow();
00063 void ShowWindow(bool visible);
00064 void Exit(int exitcode) { Quit = 1; ExitCode = exitcode; }
00065
00066 RenderDevice* SetupGraphics(const SetupGraphicsDeviceSet& setupGraphicsDesc,
00067 const char* type,
00068 const Render::RendererParams& rp);
00069
00070 void SetMouseMode(MouseMode mm);
00071 void GetWindowSize(int* w, int* h) const;
00072
00073 void SetWindowTitle(const char*title);
00074 void PlayMusicFile(const char *fileName);
00075 int GetDisplayCount();
00076 Render::DisplayId GetDisplay(int screen);
00077
00078 int Run();
00079 };
00080
00081
00082
00083 KeyCode MapVKToKeyCode(unsigned vk);
00084
00085 }}}
00086
00087
00088
00089
00090 #define OVR_PLATFORM_APP_ARGS(AppClass, args) \
00091 OVR::Platform::Application* OVR::Platform::Application::CreateApplication() \
00092 { OVR::System::Init(OVR::Log::ConfigureDefaultLog(OVR::LogMask_All)); \
00093 return new AppClass args; } \
00094 void OVR::Platform::Application::DestroyApplication(OVR::Platform::Application* app) \
00095 { OVR::Platform::PlatformCore* platform = app->pPlatform; \
00096 delete app; delete platform; OVR::System::Destroy(); };
00097
00098
00099 #define OVR_PLATFORM_APP(AppClass) OVR_PLATFORM_APP_ARGS(AppClass, ())
00100
00101 #endif // OVR_Win32_Platform_h