SDL
2.0
|
Go to the source code of this file.
Data Structures | |
struct | SDLTest_CommonState |
Macros | |
#define | DEFAULT_WINDOW_WIDTH 640 |
#define | DEFAULT_WINDOW_HEIGHT 480 |
#define | VERBOSE_VIDEO 0x00000001 |
#define | VERBOSE_MODES 0x00000002 |
#define | VERBOSE_RENDER 0x00000004 |
#define | VERBOSE_EVENT 0x00000008 |
#define | VERBOSE_AUDIO 0x00000010 |
Functions | |
SDLTest_CommonState * | SDLTest_CommonCreateState (char **argv, Uint32 flags) |
Parse command line parameters and create common state. More... | |
int | SDLTest_CommonArg (SDLTest_CommonState *state, int index) |
Process one common argument. More... | |
const char * | SDLTest_CommonUsage (SDLTest_CommonState *state) |
Returns common usage information. More... | |
SDL_bool | SDLTest_CommonInit (SDLTest_CommonState *state) |
Open test window. More... | |
void | SDLTest_CommonEvent (SDLTest_CommonState *state, SDL_Event *event, int *done) |
Common event handler for test windows. More... | |
void | SDLTest_CommonQuit (SDLTest_CommonState *state) |
Close test window. More... | |
Include file for SDL test framework.
This code is a part of the SDL2_test library, not the main SDL library.
Definition in file SDL_test_common.h.
#define DEFAULT_WINDOW_HEIGHT 480 |
Definition at line 42 of file SDL_test_common.h.
Referenced by main(), and SDLTest_CommonCreateState().
#define DEFAULT_WINDOW_WIDTH 640 |
Definition at line 41 of file SDL_test_common.h.
Referenced by InitInput(), main(), and SDLTest_CommonCreateState().
#define VERBOSE_AUDIO 0x00000010 |
Definition at line 49 of file SDL_test_common.h.
Referenced by SDLTest_CommonInit().
#define VERBOSE_EVENT 0x00000008 |
Definition at line 48 of file SDL_test_common.h.
Referenced by SDLTest_CommonArg(), and SDLTest_CommonEvent().
#define VERBOSE_MODES 0x00000002 |
Definition at line 46 of file SDL_test_common.h.
Referenced by SDLTest_CommonArg(), and SDLTest_CommonInit().
#define VERBOSE_RENDER 0x00000004 |
Definition at line 47 of file SDL_test_common.h.
Referenced by SDLTest_CommonArg(), and SDLTest_CommonInit().
#define VERBOSE_VIDEO 0x00000001 |
Definition at line 45 of file SDL_test_common.h.
Referenced by SDLTest_CommonArg(), and SDLTest_CommonInit().
int SDLTest_CommonArg | ( | SDLTest_CommonState * | state, |
int | index | ||
) |
Process one common argument.
state | The common state describing the test window to create. |
index | The index of the argument to process in argv[]. |
Definition at line 106 of file SDL_test_common.c.
References SDLTest_CommonState::argv, AUDIO_S16, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S8, AUDIO_U16, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, SDLTest_CommonState::audiospec, SDL_AudioSpec::channels, SDLTest_CommonState::depth, SDLTest_CommonState::display, SDL_AudioSpec::format, SDL_AudioSpec::freq, SDLTest_CommonState::gl_debug, SDLTest_CommonState::logical_h, SDLTest_CommonState::logical_w, SDLTest_CommonState::num_windows, SDLTest_CommonState::refresh_rate, SDLTest_CommonState::render_flags, SDLTest_CommonState::renderdriver, SDL_AudioSpec::samples, SDLTest_CommonState::scale, SDL_atof, SDL_atoi, SDL_isdigit, SDL_LOG_CATEGORY_AUDIO, SDL_LOG_CATEGORY_ERROR, SDL_LOG_CATEGORY_INPUT, SDL_LOG_CATEGORY_RENDER, SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_CATEGORY_VIDEO, SDL_LOG_PRIORITY_VERBOSE, SDL_LogSetAllPriority, SDL_LogSetPriority, SDL_RENDERER_PRESENTVSYNC, SDL_strcasecmp, SDL_strcmp, SDL_WINDOW_ALLOW_HIGHDPI, SDL_WINDOW_BORDERLESS, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP, SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_RESIZABLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED_DISPLAY, SDL_WINDOWPOS_ISCENTERED, SDL_WINDOWPOS_ISUNDEFINED, SDL_WINDOWPOS_UNDEFINED_DISPLAY, SDLTest_CommonState::verbose, VERBOSE_EVENT, VERBOSE_MODES, VERBOSE_RENDER, VERBOSE_VIDEO, SDLTest_CommonState::videodriver, SDLTest_CommonState::window_flags, SDLTest_CommonState::window_h, SDLTest_CommonState::window_icon, SDLTest_CommonState::window_maxH, SDLTest_CommonState::window_maxW, SDLTest_CommonState::window_minH, SDLTest_CommonState::window_minW, SDLTest_CommonState::window_title, SDLTest_CommonState::window_w, SDLTest_CommonState::window_x, and SDLTest_CommonState::window_y.
Referenced by main().
SDLTest_CommonState* SDLTest_CommonCreateState | ( | char ** | argv, |
Uint32 | flags | ||
) |
Parse command line parameters and create common state.
argv | Array of command line parameters |
flags | Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO) |
Definition at line 48 of file SDL_test_common.c.
References SDLTest_CommonState::argv, AUDIO_S16, SDLTest_CommonState::audiospec, SDL_AudioSpec::channels, DEFAULT_WINDOW_HEIGHT, DEFAULT_WINDOW_WIDTH, SDLTest_CommonState::flags, SDL_AudioSpec::format, SDL_AudioSpec::freq, SDLTest_CommonState::gl_accelerated, SDLTest_CommonState::gl_accum_alpha_size, SDLTest_CommonState::gl_accum_blue_size, SDLTest_CommonState::gl_accum_green_size, SDLTest_CommonState::gl_accum_red_size, SDLTest_CommonState::gl_alpha_size, SDLTest_CommonState::gl_blue_size, SDLTest_CommonState::gl_buffer_size, SDLTest_CommonState::gl_debug, SDLTest_CommonState::gl_depth_size, SDLTest_CommonState::gl_double_buffer, SDLTest_CommonState::gl_green_size, SDLTest_CommonState::gl_multisamplebuffers, SDLTest_CommonState::gl_multisamplesamples, SDLTest_CommonState::gl_red_size, SDLTest_CommonState::gl_retained_backing, SDLTest_CommonState::gl_stencil_size, SDLTest_CommonState::gl_stereo, i, NULL, SDLTest_CommonState::num_windows, SDL_AudioSpec::samples, SDL_calloc, SDL_OutOfMemory, SDL_strcasecmp, SDL_WINDOWPOS_UNDEFINED, SDLTest_TrackAllocations(), state, SDLTest_CommonState::window_flags, SDLTest_CommonState::window_h, SDLTest_CommonState::window_title, SDLTest_CommonState::window_w, SDLTest_CommonState::window_x, and SDLTest_CommonState::window_y.
Referenced by main().
void SDLTest_CommonEvent | ( | SDLTest_CommonState * | state, |
SDL_Event * | event, | ||
int * | done | ||
) |
Common event handler for test windows.
state | The common state used to create test window. |
event | The event to handle. |
done | Flag indicating we are done. |
Definition at line 1425 of file SDL_test_common.c.
References SDL_WindowEvent::event, FullscreenTo(), SDL_Rect::h, i, SDL_Event::key, SDL_KeyboardEvent::keysym, KMOD_ALT, KMOD_CTRL, KMOD_SHIFT, NULL, SDLTest_CommonState::num_windows, SDLTest_CommonState::renderers, SDL_BUTTON_LMASK, SDL_BUTTON_MMASK, SDL_BUTTON_RMASK, SDL_BUTTON_X1MASK, SDL_BUTTON_X2MASK, SDL_CaptureMouse, SDL_DestroyRenderer, SDL_DestroyTexture, SDL_DestroyWindow, SDL_FALSE, SDL_free, SDL_GetClipboardText, SDL_GetGlobalMouseState, SDL_GetKeyboardFocus, SDL_GetNumVideoDisplays, SDL_GetRelativeMouseMode, SDL_GetWindowDisplayIndex, SDL_GetWindowFlags, SDL_GetWindowFromID, SDL_GetWindowGrab, SDL_GetWindowOpacity, SDL_GetWindowPosition, SDL_GetWindowSize, SDL_KEYDOWN, SDL_Log, SDL_MaximizeWindow, SDL_MESSAGEBOX_INFORMATION, SDL_MinimizeWindow, SDL_MOUSEMOTION, SDL_QUIT, SDL_RectEmpty(), SDL_RenderGetClipRect, SDL_RenderSetClipRect, SDL_RestoreWindow, SDL_SetClipboardText, SDL_SetRelativeMouseMode, SDL_SetWindowBordered, SDL_SetWindowFullscreen, SDL_SetWindowGrab, SDL_SetWindowOpacity, SDL_SetWindowPosition, SDL_SetWindowSize, SDL_ShowSimpleMessageBox, SDL_snprintf, SDL_TRUE, SDL_WINDOW_BORDERLESS, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MOUSE_CAPTURE, SDL_WINDOWEVENT, SDL_WINDOWEVENT_CLOSE, SDL_WINDOWPOS_CENTERED_DISPLAY, SDLK_0, SDLK_1, SDLK_2, SDLK_a, SDLK_b, SDLK_c, SDLK_DOWN, SDLK_EQUALS, SDLK_ESCAPE, SDLK_g, SDLK_LEFT, SDLK_m, SDLK_MINUS, SDLK_o, SDLK_PRINTSCREEN, SDLK_r, SDLK_RETURN, SDLK_RIGHT, SDLK_SPACE, SDLK_UP, SDLK_v, SDLK_z, SDLTest_PrintEvent(), SDLTest_ScreenShot(), SDL_Keysym::sym, SDLTest_CommonState::targets, text, SDL_Event::type, SDLTest_CommonState::verbose, VERBOSE_EVENT, SDL_Rect::w, SDL_Event::window, SDL_WindowEvent::windowID, SDL_KeyboardEvent::windowID, SDLTest_CommonState::windows, SDL_Rect::x, SDL_MouseMotionEvent::x, SDL_MouseMotionEvent::xrel, SDL_Rect::y, SDL_MouseMotionEvent::y, and SDL_MouseMotionEvent::yrel.
Referenced by loop(), and main().
SDL_bool SDLTest_CommonInit | ( | SDLTest_CommonState * | state | ) |
Open test window.
state | The common state describing the test window to create. |
Definition at line 726 of file SDL_test_common.c.
References SDLTest_CommonState::audiodriver, SDLTest_CommonState::audiospec, SDLTest_CommonState::depth, SDLTest_CommonState::flags, SDL_DisplayMode::format, SDLTest_CommonState::gl_accelerated, SDLTest_CommonState::gl_accum_alpha_size, SDLTest_CommonState::gl_accum_blue_size, SDLTest_CommonState::gl_accum_green_size, SDLTest_CommonState::gl_accum_red_size, SDLTest_CommonState::gl_alpha_size, SDLTest_CommonState::gl_blue_size, SDLTest_CommonState::gl_buffer_size, SDLTest_CommonState::gl_debug, SDLTest_CommonState::gl_depth_size, SDLTest_CommonState::gl_double_buffer, SDLTest_CommonState::gl_green_size, SDLTest_CommonState::gl_major_version, SDLTest_CommonState::gl_minor_version, SDLTest_CommonState::gl_multisamplebuffers, SDLTest_CommonState::gl_multisamplesamples, SDLTest_CommonState::gl_profile_mask, SDLTest_CommonState::gl_red_size, SDLTest_CommonState::gl_retained_backing, SDLTest_CommonState::gl_stencil_size, SDLTest_CommonState::gl_stereo, SDL_DisplayMode::h, SDL_Rect::h, i, j, SDLTest_CommonState::logical_h, SDLTest_CommonState::logical_w, SDL_RendererInfo::name, NULL, SDLTest_CommonState::num_windows, SDL_DisplayMode::refresh_rate, SDLTest_CommonState::refresh_rate, SDLTest_CommonState::render_flags, SDLTest_CommonState::renderdriver, SDLTest_CommonState::renderers, SDLTest_CommonState::scale, SDL_arraysize, SDL_AudioInit, SDL_calloc, SDL_CreateRenderer, SDL_CreateWindow, SDL_Direct3D9GetAdapterIndex(), SDL_DXGIGetOutputInfo(), SDL_FALSE, SDL_FreeSurface, SDL_GetAudioDriver, SDL_GetCurrentAudioDriver, SDL_GetCurrentVideoDriver, SDL_GetDesktopDisplayMode, SDL_GetDisplayBounds, SDL_GetDisplayDPI, SDL_GetDisplayMode, SDL_GetDisplayName, SDL_GetDisplayUsableBounds, SDL_GetError, SDL_GetNumAudioDrivers, SDL_GetNumDisplayModes, SDL_GetNumRenderDrivers, SDL_GetNumVideoDisplays, SDL_GetNumVideoDrivers, SDL_GetPixelFormatName, SDL_GetRenderDriverInfo, SDL_GetRendererInfo, SDL_GetVideoDriver, SDL_GetWindowSize, SDL_GL_ACCELERATED_VISUAL, SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_RED_SIZE, SDL_GL_ALPHA_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_CONTEXT_DEBUG_FLAG, SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_DEPTH_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_GREEN_SIZE, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, SDL_GL_RED_SIZE, SDL_GL_RETAINED_BACKING, SDL_GL_SetAttribute, SDL_GL_STENCIL_SIZE, SDL_GL_STEREO, SDL_INIT_AUDIO, SDL_INIT_VIDEO, SDL_Log, SDL_OpenAudio, SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_RGB24, SDL_PIXELFORMAT_RGB555, SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_RGB888, SDL_PixelFormatEnumToMasks, SDL_RenderSetLogicalSize, SDL_RenderSetScale, SDL_SetWindowDisplayMode, SDL_SetWindowHitTest, SDL_SetWindowIcon, SDL_SetWindowMaximumSize, SDL_SetWindowMinimumSize, SDL_ShowWindow, SDL_snprintf, SDL_snprintfcat(), SDL_strcasecmp, SDL_strlcpy, SDL_TRUE, SDL_VideoInit, SDL_WINDOW_BORDERLESS, SDL_WINDOW_OPENGL, SDL_WINDOW_RESIZABLE, SDL_WINDOW_VULKAN, SDL_zero, SDLTest_ExampleHitTestCallback(), SDLTest_LoadIcon(), SDLTest_PrintRenderer(), SDLTest_CommonState::skip_renderer, SDLTest_CommonState::targets, text, SDLTest_CommonState::verbose, VERBOSE_AUDIO, VERBOSE_MODES, VERBOSE_RENDER, VERBOSE_VIDEO, SDLTest_CommonState::videodriver, SDL_DisplayMode::w, SDL_Rect::w, SDLTest_CommonState::window_flags, SDLTest_CommonState::window_h, SDLTest_CommonState::window_icon, SDLTest_CommonState::window_maxH, SDLTest_CommonState::window_maxW, SDLTest_CommonState::window_minH, SDLTest_CommonState::window_minW, SDLTest_CommonState::window_title, SDLTest_CommonState::window_w, SDLTest_CommonState::window_x, SDLTest_CommonState::window_y, SDLTest_CommonState::windows, SDL_Rect::x, and SDL_Rect::y.
Referenced by main().
void SDLTest_CommonQuit | ( | SDLTest_CommonState * | state | ) |
Close test window.
state | The common state used to create test window. |
Definition at line 1751 of file SDL_test_common.c.
References SDLTest_CommonState::flags, i, SDLTest_CommonState::num_windows, SDLTest_CommonState::renderers, SDL_AudioQuit, SDL_DestroyRenderer, SDL_DestroyTexture, SDL_free, SDL_INIT_AUDIO, SDL_INIT_VIDEO, SDL_Quit, SDL_VideoQuit, SDLTest_LogAllocations(), SDLTest_CommonState::targets, and SDLTest_CommonState::windows.
Referenced by main(), and quit().
const char* SDLTest_CommonUsage | ( | SDLTest_CommonState * | state | ) |
Returns common usage information.
state | The common state describing the test window to create. |
Definition at line 478 of file SDL_test_common.c.
References AUDIO_USAGE, SDLTest_CommonState::flags, SDL_INIT_AUDIO, SDL_INIT_VIDEO, and VIDEO_USAGE.
Referenced by main().