Gosu
|
Implementation helpers for the Windows platform. More...
Functions | |
HINSTANCE | instance () |
Returns the instance handle of the application. More... | |
void | handleMessage () |
Blocking function which waits for the next message, processes it, then returns. More... | |
void | processMessages () |
Non-blocking function which processes all waiting messages but does not wait for further incoming messages. More... | |
void | registerMessageHook (const std::tr1::function< bool(MSG &)> &hook) |
Registers a function to be called by handleMessage and processMessages. More... | |
GOSU_NORETURN void | throwLastError (const std::string &action="") |
Throws an exception according to the error which GetLastError() returns, optionally prefixed with "While (action), the following
error occured: ". More... | |
template<typename T > | |
T | check (T valToCheck, const std::string &action="") |
Small helper function that throws an exception whenever the value passed through is false. More... | |
template<typename T > | |
void | releaseComPtr (T *ptr) |
template<typename T > | |
std::tr1::shared_ptr< T > | shareComPtr (T *ptr) |
Small helper function that transfers ownership of a COM interface to a std::tr1::shared_ptr. More... | |
std::wstring | appFilename () |
Returns the executable's filename. More... | |
std::wstring | appDirectory () |
Returns the executable's containing directory. More... | |
Implementation helpers for the Windows platform.
std::wstring Gosu::Win::appDirectory | ( | ) |
Returns the executable's containing directory.
std::wstring Gosu::Win::appFilename | ( | ) |
Returns the executable's filename.
T Gosu::Win::check | ( | T | valToCheck, |
const std::string & | action = "" |
||
) |
Small helper function that throws an exception whenever the value passed through is false.
Note that this doesn't make sense for all Windows API functions, but for most of them.
Definition at line 44 of file WinUtility.hpp.
References throwLastError().
void Gosu::Win::handleMessage | ( | ) |
Blocking function which waits for the next message, processes it, then returns.
HINSTANCE Gosu::Win::instance | ( | ) |
Returns the instance handle of the application.
void Gosu::Win::processMessages | ( | ) |
Non-blocking function which processes all waiting messages but does not wait for further incoming messages.
void Gosu::Win::registerMessageHook | ( | const std::tr1::function< bool(MSG &)> & | hook | ) |
Registers a function to be called by handleMessage and processMessages.
Every message is passed to the hooks and not processed further if any hook function returns true.
void Gosu::Win::releaseComPtr | ( | T * | ptr | ) |
Definition at line 54 of file WinUtility.hpp.
std::tr1::shared_ptr<T> Gosu::Win::shareComPtr | ( | T * | ptr | ) |
Small helper function that transfers ownership of a COM interface to a std::tr1::shared_ptr.
Definition at line 62 of file WinUtility.hpp.
GOSU_NORETURN void Gosu::Win::throwLastError | ( | const std::string & | action = "" | ) |
Throws an exception according to the error which GetLastError() returns, optionally prefixed with "While (action), the following error occured: ".
Referenced by check().