summaryrefslogtreecommitdiffstats
path: root/include/util.hpp
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2019-01-23 02:50:31 +0100
committerNao Pross <naopross@thearcway.org>2019-01-23 02:50:31 +0100
commitfe1c9aff4a3d773277813f01e853e7d8826367fb (patch)
tree3209a97ab2e9337463e97a71eb92417a5955c696 /include/util.hpp
parentLimit framerate of window_test (diff)
downloadlibwsdl2-fe1c9aff4a3d773277813f01e853e7d8826367fb.tar.gz
libwsdl2-fe1c9aff4a3d773277813f01e853e7d8826367fb.zip
Interface basic renderer drawing functions
Diffstat (limited to 'include/util.hpp')
-rw-r--r--include/util.hpp27
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