mirror of https://github.com/buggins/dlangui.git
fix support of older SDL2 versions - #90
This commit is contained in:
parent
1526901157
commit
c125c224b8
|
@ -45,13 +45,28 @@ version (USE_OPENGL) {
|
||||||
import dlangui.graphics.glsupport;
|
import dlangui.graphics.glsupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private derelict.util.exception.ShouldThrow missingSymFunc( string symName ) {
|
||||||
// pragma(lib, "xcb");
|
import std.algorithm : equal;
|
||||||
// pragma(lib, "xcb-shm");
|
foreach(s; ["SDL_DestroyRenderer", "SDL_GL_DeleteContext", "SDL_DestroyWindow", "SDL_PushEvent",
|
||||||
// pragma(lib, "xcb-image");
|
"SDL_GL_SetAttribute", "SDL_GL_CreateContext", "SDL_GetError",
|
||||||
// pragma(lib, "X11-xcb");
|
"SDL_CreateWindow", "SDL_CreateRenderer", "SDL_GetWindowSize",
|
||||||
// pragma(lib, "X11");
|
"SDL_GL_GetDrawableSize", "SDL_GetWindowID", "SDL_SetWindowSize",
|
||||||
// pragma(lib, "dl");
|
"SDL_ShowWindow", "SDL_SetWindowTitle", "SDL_CreateRGBSurfaceFrom",
|
||||||
|
"SDL_SetWindowIcon", "SDL_FreeSurface", "SDL_ShowCursor",
|
||||||
|
"SDL_SetCursor", "SDL_CreateSystemCursor", "SDL_DestroyTexture",
|
||||||
|
"SDL_CreateTexture", "SDL_UpdateTexture", "SDL_RenderCopy",
|
||||||
|
"SDL_GL_SwapWindow", "SDL_GL_MakeCurrent", "SDL_SetRenderDrawColor",
|
||||||
|
"SDL_RenderClear", "SDL_RenderPresent", "SDL_GetModState",
|
||||||
|
"SDL_RemoveTimer", "SDL_RemoveTimer", "SDL_PushEvent",
|
||||||
|
"SDL_RegisterEvents", "SDL_WaitEvent", "SDL_StartTextInput",
|
||||||
|
"SDL_Quit", "SDL_HasClipboardText", "SDL_GetClipboardText",
|
||||||
|
"SDL_free", "SDL_SetClipboardText", "SDL_Init"]) {
|
||||||
|
if (symName.equal(s)) // Symbol is used
|
||||||
|
return derelict.util.exception.ShouldThrow.Yes;
|
||||||
|
}
|
||||||
|
// Don't throw for unused symbol
|
||||||
|
return derelict.util.exception.ShouldThrow.No;
|
||||||
|
}
|
||||||
|
|
||||||
private __gshared uint USER_EVENT_ID;
|
private __gshared uint USER_EVENT_ID;
|
||||||
private __gshared uint TIMER_EVENT_ID;
|
private __gshared uint TIMER_EVENT_ID;
|
||||||
|
@ -1276,6 +1291,7 @@ int sdlmain(string[] args) {
|
||||||
currentTheme = createDefaultTheme();
|
currentTheme = createDefaultTheme();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
DerelictSDL2.missingSymbolCallback = &missingSymFunc;
|
||||||
// Load the SDL 2 library.
|
// Load the SDL 2 library.
|
||||||
DerelictSDL2.load();
|
DerelictSDL2.load();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue