zenilib: zenilib/jni/external/sdl/SDL/SDL_test_common.h File Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Macros | Functions
SDL_test_common.h File Reference
`#include "SDL.h"`
`#include "begin_code.h"`
`#include "close_code.h"`

Go to the source code of this file.

## Classes

struct | SDLTest_CommonState

## Macros

#define | DEFAULT_WINDOW_HEIGHT 480
#define | DEFAULT_WINDOW_WIDTH 640
#define | VERBOSE_AUDIO 0x00000010
#define | VERBOSE_EVENT 0x00000008
#define | VERBOSE_MODES 0x00000002
#define | VERBOSE_RENDER 0x00000004
#define | VERBOSE_VIDEO 0x00000001

## Functions

int | SDLTest_CommonArg (SDLTest_CommonState *state, int index)
| Process one common argument. More...
SDLTest_CommonState * | SDLTest_CommonCreateState (char **argv, Uint32 flags)
| Parse command line parameters and create common state. More...
void | SDLTest_CommonEvent (SDLTest_CommonState *state, SDL_Event *event, int *done)
| Common event handler for test windows. More...
SDL_bool | SDLTest_CommonInit (SDLTest_CommonState *state)
| Open test window. More...
void | SDLTest_CommonQuit (SDLTest_CommonState *state)
| Close test window. More...
const char * | SDLTest_CommonUsage (SDLTest_CommonState *state)
| Returns common usage information. More...

## Detailed Description

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.

## Macro Definition Documentation

#define DEFAULT_WINDOW_HEIGHT 480

Definition at line 42 of file SDL_test_common.h.

Referenced by SDLTest_CommonCreateState().

#define DEFAULT_WINDOW_WIDTH 640

Definition at line 41 of file SDL_test_common.h.

Referenced by 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().

## Function Documentation

int SDLTest_CommonArg | ( | SDLTest_CommonState * | state,
|  | int | index
| ) |  |

Process one common argument.

Parameters

  state | The common state describing the test window to create.
  index | The index of the argument to process in argv[].

Returns
  The number of arguments processed (i.e. 1 for –fullscreen, 2 for –video [videodriver], or -1 on error.

Definition at line 83 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.

SDLTest_CommonState* SDLTest_CommonCreateState | ( | char ** | argv,
|  | Uint32 | flags
| ) |  |

Parse command line parameters and create common state.

Parameters

  argv | Array of command line parameters
  flags | Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO)

Returns
  Returns a newly allocated common state object.

Definition at line 36 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, NULL, SDLTest_CommonState::num_windows, SDL_AudioSpec::samples, SDL_calloc(), SDL_OutOfMemory, SDL_WINDOWPOS_UNDEFINED, 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.

void SDLTest_CommonEvent | ( | SDLTest_CommonState * | state,
|  | SDL_Event * | event,
|  | int * | done
| ) |  |

Common event handler for test windows.

Parameters

  state | The common state used to create test window.
  event | The event to handle.
  done | Flag indicating we are done.

Definition at line 1186 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, SDL_Keysym::mod, NULL, SDLTest_CommonState::num_windows, SDLTest_CommonState::renderers, SDL_DestroyWindow(), SDL_FALSE, SDL_free(), SDL_GetClipboardText(), SDL_GetRelativeMouseMode(), SDL_GetWindowFlags(), SDL_GetWindowFromID(), SDL_GetWindowGrab(), SDL_GetWindowSize(), SDL_KEYDOWN, 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_SetWindowSize(), SDL_ShowSimpleMessageBox(), SDL_snprintf(), SDL_TRUE, SDL_WINDOW_BORDERLESS, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP, SDL_WINDOW_MAXIMIZED, SDL_WINDOWEVENT, SDL_WINDOWEVENT_CLOSE, SDLK_0, SDLK_1, SDLK_2, SDLK_b, SDLK_c, SDLK_EQUALS, SDLK_ESCAPE, SDLK_g, SDLK_m, SDLK_MINUS, SDLK_PRINTSCREEN, SDLK_r, SDLK_RETURN, SDLK_SPACE, SDLK_v, SDLK_z, SDLTest_PrintEvent(), SDLTest_ScreenShot(), SDL_Keysym::sym, 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.

SDL_bool SDLTest_CommonInit | ( | SDLTest_CommonState * | state | ) |

Open test window.

Parameters

  state | The common state describing the test window to create.

Returns
  True if initialization succeeded, false otherwise

Definition at line 639 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_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, m, 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_CreateRenderer(), SDL_CreateWindow(), SDL_FALSE, SDL_FreeSurface(), SDL_GetAudioDriver(), SDL_GetCurrentAudioDriver(), SDL_GetCurrentVideoDriver(), SDL_GetDesktopDisplayMode(), SDL_GetDisplayBounds(), SDL_GetDisplayMode(), SDL_GetDisplayName(), 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_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_malloc(), 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_SetWindowIcon(), SDL_SetWindowMaximumSize(), SDL_SetWindowMinimumSize(), SDL_ShowWindow(), SDL_snprintf(), SDL_strcasecmp(), SDL_strlcpy(), SDL_TRUE, SDL_VideoInit(), SDL_WINDOW_OPENGL, SDL_WINDOW_RESIZABLE, SDL_zero, SDLTest_LoadIcon(), SDLTest_PrintRenderer(), SDLTest_CommonState::skip_renderer, 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.

void SDLTest_CommonQuit | ( | SDLTest_CommonState * | state | ) |

Close test window.

Parameters

  state | The common state used to create test window.

Definition at line 1399 of file SDL_test_common.c.

References SDLTest_CommonState::flags, i, SDLTest_CommonState::num_windows, SDLTest_CommonState::renderers, SDL_AudioQuit(), SDL_DestroyRenderer(), SDL_free(), SDL_INIT_AUDIO, SDL_INIT_VIDEO, SDL_VideoQuit(), and SDLTest_CommonState::windows.

const char* SDLTest_CommonUsage | ( | SDLTest_CommonState * | state | ) |

Returns common usage information.

Parameters

  state | The common state describing the test window to create.

Returns
  String with usage information

Definition at line 451 of file SDL_test_common.c.

References AUDIO_USAGE, SDLTest_CommonState::flags, SDL_INIT_AUDIO, SDL_INIT_VIDEO, and VIDEO_USAGE.