// 2.0.9.0 module lib+ { module sdl2+ { module so { struct struct { // SDL.h SDL_Init void; SDL_Quit void; // SDL_error.h SDL_SetError void; SDL_GetError void; SDL_ClearError void; SDL_Error void; // SDL_hints.h SDL_SetHint void; SDL_GetHint void; // SDL_rect.h SDL_HasIntersection void; SDL_IntersectRect void; SDL_UnionRect void; SDL_EnclosePoints void; SDL_IntersectRectAndLine void; // SDL_timer.h SDL_GetTicks void; SDL_GetPerformanceCounter void; SDL_GetPerformanceFrequency void; SDL_Delay void; SDL_AddTimer void; SDL_RemoveTimer void; // SDL_rwops.h SDL_RWFromFile void; SDL_RWFromFP void; SDL_RWFromMem void; SDL_RWFromConstMem void; SDL_AllocRW void; SDL_FreeRW void; // SDL_video.h SDL_GL_GetProcAddress void; SDL_GetNumVideoDrivers void; SDL_GetVideoDriver void; SDL_VideoInit void; SDL_VideoQuit void; SDL_GetCurrentVideoDriver void; SDL_GetNumVideoDisplays void; SDL_GetDisplayName void; SDL_GetDisplayBounds void; SDL_GetDisplayUsableBounds void; SDL_GetDisplayDPI void; SDL_GetNumDisplayModes void; SDL_GetDisplayMode void; SDL_GetDesktopDisplayMode void; SDL_GetCurrentDisplayMode void; SDL_GetClosestDisplayMode void; SDL_GetWindowDisplayIndex void; SDL_SetWindowDisplayMode void; SDL_GetWindowDisplayMode void; SDL_GetWindowPixelFormat void; SDL_CreateWindow void; SDL_CreateWindowFrom void; SDL_DestroyWindow void; SDL_GetWindowID void; SDL_GetWindowFromID void; SDL_GetWindowFlags void; SDL_SetWindowTitle void; SDL_GetWindowTitle void; SDL_SetWindowIcon void; SDL_SetWindowData void; SDL_GetWindowData void; SDL_SetWindowPosition void; SDL_GetWindowPosition void; SDL_SetWindowSize void; SDL_GetWindowSize void; SDL_GetWindowBordersSize void; SDL_SetWindowMinimumSize void; SDL_GetWindowMinimumSize void; SDL_SetWindowMaximumSize void; SDL_GetWindowMaximumSize void; SDL_SetWindowBordered void; SDL_SetWindowResizable void; SDL_ShowWindow void; SDL_HideWindow void; SDL_RaiseWindow void; SDL_MaximizeWindow void; SDL_MinimizeWindow void; SDL_RestoreWindow void; SDL_SetWindowFullscreen void; SDL_GetWindowSurface void; SDL_UpdateWindowSurface void; SDL_UpdateWindowSurfaceRects void; SDL_SetWindowGrab void; SDL_GetWindowGrab void; SDL_GetGrabbedWindow void; SDL_SetWindowBrightness void; SDL_GetWindowBrightness void; SDL_SetWindowOpacity void; SDL_GetWindowOpacity void; SDL_SetWindowModalFor void; SDL_SetWindowInputFocus void; SDL_SetWindowGammaRamp void; SDL_GetWindowGammaRamp void; SDL_SetWindowHitTest void; SDL_IsScreenSaverEnabled void; SDL_EnableScreenSaver void; SDL_DisableScreenSaver void; // SDL_keyboard.h SDL_GetKeyboardFocus void; SDL_GetKeyboardState void; SDL_GetModState void; SDL_SetModState void; SDL_GetKeyFromScancode void; SDL_GetScancodeFromKey void; SDL_GetScancodeName void; SDL_GetScancodeFromName void; SDL_GetKeyName void; SDL_GetKeyFromName void; SDL_StartTextInput void; SDL_IsTextInputActive void; SDL_StopTextInput void; SDL_SetTextInputRect void; SDL_HasScreenKeyboardSupport void; SDL_IsScreenKeyboardShown void; // SDL_mouse.h SDL_GetMouseFocus void; SDL_GetMouseState void; SDL_GetGlobalMouseState void; SDL_GetRelativeMouseState void; SDL_WarpMouseInWindow void; SDL_WarpMouseGlobal void; SDL_SetRelativeMouseMode void; SDL_CaptureMouse void; SDL_GetRelativeMouseMode void; SDL_CreateCursor void; SDL_CreateColorCursor void; SDL_CreateSystemCursor void; SDL_SetCursor void; SDL_GetCursor void; SDL_GetDefaultCursor void; SDL_FreeCursor void; SDL_ShowCursor void; // SDL_events.h SDL_PumpEvents void; SDL_PeepEvents void; SDL_HasEvent void; SDL_HasEvents void; SDL_FlushEvent void; SDL_FlushEvents void; SDL_PollEvent void; SDL_WaitEvent void; SDL_WaitEventTimeout void; SDL_PushEvent void; SDL_SetEventFilter void; SDL_GetEventFilter void; SDL_AddEventWatch void; SDL_DelEventWatch void; SDL_FilterEvents void; SDL_EventState void; SDL_RegisterEvents void; // SDL_render.h SDL_GetNumRenderDrivers void; SDL_GetRenderDriverInfo void; SDL_CreateRenderer void; SDL_DestroyRenderer void; SDL_GetRenderer void; SDL_GetRendererInfo void; SDL_CreateTexture void; SDL_CreateTextureFromSurface void; SDL_DestroyTexture void; SDL_QueryTexture void; SDL_SetTextureColorMod void; SDL_GetTextureColorMod void; SDL_SetTextureAlphaMod void; SDL_GetTextureAlphaMod void; SDL_SetTextureBlendMode void; SDL_GetTextureBlendMode void; SDL_UpdateTexture void; SDL_UpdateYUVTexture void; SDL_LockTexture void; SDL_UnlockTexture void; SDL_RenderTargetSupported void; SDL_SetRenderTarget void; SDL_GetRenderTarget void; SDL_RenderSetLogicalSize void; SDL_RenderGetLogicalSize void; SDL_RenderSetIntegerScale void; SDL_RenderGetIntegerScale void; SDL_RenderSetViewport void; SDL_RenderGetViewport void; SDL_RenderSetClipRect void; SDL_RenderGetClipRect void; SDL_RenderIsClipEnabled void; SDL_RenderSetScale void; SDL_RenderGetScale void; SDL_SetRenderDrawColor void; SDL_GetRenderDrawColor void; SDL_SetRenderDrawBlendMode void; SDL_GetRenderDrawBlendMode void; SDL_RenderClear void; SDL_RenderDrawPoint void; SDL_RenderDrawPoints void; SDL_RenderDrawLine void; SDL_RenderDrawLines void; SDL_RenderDrawRect void; SDL_RenderDrawRects void; SDL_RenderFillRect void; SDL_RenderFillRects void; SDL_RenderCopy void; SDL_RenderCopyEx void; SDL_RenderReadPixels void; SDL_RenderPresent void; // SDL_pixels.h SDL_GetPixelFormatName void; SDL_PixelFormatEnumToMasks void; SDL_MasksToPixelFormatEnum void; SDL_AllocFormat void; SDL_FreeFormat void; SDL_AllocPalette void; SDL_SetPixelFormatPalette void; SDL_SetPaletteColors void; SDL_FreePalette void; SDL_MapRGB void; SDL_MapRGBA void; SDL_GetRGB void; SDL_GetRGBA void; SDL_CalculateGammaRamp void; // SDL_surface.h SDL_CreateRGBSurface void; SDL_CreateRGBSurfaceWithFormat void; SDL_CreateRGBSurfaceFrom void; SDL_CreateRGBSurfaceWithFormatFrom void; SDL_FreeSurface void; SDL_SetSurfacePalette void; SDL_LockSurface void; SDL_UnlockSurface void; SDL_SetSurfaceRLE void; SDL_SetColorKey void; SDL_GetColorKey void; SDL_SetSurfaceColorMod void; SDL_GetSurfaceColorMod void; SDL_SetSurfaceAlphaMod void; SDL_GetSurfaceAlphaMod void; SDL_SetSurfaceBlendMode void; SDL_GetSurfaceBlendMode void; SDL_SetClipRect void; SDL_GetClipRect void; SDL_ConvertSurface void; SDL_ConvertSurfaceFormat void; SDL_ConvertPixels void; SDL_FillRect void; SDL_FillRects void; SDL_UpperBlit void; // SDL_BlitSurface SDL_LowerBlit void; SDL_SoftStretch void; SDL_UpperBlitScaled void; // SDL_BlitScaled SDL_LowerBlitScaled void; } var fn struct; func init() bool { import rt::c; return dlsyms(dlopen("libSDL2-2.0.so.0", RTLD_LAZY), &fn, // SDL.h "SDL_Init", "SDL_Quit", // SDL_error.h "SDL_SetError", "SDL_GetError", "SDL_ClearError", "SDL_Error", // SDL_hints.h "SDL_SetHint", "SDL_GetHint", // SDL_rect.h "SDL_HasIntersection", "SDL_IntersectRect", "SDL_UnionRect", "SDL_EnclosePoints", "SDL_IntersectRectAndLine", // SDL_timer.h "SDL_GetTicks", "SDL_GetPerformanceCounter", "SDL_GetPerformanceFrequency", "SDL_Delay", "SDL_AddTimer", "SDL_RemoveTimer", // SDL_rwops.h "SDL_RWFromFile", "SDL_RWFromFP", "SDL_RWFromMem", "SDL_RWFromConstMem", "SDL_AllocRW", "SDL_FreeRW", // SDL_video.h "SDL_GL_GetProcAddress", "SDL_GetNumVideoDrivers", "SDL_GetVideoDriver", "SDL_VideoInit", "SDL_VideoQuit", "SDL_GetCurrentVideoDriver", "SDL_GetNumVideoDisplays", "SDL_GetDisplayName", "SDL_GetDisplayBounds", "SDL_GetDisplayUsableBounds", "SDL_GetDisplayDPI", "SDL_GetNumDisplayModes", "SDL_GetDisplayMode", "SDL_GetDesktopDisplayMode", "SDL_GetCurrentDisplayMode", "SDL_GetClosestDisplayMode", "SDL_GetWindowDisplayIndex", "SDL_SetWindowDisplayMode", "SDL_GetWindowDisplayMode", "SDL_GetWindowPixelFormat", "SDL_CreateWindow", "SDL_CreateWindowFrom", "SDL_DestroyWindow", "SDL_GetWindowID", "SDL_GetWindowFromID", "SDL_GetWindowFlags", "SDL_SetWindowTitle", "SDL_GetWindowTitle", "SDL_SetWindowIcon", "SDL_SetWindowData", "SDL_GetWindowData", "SDL_SetWindowPosition", "SDL_GetWindowPosition", "SDL_SetWindowSize", "SDL_GetWindowSize", "SDL_GetWindowBordersSize", "SDL_SetWindowMinimumSize", "SDL_GetWindowMinimumSize", "SDL_SetWindowMaximumSize", "SDL_GetWindowMaximumSize", "SDL_SetWindowBordered", "SDL_SetWindowResizable", "SDL_ShowWindow", "SDL_HideWindow", "SDL_RaiseWindow", "SDL_MaximizeWindow", "SDL_MinimizeWindow", "SDL_RestoreWindow", "SDL_SetWindowFullscreen", "SDL_GetWindowSurface", "SDL_UpdateWindowSurface", "SDL_UpdateWindowSurfaceRects", "SDL_SetWindowGrab", "SDL_GetWindowGrab", "SDL_GetGrabbedWindow", "SDL_SetWindowBrightness", "SDL_GetWindowBrightness", "SDL_SetWindowOpacity", "SDL_GetWindowOpacity", "SDL_SetWindowModalFor", "SDL_SetWindowInputFocus", "SDL_SetWindowGammaRamp", "SDL_GetWindowGammaRamp", "SDL_SetWindowHitTest", "SDL_IsScreenSaverEnabled", "SDL_EnableScreenSaver", "SDL_DisableScreenSaver", // SDL_keyboard.h "SDL_GetKeyboardFocus", "SDL_GetKeyboardState", "SDL_GetModState", "SDL_SetModState", "SDL_GetKeyFromScancode", "SDL_GetScancodeFromKey", "SDL_GetScancodeName", "SDL_GetScancodeFromName", "SDL_GetKeyName", "SDL_GetKeyFromName", "SDL_StartTextInput", "SDL_IsTextInputActive", "SDL_StopTextInput", "SDL_SetTextInputRect", "SDL_HasScreenKeyboardSupport", "SDL_IsScreenKeyboardShown", // SDL_mouse.h "SDL_GetMouseFocus", "SDL_GetMouseState", "SDL_GetGlobalMouseState", "SDL_GetRelativeMouseState", "SDL_WarpMouseInWindow", "SDL_WarpMouseGlobal", "SDL_SetRelativeMouseMode", "SDL_CaptureMouse", "SDL_GetRelativeMouseMode", "SDL_CreateCursor", "SDL_CreateColorCursor", "SDL_CreateSystemCursor", "SDL_SetCursor", "SDL_GetCursor", "SDL_GetDefaultCursor", "SDL_FreeCursor", "SDL_ShowCursor", // SDL_events.h "SDL_PumpEvents", "SDL_PeepEvents", "SDL_HasEvent", "SDL_HasEvents", "SDL_FlushEvent", "SDL_FlushEvents", "SDL_PollEvent", "SDL_WaitEvent", "SDL_WaitEventTimeout", "SDL_PushEvent", "SDL_SetEventFilter", "SDL_GetEventFilter", "SDL_AddEventWatch", "SDL_DelEventWatch", "SDL_FilterEvents", "SDL_EventState", "SDL_RegisterEvents", // SDL_render.h "SDL_GetNumRenderDrivers", "SDL_GetRenderDriverInfo", "SDL_CreateRenderer", "SDL_DestroyRenderer", "SDL_GetRenderer", "SDL_GetRendererInfo", "SDL_CreateTexture", "SDL_CreateTextureFromSurface", "SDL_DestroyTexture", "SDL_QueryTexture", "SDL_SetTextureColorMod", "SDL_GetTextureColorMod", "SDL_SetTextureAlphaMod", "SDL_GetTextureAlphaMod", "SDL_SetTextureBlendMode", "SDL_GetTextureBlendMode", "SDL_UpdateTexture", "SDL_UpdateYUVTexture", "SDL_LockTexture", "SDL_UnlockTexture", "SDL_RenderTargetSupported", "SDL_SetRenderTarget", "SDL_GetRenderTarget", "SDL_RenderSetLogicalSize", "SDL_RenderGetLogicalSize", "SDL_RenderSetIntegerScale", "SDL_RenderGetIntegerScale", "SDL_RenderSetViewport", "SDL_RenderGetViewport", "SDL_RenderSetClipRect", "SDL_RenderGetClipRect", "SDL_RenderIsClipEnabled", "SDL_RenderSetScale", "SDL_RenderGetScale", "SDL_SetRenderDrawColor", "SDL_GetRenderDrawColor", "SDL_SetRenderDrawBlendMode", "SDL_GetRenderDrawBlendMode", "SDL_RenderClear", "SDL_RenderDrawPoint", "SDL_RenderDrawPoints", "SDL_RenderDrawLine", "SDL_RenderDrawLines", "SDL_RenderDrawRect", "SDL_RenderDrawRects", "SDL_RenderFillRect", "SDL_RenderFillRects", "SDL_RenderCopy", "SDL_RenderCopyEx", "SDL_RenderReadPixels", "SDL_RenderPresent", // SDL_pixels.h "SDL_GetPixelFormatName", "SDL_PixelFormatEnumToMasks", "SDL_MasksToPixelFormatEnum", "SDL_AllocFormat", "SDL_FreeFormat", "SDL_AllocPalette", "SDL_SetPixelFormatPalette", "SDL_SetPaletteColors", "SDL_FreePalette", "SDL_MapRGB", "SDL_MapRGBA", "SDL_GetRGB", "SDL_GetRGBA", "SDL_CalculateGammaRamp", // SDL_surface.h "SDL_CreateRGBSurface", "SDL_CreateRGBSurfaceWithFormat", "SDL_CreateRGBSurfaceFrom", "SDL_CreateRGBSurfaceWithFormatFrom", "SDL_FreeSurface", "SDL_SetSurfacePalette", "SDL_LockSurface", "SDL_UnlockSurface", "SDL_SetSurfaceRLE", "SDL_SetColorKey", "SDL_GetColorKey", "SDL_SetSurfaceColorMod", "SDL_GetSurfaceColorMod", "SDL_SetSurfaceAlphaMod", "SDL_GetSurfaceAlphaMod", "SDL_SetSurfaceBlendMode", "SDL_GetSurfaceBlendMode", "SDL_SetClipRect", "SDL_GetClipRect", "SDL_ConvertSurface", "SDL_ConvertSurfaceFormat", "SDL_ConvertPixels", "SDL_FillRect", "SDL_FillRects", "SDL_UpperBlit", "SDL_LowerBlit", "SDL_SoftStretch", "SDL_UpperBlitScaled", "SDL_LowerBlitScaled" ); } } } module sdl2+ { private import rt::c; // SDL.h define { SDL_INIT_TIMER = uint(0x00000001); SDL_INIT_AUDIO = uint(0x00000010); SDL_INIT_VIDEO = uint(0x00000020); /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ SDL_INIT_JOYSTICK = uint(0x00000200); /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ SDL_INIT_HAPTIC = uint(0x00001000); SDL_INIT_GAMECONTROLLER = uint(0x00002000); /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ SDL_INIT_EVENTS = uint(0x00004000); SDL_INIT_SENSOR = uint(0x00008000); SDL_INIT_NOPARACHUTE = uint(0x00100000); /**< compatibility; this flag is ignored. */ SDL_INIT_EVERYTHING = ( SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR ); } // SDL_stdinc.h define { SDL_FALSE = 0; SDL_TRUE = 1; } typedef SDL_bool int; // SDL_error.h enum SDL_errorcode; enum { SDL_ENOMEM, SDL_EFREAD, SDL_EFWRITE, SDL_EFSEEK, SDL_UNSUPPORTED, SDL_LASTERROR } // SDL_hints.h define { SDL_HINT_RENDER_DRIVER = "SDL_RENDER_DRIVER"; } // SDL_rect.h struct SDL_Point { x int; y int; } struct SDL_Rect { x int, y int; w int, h int; } // SDL_blendmode.h enum SDL_BlendMode; enum { SDL_BLENDMODE_NONE = 0x00000000, /**< no blending dstRGBA = srcRGBA */ SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) dstA = srcA + (dstA * (1-srcA)) */ SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending dstRGB = (srcRGB * srcA) + dstRGB dstA = dstA */ SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate dstRGB = srcRGB * dstRGB dstA = dstA */ SDL_BLENDMODE_INVALID = 0x7FFFFFFF /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ } enum SDL_BlendOperation; enum { SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */ SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */ } enum SDL_BlendFactor; enum { SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */ SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */ SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */ SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */ SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */ SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */ SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */ SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */ SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */ SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */ } // SDL_timer.h typedef SDL_TimerID int; // SDL_rwops.h define { SDL_RWOPS_UNKNOWN = uint(0); /**< Unknown stream type */ SDL_RWOPS_WINFILE = uint(1); /**< Win32 file */ SDL_RWOPS_STDFILE = uint(2); /**< Stdio file */ SDL_RWOPS_JNIFILE = uint(3); /**< Android asset */ SDL_RWOPS_MEMORY = uint(4); /**< Memory stream */ SDL_RWOPS_MEMORY_RO = uint(5); /**< Read-Only memory stream */ } struct SDL_RWops { size void; seek void; read void; write void; close void; type uint32; union hidden { #if objectid(__WIN32__); struct windowsio { append SDL_bool; h void; struct buffer { data void; size size_t; left size_t; } } #endif // HAVE_STDIO_H struct stdio { autoclose SDL_bool; fp+ FILE; } struct mem { base. uint8; here. uint8; stop. uint8; } struct unknown { data1 void; data2 void; } } } define { RW_SEEK_SET = 0; /**< Seek from the beginning of data */ RW_SEEK_CUR = 1; /**< Seek relative to current read point */ RW_SEEK_END = 2; /**< Seek relative to the end of data */ } // SDL_video.h struct SDL_DisplayMode { format uint32; /**< pixel format */ w int; /**< width, in screen coordinates */ h int; /**< height, in screen coordinates */ refresh_rate int; /**< refresh rate (or zero for unspecified) */ driverdata void; /**< driver-specific data, initialize to 0 */ } enum SDL_WindowFlags; enum { /* !!! FIXME: change this to name = (1<