workhorsy / d-message-box

A simple message box for the D programming language
Boost Software License 1.0
2 stars 0 forks source link

SDL detection is dependent on RUN_MAIN main loop #4

Closed workhorsy closed 7 years ago

workhorsy commented 7 years ago

SDL detection only happens inside the RUN_MAIN main loop. This means that if we use a different main loop, it will not check if main is installed. This means that there is no way to use d-progress-dialog and d-message-box in the same program.

We should do SDL detection in a static this instead. Something like this:

bool is_sdl2_loadable = false;
static this() {
    version (Have_derelict_sdl2) {
        import derelict.sdl2.sdl : DerelictSDL2, SharedLibLoadException;
        try {
            DerelictSDL2.load();
            is_sdl2_loadable = true;
        } catch (SharedLibLoadException) {
        }
    }
}