Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #ifndef GOSU_WINUTILITY_HPP
00007 #define GOSU_WINUTILITY_HPP
00008
00009 #include <windows.h>
00010 #include <Gosu/Platform.hpp>
00011 #include <Gosu/TR1.hpp>
00012 #include <string>
00013
00014 namespace Gosu
00015 {
00017 namespace Win
00018 {
00020 HINSTANCE instance();
00021
00024 void handleMessage();
00025
00028 void processMessages();
00029
00033 void registerMessageHook(const std::tr1::function<bool (MSG&)>& hook);
00034
00038 GOSU_NORETURN void throwLastError(const std::string& action = "");
00039
00043 template<typename T>
00044 inline T check(T valToCheck, const std::string& action = "")
00045 {
00046 if (!valToCheck)
00047 throwLastError(action);
00048 return valToCheck;
00049 }
00050
00051
00052
00053 template<typename T>
00054 void releaseComPtr(T* ptr)
00055 {
00056 ptr->Release();
00057 }
00058
00061 template<typename T>
00062 inline std::tr1::shared_ptr<T> shareComPtr(T* ptr)
00063 {
00064 return std::tr1::shared_ptr<T>(ptr, releaseComPtr<T>);
00065 }
00066
00068 std::wstring appFilename();
00069
00071 std::wstring appDirectory();
00072 }
00073 }
00074
00075 #endif