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-hidpi]"
33 "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]"
85 char **argv = state->
argv;
240 while (*y && *y !=
',') {
259 while (*h && *h !=
'x') {
278 while (*h && *h !=
'x') {
297 while (*h && *h !=
'x') {
316 while (*h && *h !=
'x') {
443 if (
SDL_strcmp(argv[index],
"-NSDocumentRevisionsDebugMode") == 0) {
470 fprintf(stderr,
"PresentVSync");
473 fprintf(stderr,
"Accelerated");
476 fprintf(stderr,
"0x%8.8x", flag);
486 fprintf(stderr,
"Unknwon");
489 fprintf(stderr,
"Index1LSB");
492 fprintf(stderr,
"Index1MSB");
495 fprintf(stderr,
"Index4LSB");
498 fprintf(stderr,
"Index4MSB");
501 fprintf(stderr,
"Index8");
504 fprintf(stderr,
"RGB332");
507 fprintf(stderr,
"RGB444");
510 fprintf(stderr,
"RGB555");
513 fprintf(stderr,
"BGR555");
516 fprintf(stderr,
"ARGB4444");
519 fprintf(stderr,
"ABGR4444");
522 fprintf(stderr,
"ARGB1555");
525 fprintf(stderr,
"ABGR1555");
528 fprintf(stderr,
"RGB565");
531 fprintf(stderr,
"BGR565");
534 fprintf(stderr,
"RGB24");
537 fprintf(stderr,
"BGR24");
540 fprintf(stderr,
"RGB888");
543 fprintf(stderr,
"BGR888");
546 fprintf(stderr,
"ARGB8888");
549 fprintf(stderr,
"RGBA8888");
552 fprintf(stderr,
"ABGR8888");
555 fprintf(stderr,
"BGRA8888");
558 fprintf(stderr,
"ARGB2101010");
561 fprintf(stderr,
"YV12");
564 fprintf(stderr,
"IYUV");
567 fprintf(stderr,
"YUY2");
570 fprintf(stderr,
"UYVY");
573 fprintf(stderr,
"YVYU");
576 fprintf(stderr,
"0x%8.8x", format);
586 fprintf(stderr,
" Renderer %s:\n", info->
name);
588 fprintf(stderr,
" Flags: 0x%8.8X", info->
flags);
589 fprintf(stderr,
" (");
591 for (i = 0; i <
sizeof(info->
flags) * 8; ++
i) {
593 if (info->
flags & flag) {
595 fprintf(stderr,
" | ");
601 fprintf(stderr,
")\n");
606 fprintf(stderr,
", ");
610 fprintf(stderr,
"\n");
613 fprintf(stderr,
" Max Texture Size: %dx%d\n",
626 fprintf(stderr,
"Couldn't load %s: %s\n", file,
SDL_GetError());
648 fprintf(stderr,
"No built-in video drivers\n");
650 fprintf(stderr,
"Built-in video drivers:");
651 for (i = 0; i <
n; ++
i) {
653 fprintf(stderr,
",");
657 fprintf(stderr,
"\n");
661 fprintf(stderr,
"Couldn't initialize video driver: %s\n",
666 fprintf(stderr,
"Video driver: %s\n",
703 Uint32 Rmask, Gmask, Bmask, Amask;
704 #if SDL_VIDEO_DRIVER_WINDOWS
705 int adapterIndex = 0;
708 fprintf(stderr,
"Number of displays: %d\n", n);
709 for (i = 0; i <
n; ++
i) {
714 fprintf(stderr,
"Bounds: %dx%d at %d,%d\n", bounds.
w, bounds.
h, bounds.
x, bounds.
y);
720 " Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
723 if (Rmask || Gmask || Bmask) {
724 fprintf(stderr,
" Red Mask = 0x%.8x\n", Rmask);
725 fprintf(stderr,
" Green Mask = 0x%.8x\n", Gmask);
726 fprintf(stderr,
" Blue Mask = 0x%.8x\n", Bmask);
728 fprintf(stderr,
" Alpha Mask = 0x%.8x\n", Amask);
734 fprintf(stderr,
"No available fullscreen video modes\n");
736 fprintf(stderr,
" Fullscreen video modes:\n");
737 for (j = 0; j <
m; ++
j) {
740 &Gmask, &Bmask, &Amask);
742 " Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
745 if (Rmask || Gmask || Bmask) {
746 fprintf(stderr,
" Red Mask = 0x%.8x\n",
748 fprintf(stderr,
" Green Mask = 0x%.8x\n",
750 fprintf(stderr,
" Blue Mask = 0x%.8x\n",
754 " Alpha Mask = 0x%.8x\n",
760 #if SDL_VIDEO_DRIVER_WINDOWS
762 adapterIndex = SDL_Direct3D9GetAdapterIndex( i );
763 fprintf( stderr,
"Adapter Index: %d", adapterIndex );
773 fprintf(stderr,
"No built-in render drivers\n");
775 fprintf(stderr,
"Built-in render drivers:\n");
776 for (i = 0; i <
n; ++
i) {
784 switch (state->
depth) {
810 fprintf(stderr,
"Out of memory!\n");
827 fprintf(stderr,
"Couldn't create window: %s\n",
840 printf(
"Window requested size %dx%d, got %dx%d\n", state->
window_w, state->
window_h, w, h);
845 fprintf(stderr,
"Can't set up fullscreen display mode: %s\n",
869 for (j = 0; j <
n; ++
j) {
879 "Couldn't find render driver named %s",
887 fprintf(stderr,
"Couldn't create renderer: %s\n",
893 }
else if (state->
scale) {
899 fprintf(stderr,
"Current renderer:\n");
911 fprintf(stderr,
"No built-in audio drivers\n");
913 fprintf(stderr,
"Built-in audio drivers:");
914 for (i = 0; i <
n; ++
i) {
916 fprintf(stderr,
",");
920 fprintf(stderr,
"\n");
924 fprintf(stderr,
"Couldn't initialize audio driver: %s\n",
929 fprintf(stderr,
"Audio driver: %s\n",
934 fprintf(stderr,
"Couldn't open audio: %s\n",
SDL_GetError());
950 fprintf(stderr,
"SDL EVENT: ");
951 switch (event->
type) {
964 fprintf(stderr,
"Window %d moved to %d,%d",
969 fprintf(stderr,
"Window %d resized to %dx%d",
974 fprintf(stderr,
"Window %d changed size to %dx%d",
988 fprintf(stderr,
"Mouse entered window %d",
995 fprintf(stderr,
"Window %d gained keyboard focus",
999 fprintf(stderr,
"Window %d lost keyboard focus",
1006 fprintf(stderr,
"Window %d got unknown event %d",
1013 "Keyboard: key pressed in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
1021 "Keyboard: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
1028 fprintf(stderr,
"Keyboard: text input \"%s\" in window %d",
1032 fprintf(stderr,
"Mouse: moved to %d,%d (%d,%d) in window %d",
1038 fprintf(stderr,
"Mouse: button %d pressed at %d,%d in window %d",
1043 fprintf(stderr,
"Mouse: button %d released at %d,%d in window %d",
1049 "Mouse: wheel scrolled %d in x and %d in y in window %d",
1053 fprintf(stderr,
"Joystick %d: ball %d moved by %d,%d",
1058 fprintf(stderr,
"Joystick %d: hat %d moved to ", event->
jhat.
which,
1062 fprintf(stderr,
"CENTER");
1065 fprintf(stderr,
"UP");
1068 fprintf(stderr,
"RIGHTUP");
1071 fprintf(stderr,
"RIGHT");
1074 fprintf(stderr,
"RIGHTDOWN");
1077 fprintf(stderr,
"DOWN");
1080 fprintf(stderr,
"LEFTDOWN");
1083 fprintf(stderr,
"LEFT");
1086 fprintf(stderr,
"LEFTUP");
1089 fprintf(stderr,
"UNKNOWN");
1094 fprintf(stderr,
"Joystick %d: button %d pressed",
1098 fprintf(stderr,
"Joystick %d: button %d released",
1102 fprintf(stderr,
"Clipboard updated");
1107 fprintf(stderr,
"Finger: %s touch=%lld, finger=%lld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
1116 fprintf(stderr,
"Quit requested");
1119 fprintf(stderr,
"User event %d", event->
user.
code);
1122 fprintf(stderr,
"Unknown event %d", event->
type);
1125 fprintf(stderr,
"\n");
1141 0x00FF0000, 0x0000FF00, 0x000000FF,
1143 0x000000FF, 0x0000FF00, 0x00FF0000,
1147 fprintf(stderr,
"Couldn't create surface: %s\n",
SDL_GetError());
1153 fprintf(stderr,
"Couldn't read screen: %s\n",
SDL_GetError());
1158 fprintf(stderr,
"Couldn't save screenshot.bmp: %s\n",
SDL_GetError());
1167 struct SDL_Rect rect = { 0, 0, 0, 0 };
1195 switch (event->
type) {
1215 if (window == state->
windows[i]) {
1248 printf(
"Copied text to clipboard\n");
1276 printf(
"Clipboard: %s\n", text);
1278 printf(
"Clipboard is empty\n");
1381 SDL_snprintf(message,
sizeof(message),
"(%i, %i), rel (%i, %i)\n", lastEvent.
x, lastEvent.
y, lastEvent.
xrel, lastEvent.
yrel);
1393 lastEvent =
event->motion;
#define SDL_WINDOWPOS_ISUNDEFINED(X)
DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
Set the maximum size of a window's client area.
SDL_MouseMotionEvent motion
DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
Get the clip rectangle for the current target.
DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
Set the minimum size of a window's client area.
DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface)
#define SDL_WINDOWPOS_CENTERED
DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key)
Get a human-readable name for a key.
static SDL_Surface * SDLTest_LoadIcon(const char *file)
GLfloat GLfloat GLfloat GLfloat h
DECLSPEC void SDLCALL SDL_VideoQuit(void)
Shuts down the video subsystem.
DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size)
GLsizei GLenum GLuint GLuint GLsizei GLchar * message
DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer *renderer, float scaleX, float scaleY)
Set the drawing scale for rendering on the current target.
#define SDL_LoadBMP(file)
DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt,...)
SDL_JoyButtonEvent jbutton
DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority)
Set the priority of all log categories.
SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags)
Parse command line parameters and create common state.
DECLSPEC const char *SDLCALL SDL_GetPixelFormatName(Uint32 format)
Get the human readable name of a pixel format.
DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name)
Initialize the video subsystem, optionally specifying a video driver.
DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window *window)
Get a window's input grab mode.
DECLSPEC double SDLCALL SDL_atof(const char *str)
int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
Process one common argument.
A collection of pixels used in software blitting.
DECLSPEC void SDLCALL SDL_free(void *mem)
Uint32 texture_formats[16]
The structure that defines a display mode.
DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window *window, const SDL_DisplayMode *mode)
Set the display mode used when a fullscreen window is visible.
#define SDL_WINDOWPOS_ISCENTERED(X)
DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex)
Returns the number of available display modes.
#define SDL_SaveBMP(surface, file)
DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
Get the size of a window's client area.
const char * renderdriver
#define SDL_WINDOWPOS_UNDEFINED
DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer *renderer, int w, int h)
Set device independent resolution for rendering.
DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h)
Set the size of a window's client area.
DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void)
DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
Read pixels from the current rendering target.
DECLSPEC const char *SDLCALL SDL_GetError(void)
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
Open test window.
DECLSPEC SDL_Renderer *SDLCALL SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
Create a 2D rendering context for a window.
SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r)
Returns true if the rectangle has no area.
SDL_MouseWheelEvent wheel
static void SDLTest_PrintPixelFormat(Uint32 format)
DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
Set a window's input grab mode.
DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon)
Set the icon for a window.
uint32_t Uint32
An unsigned 32-bit integer type.
DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value)
Set an OpenGL window attribute before window creation.
DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window *window)
Minimize a window to an iconic representation.
DECLSPEC const char *SDLCALL SDL_GetDisplayName(int displayIndex)
Get the name of a display in UTF-8 encoding.
DECLSPEC char *SDLCALL SDL_GetClipboardText(void)
Get UTF-8 text from the clipboard, which must be freed with SDL_free()
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
Common event handler for test windows.
#define SDL_HAT_RIGHTDOWN
DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void)
int gl_multisamplebuffers
#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X)
static void SDLTest_PrintRenderer(SDL_RendererInfo *info)
DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window *window)
Show a window.
DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode *mode)
Fill in information about the desktop display mode.
DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, SDL_DisplayMode *mode)
Fill in information about a specific display mode.
DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index)
DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen)
DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window *window)
Restore the size and position of a minimized or maximized window.
DECLSPEC SDL_Window *SDLCALL SDL_GetWindowFromID(Uint32 id)
Get a window from a stored ID, or NULL if it doesn't exist.
DECLSPEC void SDLCALL SDL_Delay(Uint32 ms)
Wait a specified number of milliseconds before returning.
DECLSPEC void SDLCALL SDL_LogSetPriority(int category, SDL_LogPriority priority)
Set the priority of a particular log category.
DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags)
Set a window's fullscreen state.
int gl_multisamplesamples
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum format
#define DEFAULT_WINDOW_HEIGHT
DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect)
Get the desktop area represented by a display, with the primary display located at 0...
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2)
DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window *window)
Get the window flags.
const char * SDLTest_CommonUsage(SDLTest_CommonState *state)
Returns common usage information.
static void SDLTest_PrintRendererFlag(Uint32 flag)
DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
Set the border state of a window.
DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index)
Get the name of a built in video driver.
DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
Create a simple modal message box.
DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode)
Get a human-readable name for a scancode.
DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void)
Returns the name of the currently initialized video driver.
SDL_Renderer ** renderers
DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled)
Set relative mouse mode.
static void SDLTest_PrintEvent(SDL_Event *event)
#define SDL_WINDOWPOS_CENTERED_DISPLAY(X)
DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window *window)
Make a window as large as possible.
DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface *surface, int flag, Uint32 key)
Sets the color key (transparent pixel) in a blittable surface.
EGLSurface EGLint EGLint y
#define SDL_OutOfMemory()
DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void)
Query whether relative mouse mode is enabled.
#define SDL_arraysize(array)
DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer *renderer, SDL_Rect *rect)
Get the drawing area for the current target.
DECLSPEC SDL_Window *SDLCALL SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
Create a window with the specified position, dimensions, and flags.
Information on the capabilities of a render driver or context.
Mouse motion event structure (event.motion.*)
DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y)
Set the position of a window.
DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info)
Get information about a rendering context.
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
uint8_t Uint8
An unsigned 8-bit integer type.
DECLSPEC int SDLCALL SDL_atoi(const char *str)
DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text)
Put UTF-8 text into the clipboard.
DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Set the clip rectangle for the current target.
DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask)
Convert one of the enumerated pixel formats to a bpp and RGBA masks.
DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void)
Get the number of video drivers compiled into SDL.
DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window)
Destroy a window.
SDL_MouseButtonEvent button
DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name)
static void SDLTest_ScreenShot(SDL_Renderer *renderer)
GLdouble GLdouble GLdouble b
Uint32 num_texture_formats
GLint GLint GLint GLint GLint w
uint16_t Uint16
An unsigned 16-bit integer type.
DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void)
Get the number of 2D rendering drivers available for the current display.
DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void)
Returns the number of available video displays.
static void FullscreenTo(int index, int windowId)
DECLSPEC void SDLCALL SDL_AudioQuit(void)
DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info)
Get information about a specific 2D rendering driver for the current display.
#define DEFAULT_WINDOW_WIDTH
DECLSPEC int SDLCALL SDL_isdigit(int x)
DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2)
void SDLTest_CommonQuit(SDLTest_CommonState *state)
Close test window.
A rectangle, with the origin at the upper left.
DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer)
Destroy the rendering context for a window and free associated textures.
SDL_TouchFingerEvent tfinger
const char * window_title