30 "[--video driver] [--renderer driver] [--gldebug] [--info all|video|modes|render|event] [--log all|error|system|audio|video|render|input] [--display N] [--fullscreen | --fullscreen-desktop | --windows N] [--title title] [--icon icon.bmp] [--center | --position X,Y] [--geometry WxH] [--min-geometry WxH] [--max-geometry WxH] [--logical WxH] [--scale N] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab] [--allow-highdpi]" 33 "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" 54 for (i = 1; argv[
i]; ++
i) {
108 char **argv = state->
argv;
263 while (*y && *y !=
',') {
282 while (*h && *h !=
'x') {
301 while (*h && *h !=
'x') {
320 while (*h && *h !=
'x') {
339 while (*h && *h !=
'x') {
470 if (
SDL_strcmp(argv[index],
"-NSDocumentRevisionsDebugMode") == 0) {
488 return "[--trackmem]";
631 for (i = 0; i <
sizeof(info->
flags) * 8; ++
i) {
633 if (info->
flags & flag) {
654 SDL_Log(
" Max Texture Size: %dx%d\n",
684 const int DRAGGABLE_TITLE = 32;
690 if (area->
x < RESIZE_BORDER) {
691 if (area->
y < RESIZE_BORDER) {
692 SDL_Log(
"SDL_HITTEST_RESIZE_TOPLEFT\n");
694 }
else if (area->
y >= (h-RESIZE_BORDER)) {
695 SDL_Log(
"SDL_HITTEST_RESIZE_BOTTOMLEFT\n");
698 SDL_Log(
"SDL_HITTEST_RESIZE_LEFT\n");
701 }
else if (area->
x >= (w-RESIZE_BORDER)) {
702 if (area->
y < RESIZE_BORDER) {
703 SDL_Log(
"SDL_HITTEST_RESIZE_TOPRIGHT\n");
705 }
else if (area->
y >= (h-RESIZE_BORDER)) {
706 SDL_Log(
"SDL_HITTEST_RESIZE_BOTTOMRIGHT\n");
709 SDL_Log(
"SDL_HITTEST_RESIZE_RIGHT\n");
712 }
else if (area->
y >= (h-RESIZE_BORDER)) {
713 SDL_Log(
"SDL_HITTEST_RESIZE_BOTTOM\n");
715 }
else if (area->
y < RESIZE_BORDER) {
716 SDL_Log(
"SDL_HITTEST_RESIZE_TOP\n");
718 }
else if (area->
y < DRAGGABLE_TITLE) {
719 SDL_Log(
"SDL_HITTEST_DRAGGABLE\n");
736 SDL_Log(
"No built-in video drivers\n");
738 SDL_snprintf(text,
sizeof(text),
"Built-in video drivers:");
739 for (i = 0; i <
n; ++
i) {
749 SDL_Log(
"Couldn't initialize video driver: %s\n",
796 Uint32 Rmask, Gmask, Bmask, Amask;
797 #if SDL_VIDEO_DRIVER_WINDOWS 798 int adapterIndex = 0;
802 SDL_Log(
"Number of displays: %d\n", n);
803 for (i = 0; i <
n; ++
i) {
814 SDL_Log(
"Bounds: %dx%d at %d,%d\n", bounds.
w, bounds.
h, bounds.
x, bounds.
y);
815 SDL_Log(
"Usable bounds: %dx%d at %d,%d\n", usablebounds.
w, usablebounds.
h, usablebounds.
x, usablebounds.
y);
816 SDL_Log(
"DPI: %fx%f\n", hdpi, vdpi);
821 SDL_Log(
" Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
824 if (Rmask || Gmask || Bmask) {
825 SDL_Log(
" Red Mask = 0x%.8x\n", Rmask);
826 SDL_Log(
" Green Mask = 0x%.8x\n", Gmask);
827 SDL_Log(
" Blue Mask = 0x%.8x\n", Bmask);
829 SDL_Log(
" Alpha Mask = 0x%.8x\n", Amask);
835 SDL_Log(
"No available fullscreen video modes\n");
837 SDL_Log(
" Fullscreen video modes:\n");
838 for (j = 0; j <
m; ++
j) {
841 &Gmask, &Bmask, &Amask);
842 SDL_Log(
" Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
845 if (Rmask || Gmask || Bmask) {
846 SDL_Log(
" Red Mask = 0x%.8x\n",
848 SDL_Log(
" Green Mask = 0x%.8x\n",
850 SDL_Log(
" Blue Mask = 0x%.8x\n",
853 SDL_Log(
" Alpha Mask = 0x%.8x\n",
859 #if SDL_VIDEO_DRIVER_WINDOWS 862 SDL_Log(
"D3D9 Adapter Index: %d", adapterIndex);
866 SDL_Log(
"DXGI Adapter Index: %d Output Index: %d", adapterIndex, outputIndex);
876 SDL_Log(
"No built-in render drivers\n");
878 SDL_Log(
"Built-in render drivers:\n");
879 for (i = 0; i <
n; ++
i) {
887 switch (state->
depth) {
933 SDL_Log(
"Couldn't create window: %s\n",
946 printf(
"Window requested size %dx%d, got %dx%d\n", state->
window_w, state->
window_h, w, h);
951 SDL_Log(
"Can't set up fullscreen display mode: %s\n",
979 for (j = 0; j <
n; ++
j) {
988 SDL_Log(
"Couldn't find render driver named %s",
996 SDL_Log(
"Couldn't create renderer: %s\n",
1002 }
else if (state->
scale) {
1008 SDL_Log(
"Current renderer:\n");
1020 SDL_Log(
"No built-in audio drivers\n");
1022 SDL_snprintf(text,
sizeof(text),
"Built-in audio drivers:");
1023 for (i = 0; i <
n; ++
i) {
1033 SDL_Log(
"Couldn't initialize audio driver: %s\n",
1056 #define AXIS_CASE(ax) case SDL_CONTROLLER_AXIS_##ax: return #ax 1065 default:
return "???";
1074 #define BUTTON_CASE(btn) case SDL_CONTROLLER_BUTTON_##btn: return #btn 1092 default:
return "???";
1104 switch (event->
type) {
1117 SDL_Log(
"SDL EVENT: Window %d moved to %d,%d",
1122 SDL_Log(
"SDL EVENT: Window %d resized to %dx%d",
1127 SDL_Log(
"SDL EVENT: Window %d changed size to %dx%d",
1141 SDL_Log(
"SDL EVENT: Mouse entered window %d",
1148 SDL_Log(
"SDL EVENT: Window %d gained keyboard focus",
1152 SDL_Log(
"SDL EVENT: Window %d lost keyboard focus",
1165 SDL_Log(
"SDL EVENT: Window %d got unknown event 0x%4.4x",
1171 SDL_Log(
"SDL EVENT: Keyboard: key pressed in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
1178 SDL_Log(
"SDL EVENT: Keyboard: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
1185 SDL_Log(
"SDL EVENT: Keyboard: text editing \"%s\" in window %d",
1189 SDL_Log(
"SDL EVENT: Keyboard: text input \"%s\" in window %d",
1193 SDL_Log(
"SDL EVENT: Keymap changed");
1196 SDL_Log(
"SDL EVENT: Mouse: moved to %d,%d (%d,%d) in window %d",
1202 SDL_Log(
"SDL EVENT: Mouse: button %d pressed at %d,%d with click count %d in window %d",
1207 SDL_Log(
"SDL EVENT: Mouse: button %d released at %d,%d with click count %d in window %d",
1212 SDL_Log(
"SDL EVENT: Mouse: wheel scrolled %d in x and %d in y (reversed: %d) in window %d",
1216 SDL_Log(
"SDL EVENT: Joystick index %d attached",
1220 SDL_Log(
"SDL EVENT: Joystick %d removed",
1224 SDL_Log(
"SDL EVENT: Joystick %d: ball %d moved by %d,%d",
1230 const char *position =
"UNKNOWN";
1233 position =
"CENTER";
1239 position =
"RIGHTUP";
1245 position =
"RIGHTDOWN";
1251 position =
"LEFTDOWN";
1257 position =
"LEFTUP";
1265 SDL_Log(
"SDL EVENT: Joystick %d: button %d pressed",
1269 SDL_Log(
"SDL EVENT: Joystick %d: button %d released",
1273 SDL_Log(
"SDL EVENT: Controller index %d attached",
1277 SDL_Log(
"SDL EVENT: Controller %d removed",
1281 SDL_Log(
"SDL EVENT: Controller %d axis %d ('%s') value: %d",
1288 SDL_Log(
"SDL EVENT: Controller %d button %d ('%s') down",
1293 SDL_Log(
"SDL EVENT: Controller %d button %d ('%s') up",
1298 SDL_Log(
"SDL EVENT: Clipboard updated");
1302 SDL_Log(
"SDL EVENT: Finger: motion touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
1310 SDL_Log(
"SDL EVENT: Finger: %s touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
1328 SDL_Log(
"SDL EVENT: render device reset");
1331 SDL_Log(
"SDL EVENT: render targets reset");
1335 SDL_Log(
"SDL EVENT: App terminating");
1338 SDL_Log(
"SDL EVENT: App running low on memory");
1341 SDL_Log(
"SDL EVENT: App will enter the background");
1344 SDL_Log(
"SDL EVENT: App entered the background");
1347 SDL_Log(
"SDL EVENT: App will enter the foreground");
1350 SDL_Log(
"SDL EVENT: App entered the foreground");
1354 SDL_Log(
"SDL EVENT: Quit requested");
1378 0x00FF0000, 0x0000FF00, 0x000000FF,
1380 0x000000FF, 0x0000FF00, 0x00FF0000,
1406 struct SDL_Rect rect = { 0, 0, 0, 0 };
1434 switch (event->
type) {
1442 if (window == state->
windows[i]) {
1472 if (window == state->
windows[i]) {
1512 if (currentIndex >= 0 && numDisplays >= 1) {
1515 dest = (currentIndex + numDisplays - 1) % numDisplays;
1517 dest = (currentIndex + numDisplays + 1) % numDisplays;
1519 SDL_Log(
"Centering on display %d\n", dest);
1530 const int delta = 100;
1539 SDL_Log(
"Setting position to (%d, %d)\n", x, y);
1566 printf(
"Copied text to clipboard\n");
1593 SDL_Log(
"%sapturing mouse %s!\n", shouldCapture ?
"C" :
"Unc", (rc == 0) ?
"succeeded" :
"failed");
1602 printf(
"Clipboard: %s\n", text);
1604 printf(
"Clipboard is empty\n");
1659 }
else if (withAlt) {
1670 }
else if (withShift) {
1700 SDL_Log(
"ABSOLUTE MOUSE: (%d, %d)%s%s%s%s%s\n", x, y,
1732 SDL_snprintf(message,
sizeof(message),
"(%i, %i), rel (%i, %i)\n", lastEvent.
x, lastEvent.
y, lastEvent.
xrel, lastEvent.
yrel);
1745 lastEvent =
event->motion;
#define SDL_WINDOWPOS_ISUNDEFINED(X)
#define SDL_RenderReadPixels
#define SDL_GetNumAudioDrivers
SDL_MouseMotionEvent motion
#define SDL_SetWindowMaximumSize
#define SDL_WINDOWPOS_CENTERED
#define SDL_GetWindowDisplayIndex
#define SDL_GetNumVideoDrivers
SDL_ControllerAxisEvent caxis
SDL_JoyDeviceEvent jdevice
#define SDL_SetWindowDisplayMode
static SDL_Surface * SDLTest_LoadIcon(const char *file)
SDL_DollarGestureEvent dgesture
#define SDL_RenderGetClipRect
#define SDL_GetDisplayMode
SDL_bool SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputIndex)
Returns the DXGI Adapter and Output indices for the specified display index.
static void SDLTest_PrintRendererFlag(char *text, size_t maxlen, Uint32 flag)
#define SDL_SetWindowFullscreen
#define SDL_SetWindowMinimumSize
SDL_ControllerDeviceEvent cdevice
#define SDL_LoadBMP(file)
GLint GLint GLint GLint GLint x
GLuint GLsizei const GLchar * message
SDL_JoyButtonEvent jbutton
GLuint GLuint GLsizei count
#define SDL_BUTTON_X2MASK
#define SDL_GetNumRenderDrivers
GLfloat GLfloat GLfloat GLfloat h
#define SDL_SetWindowSize
The structure that defines a point.
A collection of pixels used in software blitting.
#define SDL_GetDesktopDisplayMode
#define SDL_GetDisplayName
Uint32 texture_formats[16]
The structure that defines a display mode.
#define SDL_GetWindowFlags
#define SDL_WINDOWPOS_ISCENTERED(X)
#define SDL_SaveBMP(surface, file)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
Open test window.
const char * renderdriver
#define SDL_WINDOWPOS_UNDEFINED
int SDLTest_TrackAllocations()
Start tracking SDL memory allocations.
#define SDL_SetRelativeMouseMode
#define SDL_GetKeyboardFocus
#define SDL_MinimizeWindow
#define SDL_GetRenderDriverInfo
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
Returns true if the rectangle has no area.
SDL_MouseWheelEvent wheel
#define SDL_GetDisplayUsableBounds
#define SDL_SetWindowIcon
#define SDL_GetNumVideoDisplays
int SDL_Direct3D9GetAdapterIndex(int displayIndex)
Returns the D3D9 adapter index that matches the specified display index.
SDL_HitTestResult
Possible return values from the SDL_HitTest callback.
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
#define SDL_GL_SetAttribute
#define SDL_GetWindowSize
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) int return int return int size_t return size_t return const wchar_t return const wchar_t size_t retur SDL_OUT_Z_CAP)(c) char *a
#define SDL_GetRelativeMouseMode
static void SDL_snprintfcat(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt,...)
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]
#define SDL_ShowSimpleMessageBox
#define SDL_GetClipboardText
#define SDL_HAT_RIGHTDOWN
static const char * ControllerButtonName(const SDL_GameControllerButton button)
int gl_multisamplebuffers
#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)
static void SDLTest_PrintRenderer(SDL_RendererInfo *info)
#define SDL_SetWindowGrab
static SDL_Renderer * renderer
SDL_MultiGestureEvent mgesture
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
Common event handler for test windows.
#define SDL_RenderSetLogicalSize
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
void SDLTest_CommonQuit(SDLTest_CommonState *state)
Close test window.
#define SDL_SetWindowOpacity
#define SDL_BUTTON_X1MASK
#define SDL_RenderGetViewport
GLubyte GLubyte GLubyte GLubyte w
#define SDL_GetDisplayBounds
SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags)
Parse command line parameters and create common state.
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]
int gl_multisamplesamples
#define DEFAULT_WINDOW_HEIGHT
#define SDL_GetWindowPosition
GLint GLint GLint GLint GLint GLint y
#define SDL_GetAudioDriver
#define SDL_PixelFormatEnumToMasks
#define SDL_GetWindowFromID
#define SDL_RenderSetScale
#define SDL_RestoreWindow
SDL_Renderer ** renderers
static void SDLTest_PrintEvent(SDL_Event *event)
#define SDL_WINDOWPOS_CENTERED_DISPLAY(X)
const char * SDLTest_CommonUsage(SDLTest_CommonState *state)
Returns common usage information.
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
#define SDL_LogSetPriority
#define SDL_GetWindowOpacity
#define SDL_GetCurrentAudioDriver
#define SDL_OutOfMemory()
#define SDL_GetCurrentVideoDriver
#define SDL_SetWindowBordered
SDL_TextEditingEvent edit
#define SDL_GetVideoDriver
Information on the capabilities of a render driver or context.
static char text[MAX_TEXT_LENGTH]
Mouse motion event structure (event.motion.*)
#define SDL_CreateRGBSurface
#define SDL_GetScancodeName
EGLSurface EGLNativeWindowType * window
#define SDL_DestroyTexture
SDL_ControllerButtonEvent cbutton
#define SDL_SetWindowHitTest
The type used to identify a window.
#define SDL_GetWindowGrab
static const char * ControllerAxisName(const SDL_GameControllerAxis axis)
#define SDL_GetGlobalMouseState
#define SDL_LogSetAllPriority
SDL_MouseButtonEvent button
static void SDLTest_PrintPixelFormat(char *text, size_t maxlen, Uint32 format)
static void SDLTest_ScreenShot(SDL_Renderer *renderer)
#define SDL_GetDisplayDPI
Uint32 num_texture_formats
#define SDL_arraysize(array)
#define SDL_RenderSetClipRect
#define SDL_GetNumDisplayModes
#define SDL_DestroyRenderer
#define SDL_MaximizeWindow
static void FullscreenTo(int index, int windowId)
#define SDL_PRINTF_FORMAT_STRING
GLuint GLsizei GLsizei * length
#define SDL_DestroyWindow
GLboolean GLboolean GLboolean b
#define DEFAULT_WINDOW_WIDTH
#define SDL_SetWindowPosition
#define SDL_CreateRenderer
A rectangle, with the origin at the upper left.
#define SDL_GetRendererInfo
void SDLTest_LogAllocations()
Print a log of any outstanding allocations.
int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
Process one common argument.
#define SDL_SetClipboardText
static SDL_HitTestResult SDLTest_ExampleHitTestCallback(SDL_Window *win, const SDL_Point *area, void *data)
SDL_TouchFingerEvent tfinger
const char * window_title
#define SDL_GetPixelFormatName