ref: fd731d3c833d9241fdff618b6c949453fb5c0f31
dir: /SDL2/SDL.h/
#ifndef _SDL_h_ #define _SDL_h_ #include "plan9.h" #include <keyboard.h> typedef int SDL_AudioDeviceID; typedef struct SDL_AudioSpec SDL_AudioSpec; typedef struct SDL_Window SDL_Window; typedef struct SDL_Renderer SDL_Renderer; typedef struct SDL_Texture SDL_Texture; typedef struct SDL_Surface SDL_Surface; typedef struct SDL_Rect SDL_Rect; typedef int SDL_Keycode; typedef int SDL_Scancode; typedef int SDL_Keymod; typedef struct SDL_Event SDL_Event; typedef u8int Uint8; typedef u16int Uint16; typedef u32int Uint32; typedef int SDL_BlendMode; typedef struct SDL_Thread SDL_Thread; typedef int (*SDL_ThreadFunction)(void *); typedef struct SDL_Cursor SDL_Cursor; typedef struct SDL_PixelFormat SDL_PixelFormat; typedef struct SDL_Point SDL_Point; typedef int SDL_RendererFlip; typedef struct SDL_DisplayMode SDL_DisplayMode; #pragma incomplete SDL_Cursor #pragma incomplete SDL_PixelFormat #pragma incomplete SDL_Renderer #pragma incomplete SDL_Texture #pragma incomplete SDL_Thread #pragma incomplete SDL_Window typedef enum {SDL_FALSE, SDL_TRUE} SDL_bool; #define SDLCALL void SDL_StopTextInput(void); SDL_bool SDL_HasSSE(void); SDL_bool SDL_HasSSE2(void); int SDL_Init(int); int SDL_EventState(Uint32, int); SDL_Keymod SDL_GetModState(void); char *SDL_GetAudioDeviceName(int, SDL_bool); int SDL_GetNumAudioDevices(int iscapture); int SDL_ShowCursor(int toggle); void SDL_LockAudioDevice(SDL_AudioDeviceID); void SDL_UnlockAudioDevice(SDL_AudioDeviceID); void SDL_PauseAudioDevice(SDL_AudioDeviceID, SDL_bool); void SDL_CloseAudioDevice(SDL_AudioDeviceID); SDL_AudioDeviceID SDL_OpenAudioDevice(char *, int, SDL_AudioSpec *, SDL_AudioSpec *, u32int); u64int SDL_GetPerformanceFrequency(void); u64int SDL_GetPerformanceCounter(void); char *SDL_GetError(void); SDL_Thread *SDL_CreateThread(SDL_ThreadFunction, char *, void *); void SDL_DetachThread(SDL_Thread *); char *SDL_GetClipboardText(void); int SDL_SetClipboardText(char *); void SDL_SetThreadPriority(int); SDL_bool SDL_HasClipboardText(void); int SDL_PollEvent(SDL_Event *event); void SDL_RestoreWindow(SDL_Window *window); void SDL_RaiseWindow(SDL_Window *window); int SDL_UpdateTexture(SDL_Texture *texture, SDL_Rect *rect, void *pixels, int pitch); int SDL_RenderClear(SDL_Renderer *renderer); int SDL_GetWindowDisplayIndex(SDL_Window *window); void SDL_FreeSurface(SDL_Surface *surface); Uint32 SDL_GetGlobalMouseState(int *x, int *y); void SDL_Quit(void); void SDL_free(void *); SDL_Cursor *SDL_GetDefaultCursor(void); void SDL_SetCursor(SDL_Cursor *cursor); void SDL_FreeCursor(SDL_Cursor *cursor); SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 rm, Uint32 gm, Uint32 bm, Uint32 am); SDL_Surface *SDL_CreateRGBSurfaceFrom(Uint32 *pixels, int w, int h, int bpp, int pitch, Uint32 rm, Uint32 gm, Uint32 bm, Uint32 am); Uint32 SDL_MapRGB(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b); int SDL_SetColorKey(SDL_Surface *surface, int flag, Uint32 key); int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag); int SDL_LockSurface(SDL_Surface *surface); int SDL_UnlockSurface(SDL_Surface *surface); int SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode); SDL_Cursor *SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y); int SDL_PushEvent(SDL_Event *event); void SDL_WarpMouseInWindow(SDL_Window *window, int x, int y); void SDL_RenderGetScale(SDL_Renderer *renderer, float *scaleX, float *scaleY); void SDL_GetWindowSize(SDL_Window *window, int *w, int *h); void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y); Uint32 SDL_GetMouseState(int *x, int *y); SDL_bool SDL_IsTextInputActive(void); void SDL_StartTextInput(void); void SDL_Delay(Uint32 ms); int SDL_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, SDL_Rect *srcrect, SDL_Rect *dstrect); void SDL_RenderPresent(SDL_Renderer *renderer); Uint32 SDL_GetWindowFlags(SDL_Window *window); int SDL_RenderSetLogicalSize(SDL_Renderer *renderer, int w, int h); void SDL_SetWindowSize(SDL_Window *window, int w, int h); int SDL_ShowSimpleMessageBox(Uint32 flags, char *title, char *message, SDL_Window *window); int SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags); void SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed); void SDL_SetWindowPosition(SDL_Window *window, int x, int y); void SDL_DestroyTexture(SDL_Texture *texture); void SDL_DestroyRenderer(SDL_Renderer *renderer); void SDL_DestroyWindow(SDL_Window *window); int SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode *mode); void SDL_SetWindowTitle(SDL_Window *window, char *title); int SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode); SDL_bool SDL_SetHint(char *name, char *value); SDL_Window *SDL_CreateWindow(char *title, int x, int y, int w, int h, Uint32 flags); SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags); int SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode); char *SDL_GetCurrentVideoDriver(void); SDL_Texture *SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h); void SDL_EnableScreenSaver(void); Uint32 SDL_GetTicks(void); int SDL_GetRendererOutputSize(SDL_Renderer *renderer, int *w, int *h); int SDL_SaveBMP(SDL_Surface *s, const char *file); enum { AUDIO_S16, AUDIO_F32, SDL_AUDIO_ALLOW_ANY_CHANGE = ~0, SDL_THREAD_PRIORITY_HIGH = 1, SDL_QUERY = -1, SDL_DISABLE, SDL_ENABLE, SDL_MESSAGEBOX_ERROR = 0, SDL_WINDOW_MINIMIZED = 1<<0, SDL_WINDOW_FULLSCREEN_DESKTOP = 1<<1, SDL_WINDOW_INPUT_FOCUS = 1<<2, SDL_WINDOW_ALLOW_HIGHDPI = 1<<3, SDL_WINDOW_SHOWN = 1<<4, SDL_WINDOWPOS_CENTERED = -1, SDL_WINDOWPOS_UNDEFINED = -2, SDL_INIT_AUDIO = 1<<0, SDL_INIT_VIDEO = 1<<1, SDL_INIT_JOYSTICK = 1<<2, SDL_BLENDMODE_NONE = 0, SDL_FLIP_NONE = 0, SDL_FLIP_HORIZONTAL, SDL_FLIP_VERTICAL, SDL_PIXELFORMAT_ARGB8888 = 0x30128888, /* shit no one cares about */ SDL_TEXTUREACCESS_STREAMING = 0, SDL_TEXTUREACCESS_STATIC = 0, SDL_RENDERER_ACCELERATED = 0, SDL_RENDERER_PRESENTVSYNC = 0, }; enum { /* these HAVE to be in this order for notes to work in ft2-clone */ SDL_SCANCODE_A = 0x04, SDL_SCANCODE_B, SDL_SCANCODE_C, SDL_SCANCODE_D, SDL_SCANCODE_E, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_I, SDL_SCANCODE_J, SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_M, SDL_SCANCODE_N, SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_Q, SDL_SCANCODE_R, SDL_SCANCODE_S, SDL_SCANCODE_T, SDL_SCANCODE_U, SDL_SCANCODE_V, SDL_SCANCODE_W, SDL_SCANCODE_X, SDL_SCANCODE_Y, SDL_SCANCODE_Z, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_ENTER, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, SDL_SCANCODE_SPACE, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_NONUSHASH, SDL_SCANCODE_SEMICOLON, SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_SLASH, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_RIGHT = 0x4f, SDL_SCANCODE_LEFT, SDL_SCANCODE_DOWN, SDL_SCANCODE_UP, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_KP_DIVIDE, SDL_SCANCODE_KP_MULTIPLY, SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_KP_ENTER, SDL_SCANCODE_KP_1, SDL_SCANCODE_KP_2, SDL_SCANCODE_KP_3, SDL_SCANCODE_KP_4, SDL_SCANCODE_KP_5, SDL_SCANCODE_KP_6, SDL_SCANCODE_KP_7, SDL_SCANCODE_KP_8, SDL_SCANCODE_KP_9, SDL_SCANCODE_KP_0, SDL_SCANCODE_KP_PERIOD, SDL_SCANCODE_NONUSBACKSLASH, SDL_SCANCODE_MUTE = 0x7f, SDL_SCANCODE_VOLUMEUP, SDL_SCANCODE_VOLUMEDOWN, SDL_SCANCODE_AUDIOMUTE = 0x106, SDLK_a = 'a', SDLK_b, SDLK_c, SDLK_d, SDLK_e, SDLK_f, SDLK_g, SDLK_h, SDLK_i, SDLK_j, SDLK_k, SDLK_l, SDLK_m, SDLK_n, SDLK_o, SDLK_p, SDLK_q, SDLK_r, SDLK_s, SDLK_t, SDLK_u, SDLK_v, SDLK_w, SDLK_x, SDLK_y, SDLK_z, SDLK_0 = '0', SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_DELETE = Kdel, SDLK_RETURN = '\n', SDLK_ESCAPE = Kesc, SDLK_LESS = '<', SDLK_SPACE = ' ', SDLK_TAB = '\t', SDLK_LEFT = Kleft, SDLK_RIGHT = Kright, SDLK_DOWN = Kdown, SDLK_UP = Kup, SDLK_F1 = KF|1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8, SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12, SDLK_INSERT = Kins, SDLK_PAGEUP = Kpgup, SDLK_PAGEDOWN = Kpgdown, SDLK_HOME = Khome, SDLK_END = Kend, SDLK_BACKSPACE = Kbs, SDLK_MINUS = '-', SDLK_PLUS = '+', SDLK_EQUALS = '=', SDLK_UNDERSCORE = '_', SDLK_LALT = Kalt, SDLK_RALT = Kaltgr, /* FIXME what about keyboards without it? */ /* FIXME no distinction */ SDLK_LSHIFT = Kshift, SDLK_RSHIFT = SDLK_LSHIFT, SDLK_LCTRL = Kctl, SDLK_RCTRL = '>', /* FIXME this is a hack */ /* FIXME not bound to anything */ SDLK_UNKNOWN = -99999, SDLK_CAPSLOCK, SDLK_KP_ENTER, /* FIXME no distinction */ KMOD_LSHIFT = 1<<0, KMOD_RSHIFT = KMOD_LSHIFT, KMOD_LCTRL = 1<<1, KMOD_RCTRL = KMOD_LCTRL, KMOD_LALT = 1<<2, KMOD_RALT = KMOD_LALT, KMOD_LGUI = 1<<3, KMOD_RGUI = KMOD_LGUI, SDL_KEYDOWN = 0, SDL_KEYUP, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, SDL_MOUSEWHEEL, SDL_MOUSEMOTION, SDL_QUIT, SDL_DROPFILE, SDL_TEXTINPUT, SDL_WINDOWEVENT, SDL_WINDOWEVENT_HIDDEN, SDL_WINDOWEVENT_SHOWN, SDL_WINDOWEVENT_MINIMIZED, SDL_WINDOWEVENT_FOCUS_LOST, SDL_WINDOWEVENT_EXPOSED, SDL_BUTTON_LEFT = 0, SDL_BUTTON_MIDDLE = 1, SDL_BUTTON_RIGHT = 2, SDL_BUTTON_LMASK = 1<<SDL_BUTTON_LEFT, SDL_BUTTON_MMASK = 1<<SDL_BUTTON_MIDDLE, SDL_BUTTON_RMASK = 1<<SDL_BUTTON_RIGHT, }; struct SDL_AudioSpec { void (*callback)(void *, Uint8 *, int); void *userdata; int freq; int format; int channels; int samples; }; struct SDL_Point { int x, y; }; struct SDL_Rect { int x, y, w, h; }; struct SDL_Surface { SDL_PixelFormat *format; SDL_Rect clip_rect; Uint32 flags; Uint32 key; int keyset; int w, h; int pitch; uchar pixels[]; }; struct SDL_Event { int type; union { struct { int event; }window; struct { struct { SDL_Scancode scancode; SDL_Keycode sym; }keysym; int repeat; }key; struct { int x, y; int button; }button; struct { int x, y; }motion; struct { char text[UTFmax+1]; }text; struct { int x, y; }wheel; struct { char *file; }drop; }; }; struct SDL_DisplayMode { int format; int w; int h; int refresh_rate; }; #endif