diff options
Diffstat (limited to '')
-rw-r--r-- | include/util.hpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/util.hpp b/include/util.hpp new file mode 100644 index 0000000..c6a7aec --- /dev/null +++ b/include/util.hpp @@ -0,0 +1,27 @@ +#include "debug.hpp" + +extern "C" { +#include <SDL2/SDL_error.h> +} + +namespace wsdl2 { + namespace util { + // constexpr inline bool sdl_bool(SDL_bool b) { + // return b == SDL_TRUE; + // } + + // constexpr inline SDL_bool sdl_bool(bool b) { + // return (b) ? SDL_TRUE : SDL_FALSE; + // } + + constexpr inline bool check(bool expr) { +#ifdef DEBUG + if (!expr) { + npdebug("an internal SDL error occurred:"); + npdebug(" ", const_cast<const char * const>(SDL_GetError())); + } +#endif + return expr; + } + } +}
\ No newline at end of file |