6 #ifndef GOSU_WINUTILITY_HPP
7 #define GOSU_WINUTILITY_HPP
11 #include <Gosu/TR1.hpp>
44 inline T
check(T valToCheck,
const std::string& action =
"")
64 return std::tr1::shared_ptr<T>(ptr, releaseComPtr<T>);
The library's main namespace.
void registerMessageHook(const std::tr1::function< bool(MSG &)> &hook)
Registers a function to be called by handleMessage and processMessages.
void processMessages()
Non-blocking function which processes all waiting messages but does not wait for further incoming mes...
T check(T valToCheck, const std::string &action="")
Small helper function that throws an exception whenever the value passed through is false...
std::wstring appFilename()
Returns the executable's filename.
std::wstring appDirectory()
Returns the executable's containing directory.
void releaseComPtr(T *ptr)
GOSU_NORETURN void throwLastError(const std::string &action="")
Throws an exception according to the error which GetLastError() returns, optionally prefixed with "Wh...
HINSTANCE instance()
Returns the instance handle of the application.
void handleMessage()
Blocking function which waits for the next message, processes it, then returns.
std::tr1::shared_ptr< T > shareComPtr(T *ptr)
Small helper function that transfers ownership of a COM interface to a std::tr1::shared_ptr.