github.com/gotranspile/cxgo@v0.3.8-0.20240118201721-29871598a6a2/libs/includes/SDL2/SDL.h (about) 1 #define Uint32 _cxgo_uint32 2 #define Uint16 _cxgo_uint16 3 #define Uint8 _cxgo_uint8 4 #define Sint32 _cxgo_sint32 5 #define Sint16 _cxgo_sint16 6 #define Sint8 _cxgo_sint8 7 #define SDL_bool _cxgo_go_bool 8 typedef Sint32 SDL_FingerID; 9 typedef Sint32 SDL_Scancode; 10 typedef Sint32 SDL_Keymod; 11 typedef Sint32 SDL_BlendMode; 12 typedef Sint32 SDL_TimerID; 13 14 15 #define SDL_TRUE 1 16 #define SDL_FALSE 0 17 const Sint32 SDL_PIXELFORMAT_RGBA5551 = 1; 18 const Sint32 SDL_PIXELFORMAT_RGB565 = 2; 19 const Sint32 SDL_PIXELFORMAT_RGB555 = 3; 20 21 const Sint32 SDL_RENDERER_ACCELERATED = 1; 22 const Sint32 SDL_RENDERER_PRESENTVSYNC = 2; 23 24 #define SDL_NUM_SCANCODES 512 25 26 typedef struct{ 27 Sint16 x, y; 28 Uint16 w, h; 29 } SDL_Rect; 30 31 #define SDL_TEXTEDITING 770 32 #define SDL_TEXTINPUT 771 33 #define SDL_KEYDOWN 768 34 #define SDL_KEYUP 769 35 #define SDL_MOUSEBUTTONDOWN 1025 36 #define SDL_MOUSEBUTTONUP 1026 37 #define SDL_MOUSEMOTION 1024 38 #define SDL_MOUSEWHEEL 1027 39 #define SDL_WINDOWEVENT 512 40 41 #define SDL_WINDOWEVENT_FOCUS_LOST 13 42 #define SDL_WINDOWEVENT_FOCUS_GAINED 12 43 44 #define SDL_BUTTON_LEFT 1 45 #define SDL_BUTTON_RIGHT 3 46 #define SDL_BUTTON_MIDDLE 2 47 48 const Sint32 SDL_PRESSED = 1; 49 50 const Sint32 SDL_SCANCODE_SPACE = 1; 51 const Sint32 KMOD_LSHIFT = 1; 52 const Sint32 KMOD_RSHIFT = 2; 53 const Sint32 KMOD_RALT = 3; 54 55 const Uint32 SDL_INIT_VIDEO = 1; 56 const Uint32 SDL_INIT_TIMER = 2; 57 const Sint32 SDL_WINDOWPOS_UNDEFINED = -1; 58 const Sint32 SDL_WINDOWPOS_CENTERED = -2; 59 const Uint32 SDL_WINDOW_RESIZABLE = 1; 60 const Uint32 SDL_WINDOW_OPENGL = 2; 61 const SDL_BlendMode SDL_BLENDMODE_NONE = 1; 62 63 typedef struct{ 64 SDL_Scancode scancode; 65 } SDL_Keysym; 66 67 typedef struct{ 68 SDL_Keysym keysym; 69 Uint8 state; 70 } SDL_KeyboardEvent; 71 72 typedef struct{ 73 Uint8 button; 74 Uint8 state; 75 Sint32 x,y; 76 } SDL_MouseButtonEvent; 77 78 typedef struct{ 79 Sint32 x, y; 80 Sint32 xrel, yrel; 81 } SDL_MouseMotionEvent; 82 83 typedef struct{ 84 Sint32 x, y; 85 } SDL_MouseWheelEvent; 86 87 typedef struct{} SDL_TouchFingerEvent; 88 89 typedef struct{ 90 char text[32]; 91 } SDL_TextEditingEvent; 92 93 typedef struct{ 94 char text[32]; 95 } SDL_TextInputEvent; 96 97 typedef struct{ 98 Uint8 event; 99 } SDL_WindowEvent; 100 101 typedef struct{ 102 int type; 103 SDL_TextEditingEvent edit; 104 SDL_TextInputEvent text; 105 SDL_KeyboardEvent key; 106 SDL_MouseButtonEvent button; 107 SDL_MouseMotionEvent motion; 108 SDL_MouseWheelEvent wheel; 109 SDL_WindowEvent window; 110 } SDL_Event; 111 112 const Uint32 SDL_WINDOW_FULLSCREEN_DESKTOP = 0; 113 114 typedef struct SDL_GLContext {} SDL_GLContext; 115 116 typedef struct SDL_Window { 117 Sint32 (*SetFullscreen)(Uint32 flags); 118 void (*GetSize)(Sint32 *w, Sint32 *h); 119 void (*GetPosition)(Sint32 *x, Sint32 *y); 120 void (*SetSize)(Sint32 w, Sint32 h); 121 void (*SetPosition)(Sint32 x, Sint32 y); 122 void (*Minimize)(void); 123 void (*Restore)(void); 124 void (*SetGrab)(SDL_bool); 125 void (*SetResizable)(SDL_bool); 126 void (*SetBordered)(SDL_bool); 127 void (*SetTitle)(const char*); 128 Sint32 (*GetDisplayIndex)(void); 129 void (*GLGetDrawableSize)(Sint32* w, Sint32* h); 130 void (*GLSwapWindow)(void); 131 SDL_GLContext (*GLCreateContext)(void); 132 } SDL_Window; 133 134 const char* SDL_GetError(void); 135 136 Uint32 SDL_GetTicks(void); 137 SDL_Window* SDL_CreateWindow(const char* title, Sint32 x, Sint32 y, Sint32 w, Sint32 h, Uint32 flags); 138 #define SDL_SetWindowFullscreen(win, flags) ((SDL_Window*)win)->SetFullscreen(flags) 139 #define SDL_SetWindowSize(win, w, h) ((SDL_Window*)win)->SetSize(w, h) 140 #define SDL_SetWindowPosition(win, x, y) ((SDL_Window*)win)->SetPosition(x, y) 141 #define SDL_SetWindowGrab(win, v) ((SDL_Window*)win)->SetGrab(v) 142 #define SDL_SetWindowTitle(win, v) ((SDL_Window*)win)->SetTitle(v) 143 #define SDL_MinimizeWindow(win) ((SDL_Window*)win)->Minimize() 144 #define SDL_RestoreWindow(win) ((SDL_Window*)win)->Restore() 145 #define SDL_GetWindowDisplayIndex(win) ((SDL_Window*)win)->GetDisplayIndex() 146 #define SDL_SetWindowResizable(win, v) ((SDL_Window*)win)->SetResizable(v) 147 #define SDL_SetWindowBordered(win, v) ((SDL_Window*)win)->SetBordered(v) 148 #define SDL_GetWindowPosition(win, x, y) ((SDL_Window*)win)->GetPosition(x, y) 149 #define SDL_GetWindowSize(win, w, h) ((SDL_Window*)win)->GetSize(w, h) 150 151 #define SDL_GL_GetDrawableSize(win, w, h) ((SDL_Window*)win)->GLGetDrawableSize(w, h) 152 #define SDL_GL_SwapWindow(win) ((SDL_Window*)win)->GLSwap() 153 #define SDL_GL_CreateContext(win) ((SDL_Window*)win)->GLCreateContext() 154 155 typedef struct SDL_Renderer { 156 void (*Destroy)(void); 157 void (*Present)(void); 158 } SDL_Renderer; 159 160 SDL_Renderer* SDL_CreateRenderer(SDL_Window* window, Sint32 index, Uint32 flags); 161 162 #define SDL_RenderPresent(r) ((SDL_Renderer*)r)->Present() 163 #define SDL_DestroyRenderer(r) ((SDL_Renderer*)r)->Destroy() 164 165 char *SDL_itoa(Sint32 value, char *str, Sint32 radix); 166 char *SDL_uitoa(Uint32 value, char *str, Sint32 radix); 167 void SDL_Delay(Uint32 ms); 168 169 typedef struct SDL_mutex { 170 void (*Lock)(void); 171 void (*Unlock)(void); 172 void (*Destroy)(void); 173 } SDL_mutex; 174 175 SDL_mutex* SDL_CreateMutex(void); 176 177 #define SDL_DestroyMutex(m) ((SDL_mutex*)m)->Destroy() 178 #define SDL_LockMutex(m) ((SDL_mutex*)m)->Lock() 179 #define SDL_UnlockMutex(m) ((SDL_mutex*)m)->Unlock() 180 181 182 typedef struct SDL_Surface { 183 Sint32 w, h; 184 Sint32 pitch; 185 void* pixels; 186 SDL_Rect clip_rect; 187 188 Sint32 (*Lock)(void); 189 void (*Unlock)(void); 190 void (*Free)(void); 191 Sint32 (*SetColorKey)(Sint32 flag, Uint32 key); 192 void (*GetClipRect)(SDL_Rect* rect); 193 Sint32 (*SetBlendMode)(SDL_BlendMode blendMode); 194 } SDL_Surface; 195 196 SDL_Surface* SDL_CreateRGBSurfaceWithFormat(Uint32 flags, Sint32 width, Sint32 height, Sint32 depth, Uint32 format); 197 198 #define SDL_LockSurface(s) ((SDL_Surface*)s)->Lock() 199 #define SDL_UnlockSurface(s) ((SDL_Surface*)s)->Unlock() 200 #define SDL_FreeSurface(s) ((SDL_Surface*)s)->Free() 201 #define SDL_SetColorKey(s, f, k) ((SDL_Surface*)s)->SetColorKey(f, k) 202 #define SDL_GetClipRect(s, r) ((SDL_Surface*)s)->GetClipRect(r) 203 #define SDL_SetSurfaceBlendMode(s, m) ((SDL_Surface*)s)->SetBlendMode(m) 204 Sint32 SDL_BlitSurface(SDL_Surface* src, const SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect); 205 Sint32 SDL_BlitScaled(SDL_Surface* src, const SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect); 206 207 typedef struct SDL_Texture { 208 void (*Destroy)(void); 209 } SDL_Texture; 210 SDL_Texture* SDL_CreateTextureFromSurface(SDL_Renderer* renderer, SDL_Surface* surface); 211 #define SDL_DestroyTexture(t) ((SDL_Texture*)t)->Destroy() 212 213 Sint32 SDL_RenderCopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect); 214 215 216 Sint32 SDL_GL_SetSwapInterval(Sint32 interval); 217 void SDL_GL_DeleteContext(SDL_GLContext context); 218 Sint32 SDL_Init(Uint32 flags); 219 Sint32 SDL_PollEvent(SDL_Event* event); 220 void SDL_StartTextInput(void); 221 void SDL_StopTextInput(void); 222 SDL_Keymod SDL_GetModState(void); 223 Sint32 SDL_SetRelativeMouseMode(SDL_bool enabled); 224 Uint8 SDL_GetEventState(Uint32 type); 225 Uint32 SDL_GetGlobalMouseState(int* x, int* y); 226 Sint32 SDL_GetDisplayBounds(Sint32 displayIndex, SDL_Rect* rect); 227 228 typedef Uint32 (*SDL_TimerCallback)(Uint32 interval, void* param); 229 SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void* param); 230 SDL_bool SDL_RemoveTimer(SDL_TimerID id);