SDL standard library

Dependents:   H261_encoder

Committer:
miruga27
Date:
Wed Sep 07 18:46:53 2016 +0000
Revision:
0:dda4f4550403
7/09/2016;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
miruga27 0:dda4f4550403 1 /*
miruga27 0:dda4f4550403 2 Simple DirectMedia Layer
miruga27 0:dda4f4550403 3 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
miruga27 0:dda4f4550403 4
miruga27 0:dda4f4550403 5 This software is provided 'as-is', without any express or implied
miruga27 0:dda4f4550403 6 warranty. In no event will the authors be held liable for any damages
miruga27 0:dda4f4550403 7 arising from the use of this software.
miruga27 0:dda4f4550403 8
miruga27 0:dda4f4550403 9 Permission is granted to anyone to use this software for any purpose,
miruga27 0:dda4f4550403 10 including commercial applications, and to alter it and redistribute it
miruga27 0:dda4f4550403 11 freely, subject to the following restrictions:
miruga27 0:dda4f4550403 12
miruga27 0:dda4f4550403 13 1. The origin of this software must not be misrepresented; you must not
miruga27 0:dda4f4550403 14 claim that you wrote the original software. If you use this software
miruga27 0:dda4f4550403 15 in a product, an acknowledgment in the product documentation would be
miruga27 0:dda4f4550403 16 appreciated but is not required.
miruga27 0:dda4f4550403 17 2. Altered source versions must be plainly marked as such, and must not be
miruga27 0:dda4f4550403 18 misrepresented as being the original software.
miruga27 0:dda4f4550403 19 3. This notice may not be removed or altered from any source distribution.
miruga27 0:dda4f4550403 20 */
miruga27 0:dda4f4550403 21
miruga27 0:dda4f4550403 22 /**
miruga27 0:dda4f4550403 23 * \file SDL_test_common.h
miruga27 0:dda4f4550403 24 *
miruga27 0:dda4f4550403 25 * Include file for SDL test framework.
miruga27 0:dda4f4550403 26 *
miruga27 0:dda4f4550403 27 * This code is a part of the SDL2_test library, not the main SDL library.
miruga27 0:dda4f4550403 28 */
miruga27 0:dda4f4550403 29
miruga27 0:dda4f4550403 30 /* Ported from original test\common.h file. */
miruga27 0:dda4f4550403 31
miruga27 0:dda4f4550403 32 #ifndef _SDL_test_common_h
miruga27 0:dda4f4550403 33 #define _SDL_test_common_h
miruga27 0:dda4f4550403 34
miruga27 0:dda4f4550403 35 #include "SDL.h"
miruga27 0:dda4f4550403 36
miruga27 0:dda4f4550403 37 #if defined(__PSP__)
miruga27 0:dda4f4550403 38 #define DEFAULT_WINDOW_WIDTH 480
miruga27 0:dda4f4550403 39 #define DEFAULT_WINDOW_HEIGHT 272
miruga27 0:dda4f4550403 40 #else
miruga27 0:dda4f4550403 41 #define DEFAULT_WINDOW_WIDTH 640
miruga27 0:dda4f4550403 42 #define DEFAULT_WINDOW_HEIGHT 480
miruga27 0:dda4f4550403 43 #endif
miruga27 0:dda4f4550403 44
miruga27 0:dda4f4550403 45 #define VERBOSE_VIDEO 0x00000001
miruga27 0:dda4f4550403 46 #define VERBOSE_MODES 0x00000002
miruga27 0:dda4f4550403 47 #define VERBOSE_RENDER 0x00000004
miruga27 0:dda4f4550403 48 #define VERBOSE_EVENT 0x00000008
miruga27 0:dda4f4550403 49 #define VERBOSE_AUDIO 0x00000010
miruga27 0:dda4f4550403 50
miruga27 0:dda4f4550403 51 typedef struct
miruga27 0:dda4f4550403 52 {
miruga27 0:dda4f4550403 53 /* SDL init flags */
miruga27 0:dda4f4550403 54 char **argv;
miruga27 0:dda4f4550403 55 Uint32 flags;
miruga27 0:dda4f4550403 56 Uint32 verbose;
miruga27 0:dda4f4550403 57
miruga27 0:dda4f4550403 58 /* Video info */
miruga27 0:dda4f4550403 59 const char *videodriver;
miruga27 0:dda4f4550403 60 int display;
miruga27 0:dda4f4550403 61 const char *window_title;
miruga27 0:dda4f4550403 62 const char *window_icon;
miruga27 0:dda4f4550403 63 Uint32 window_flags;
miruga27 0:dda4f4550403 64 int window_x;
miruga27 0:dda4f4550403 65 int window_y;
miruga27 0:dda4f4550403 66 int window_w;
miruga27 0:dda4f4550403 67 int window_h;
miruga27 0:dda4f4550403 68 int window_minW;
miruga27 0:dda4f4550403 69 int window_minH;
miruga27 0:dda4f4550403 70 int window_maxW;
miruga27 0:dda4f4550403 71 int window_maxH;
miruga27 0:dda4f4550403 72 int logical_w;
miruga27 0:dda4f4550403 73 int logical_h;
miruga27 0:dda4f4550403 74 float scale;
miruga27 0:dda4f4550403 75 int depth;
miruga27 0:dda4f4550403 76 int refresh_rate;
miruga27 0:dda4f4550403 77 int num_windows;
miruga27 0:dda4f4550403 78 SDL_Window **windows;
miruga27 0:dda4f4550403 79
miruga27 0:dda4f4550403 80 /* Renderer info */
miruga27 0:dda4f4550403 81 const char *renderdriver;
miruga27 0:dda4f4550403 82 Uint32 render_flags;
miruga27 0:dda4f4550403 83 SDL_bool skip_renderer;
miruga27 0:dda4f4550403 84 SDL_Renderer **renderers;
miruga27 0:dda4f4550403 85 SDL_Texture **targets;
miruga27 0:dda4f4550403 86
miruga27 0:dda4f4550403 87 /* Audio info */
miruga27 0:dda4f4550403 88 const char *audiodriver;
miruga27 0:dda4f4550403 89 SDL_AudioSpec audiospec;
miruga27 0:dda4f4550403 90
miruga27 0:dda4f4550403 91 /* GL settings */
miruga27 0:dda4f4550403 92 int gl_red_size;
miruga27 0:dda4f4550403 93 int gl_green_size;
miruga27 0:dda4f4550403 94 int gl_blue_size;
miruga27 0:dda4f4550403 95 int gl_alpha_size;
miruga27 0:dda4f4550403 96 int gl_buffer_size;
miruga27 0:dda4f4550403 97 int gl_depth_size;
miruga27 0:dda4f4550403 98 int gl_stencil_size;
miruga27 0:dda4f4550403 99 int gl_double_buffer;
miruga27 0:dda4f4550403 100 int gl_accum_red_size;
miruga27 0:dda4f4550403 101 int gl_accum_green_size;
miruga27 0:dda4f4550403 102 int gl_accum_blue_size;
miruga27 0:dda4f4550403 103 int gl_accum_alpha_size;
miruga27 0:dda4f4550403 104 int gl_stereo;
miruga27 0:dda4f4550403 105 int gl_multisamplebuffers;
miruga27 0:dda4f4550403 106 int gl_multisamplesamples;
miruga27 0:dda4f4550403 107 int gl_retained_backing;
miruga27 0:dda4f4550403 108 int gl_accelerated;
miruga27 0:dda4f4550403 109 int gl_major_version;
miruga27 0:dda4f4550403 110 int gl_minor_version;
miruga27 0:dda4f4550403 111 int gl_debug;
miruga27 0:dda4f4550403 112 int gl_profile_mask;
miruga27 0:dda4f4550403 113 } SDLTest_CommonState;
miruga27 0:dda4f4550403 114
miruga27 0:dda4f4550403 115 #include "begin_code.h"
miruga27 0:dda4f4550403 116 /* Set up for C function definitions, even when using C++ */
miruga27 0:dda4f4550403 117 #ifdef __cplusplus
miruga27 0:dda4f4550403 118 extern "C" {
miruga27 0:dda4f4550403 119 #endif
miruga27 0:dda4f4550403 120
miruga27 0:dda4f4550403 121 /* Function prototypes */
miruga27 0:dda4f4550403 122
miruga27 0:dda4f4550403 123 /**
miruga27 0:dda4f4550403 124 * \brief Parse command line parameters and create common state.
miruga27 0:dda4f4550403 125 *
miruga27 0:dda4f4550403 126 * \param argv Array of command line parameters
miruga27 0:dda4f4550403 127 * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO)
miruga27 0:dda4f4550403 128 *
miruga27 0:dda4f4550403 129 * \returns Returns a newly allocated common state object.
miruga27 0:dda4f4550403 130 */
miruga27 0:dda4f4550403 131 SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
miruga27 0:dda4f4550403 132
miruga27 0:dda4f4550403 133 /**
miruga27 0:dda4f4550403 134 * \brief Process one common argument.
miruga27 0:dda4f4550403 135 *
miruga27 0:dda4f4550403 136 * \param state The common state describing the test window to create.
miruga27 0:dda4f4550403 137 * \param index The index of the argument to process in argv[].
miruga27 0:dda4f4550403 138 *
miruga27 0:dda4f4550403 139 * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error.
miruga27 0:dda4f4550403 140 */
miruga27 0:dda4f4550403 141 int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
miruga27 0:dda4f4550403 142
miruga27 0:dda4f4550403 143 /**
miruga27 0:dda4f4550403 144 * \brief Returns common usage information
miruga27 0:dda4f4550403 145 *
miruga27 0:dda4f4550403 146 * \param state The common state describing the test window to create.
miruga27 0:dda4f4550403 147 *
miruga27 0:dda4f4550403 148 * \returns String with usage information
miruga27 0:dda4f4550403 149 */
miruga27 0:dda4f4550403 150 const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
miruga27 0:dda4f4550403 151
miruga27 0:dda4f4550403 152 /**
miruga27 0:dda4f4550403 153 * \brief Open test window.
miruga27 0:dda4f4550403 154 *
miruga27 0:dda4f4550403 155 * \param state The common state describing the test window to create.
miruga27 0:dda4f4550403 156 *
miruga27 0:dda4f4550403 157 * \returns True if initialization succeeded, false otherwise
miruga27 0:dda4f4550403 158 */
miruga27 0:dda4f4550403 159 SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
miruga27 0:dda4f4550403 160
miruga27 0:dda4f4550403 161 /**
miruga27 0:dda4f4550403 162 * \brief Common event handler for test windows.
miruga27 0:dda4f4550403 163 *
miruga27 0:dda4f4550403 164 * \param state The common state used to create test window.
miruga27 0:dda4f4550403 165 * \param event The event to handle.
miruga27 0:dda4f4550403 166 * \param done Flag indicating we are done.
miruga27 0:dda4f4550403 167 *
miruga27 0:dda4f4550403 168 */
miruga27 0:dda4f4550403 169 void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done);
miruga27 0:dda4f4550403 170
miruga27 0:dda4f4550403 171 /**
miruga27 0:dda4f4550403 172 * \brief Close test window.
miruga27 0:dda4f4550403 173 *
miruga27 0:dda4f4550403 174 * \param state The common state used to create test window.
miruga27 0:dda4f4550403 175 *
miruga27 0:dda4f4550403 176 */
miruga27 0:dda4f4550403 177 void SDLTest_CommonQuit(SDLTest_CommonState * state);
miruga27 0:dda4f4550403 178
miruga27 0:dda4f4550403 179
miruga27 0:dda4f4550403 180 /* Ends C function definitions when using C++ */
miruga27 0:dda4f4550403 181 #ifdef __cplusplus
miruga27 0:dda4f4550403 182 }
miruga27 0:dda4f4550403 183 #endif
miruga27 0:dda4f4550403 184 #include "close_code.h"
miruga27 0:dda4f4550403 185
miruga27 0:dda4f4550403 186 #endif /* _SDL_test_common_h */
miruga27 0:dda4f4550403 187
miruga27 0:dda4f4550403 188 /* vi: set ts=4 sw=4 expandtab: */