summaryrefslogtreecommitdiffstats
path: root/include/util.hpp
blob: c6a7aec7e07530010a935ee71cc63ff5f4766a72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
        }
    }
}