| 56 | } |
| 57 | |
| 58 | SDLTest_CommonState * |
| 59 | SDLTest_CommonCreateState(char **argv, Uint32 flags) |
| 60 | { |
| 61 | int i; |
| 62 | SDLTest_CommonState *state; |
| 63 | |
| 64 | /* Do this first so we catch all allocations */ |
| 65 | for (i = 1; argv[i]; ++i) { |
| 66 | if (SDL_strcasecmp(argv[i], "--trackmem") == 0) { |
| 67 | SDLTest_TrackAllocations(); |
| 68 | break; |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state)); |
| 73 | if (!state) { |
| 74 | SDL_OutOfMemory(); |
| 75 | return NULL; |
| 76 | } |
| 77 | |
| 78 | /* Initialize some defaults */ |
| 79 | state->argv = argv; |
| 80 | state->flags = flags; |
| 81 | state->window_title = argv[0]; |
| 82 | state->window_flags = 0; |
| 83 | state->window_x = SDL_WINDOWPOS_UNDEFINED; |
| 84 | state->window_y = SDL_WINDOWPOS_UNDEFINED; |
| 85 | state->window_w = DEFAULT_WINDOW_WIDTH; |
| 86 | state->window_h = DEFAULT_WINDOW_HEIGHT; |
| 87 | state->num_windows = 1; |
| 88 | state->audiospec.freq = 22050; |
| 89 | state->audiospec.format = AUDIO_S16; |
| 90 | state->audiospec.channels = 2; |
| 91 | state->audiospec.samples = 2048; |
| 92 | |
| 93 | /* Set some very sane GL defaults */ |
| 94 | state->gl_red_size = 3; |
| 95 | state->gl_green_size = 3; |
| 96 | state->gl_blue_size = 2; |
| 97 | state->gl_alpha_size = 0; |
| 98 | state->gl_buffer_size = 0; |
| 99 | state->gl_depth_size = 16; |
| 100 | state->gl_stencil_size = 0; |
| 101 | state->gl_double_buffer = 1; |
| 102 | state->gl_accum_red_size = 0; |
| 103 | state->gl_accum_green_size = 0; |
| 104 | state->gl_accum_blue_size = 0; |
| 105 | state->gl_accum_alpha_size = 0; |
| 106 | state->gl_stereo = 0; |
| 107 | state->gl_multisamplebuffers = 0; |
| 108 | state->gl_multisamplesamples = 0; |
| 109 | state->gl_retained_backing = 1; |
| 110 | state->gl_accelerated = -1; |
| 111 | state->gl_debug = 0; |
| 112 | |
| 113 | return state; |
| 114 | } |
| 115 |
no test coverage detected