src/test/SDL_test_common.c
author Sam Lantinga <slouken@libsdl.org>
Mon, 31 Dec 2012 12:15:25 -0800
changeset 6788 036f53f2f5aa
parent 6783 001f59dc43be
child 6796 424a12862805
permissions -rw-r--r--
Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize() Also fixed Cocoa implementation so that it affects client area, not the whole window area.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     1
/*
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     2
  Simple DirectMedia Layer
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     4
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     5
  This software is provided 'as-is', without any express or implied
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     7
  arising from the use of this software.
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     8
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    11
  freely, subject to the following restrictions:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    12
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    14
     claim that you wrote the original software. If you use this software
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    16
     appreciated but is not required.
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    18
     misrepresented as being the original software.
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    20
*/
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    21
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    22
/* Ported from original test\common.c file. */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    23
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    24
#include "SDL_config.h"
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    25
#include "SDL_test.h"
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    26
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    27
#include <stdio.h>
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    28
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    29
#define VIDEO_USAGE \
6788
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
    30
"[--video driver] [--renderer driver] [--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] [--depth N] [--refresh R] [--vsync] [--noframe] [--resize] [--minimize] [--maximize] [--grab]"
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    31
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    32
#define AUDIO_USAGE \
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    33
"[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]"
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    34
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    35
SDLTest_CommonState *
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    36
SDLTest_CommonCreateState(char **argv, Uint32 flags)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    37
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    38
    SDLTest_CommonState *state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    39
    if (!state) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    40
        SDL_OutOfMemory();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    41
        return NULL;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    42
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    43
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    44
    /* Initialize some defaults */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    45
    state->argv = argv;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    46
    state->flags = flags;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    47
#ifdef __NDS__
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    48
    state->window_title = "";
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    49
#else
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    50
    state->window_title = argv[0];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    51
#endif
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    52
    state->window_flags = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    53
    state->window_x = SDL_WINDOWPOS_UNDEFINED;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    54
    state->window_y = SDL_WINDOWPOS_UNDEFINED;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    55
    state->window_w = DEFAULT_WINDOW_WIDTH;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    56
    state->window_h = DEFAULT_WINDOW_HEIGHT;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    57
    state->num_windows = 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    58
    state->audiospec.freq = 22050;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    59
    state->audiospec.format = AUDIO_S16;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    60
    state->audiospec.channels = 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    61
    state->audiospec.samples = 2048;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    62
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    63
    /* Set some very sane GL defaults */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    64
    state->gl_red_size = 3;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    65
    state->gl_green_size = 3;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    66
    state->gl_blue_size = 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    67
    state->gl_alpha_size = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    68
    state->gl_buffer_size = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    69
    state->gl_depth_size = 16;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    70
    state->gl_stencil_size = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    71
    state->gl_double_buffer = 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    72
    state->gl_accum_red_size = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    73
    state->gl_accum_green_size = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    74
    state->gl_accum_blue_size = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    75
    state->gl_accum_alpha_size = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    76
    state->gl_stereo = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    77
    state->gl_multisamplebuffers = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    78
    state->gl_multisamplesamples = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    79
    state->gl_retained_backing = 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    80
    state->gl_accelerated = -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    81
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    82
    return state;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    83
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    84
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    85
int
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    86
SDLTest_CommonArg(SDLTest_CommonState * state, int index)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    87
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    88
    char **argv = state->argv;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    89
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    90
#ifdef __NDS__
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    91
    return 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    92
#endif
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    93
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    94
    if (SDL_strcasecmp(argv[index], "--video") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    95
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    96
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    97
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    98
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    99
        state->videodriver = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   100
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   101
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   102
    if (SDL_strcasecmp(argv[index], "--renderer") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   103
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   104
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   105
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   106
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   107
        state->renderdriver = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   108
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   109
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   110
    if (SDL_strcasecmp(argv[index], "--info") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   111
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   112
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   113
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   114
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   115
        if (SDL_strcasecmp(argv[index], "all") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   116
            state->verbose |=
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   117
                (VERBOSE_VIDEO | VERBOSE_MODES | VERBOSE_RENDER |
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   118
                 VERBOSE_EVENT);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   119
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   120
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   121
        if (SDL_strcasecmp(argv[index], "video") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   122
            state->verbose |= VERBOSE_VIDEO;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   123
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   124
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   125
        if (SDL_strcasecmp(argv[index], "modes") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   126
            state->verbose |= VERBOSE_MODES;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   127
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   128
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   129
        if (SDL_strcasecmp(argv[index], "render") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   130
            state->verbose |= VERBOSE_RENDER;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   131
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   132
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   133
        if (SDL_strcasecmp(argv[index], "event") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   134
            state->verbose |= VERBOSE_EVENT;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   135
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   136
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   137
        return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   138
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   139
    if (SDL_strcasecmp(argv[index], "--log") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   140
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   141
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   142
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   143
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   144
        if (SDL_strcasecmp(argv[index], "all") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   145
            SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   146
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   147
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   148
        if (SDL_strcasecmp(argv[index], "error") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   149
            SDL_LogSetPriority(SDL_LOG_CATEGORY_ERROR, SDL_LOG_PRIORITY_VERBOSE);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   150
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   151
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   152
        if (SDL_strcasecmp(argv[index], "system") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   153
            SDL_LogSetPriority(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   154
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   155
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   156
        if (SDL_strcasecmp(argv[index], "audio") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   157
            SDL_LogSetPriority(SDL_LOG_CATEGORY_AUDIO, SDL_LOG_PRIORITY_VERBOSE);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   158
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   159
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   160
        if (SDL_strcasecmp(argv[index], "video") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   161
            SDL_LogSetPriority(SDL_LOG_CATEGORY_VIDEO, SDL_LOG_PRIORITY_VERBOSE);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   162
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   163
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   164
        if (SDL_strcasecmp(argv[index], "render") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   165
            SDL_LogSetPriority(SDL_LOG_CATEGORY_RENDER, SDL_LOG_PRIORITY_VERBOSE);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   166
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   167
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   168
        if (SDL_strcasecmp(argv[index], "input") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   169
            SDL_LogSetPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_VERBOSE);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   170
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   171
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   172
        return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   173
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   174
    if (SDL_strcasecmp(argv[index], "--display") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   175
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   176
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   177
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   178
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   179
        state->display = SDL_atoi(argv[index]);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   180
        if (SDL_WINDOWPOS_ISUNDEFINED(state->window_x)) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   181
            state->window_x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->display);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   182
            state->window_y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(state->display);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   183
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   184
        if (SDL_WINDOWPOS_ISCENTERED(state->window_x)) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   185
            state->window_x = SDL_WINDOWPOS_CENTERED_DISPLAY(state->display);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   186
            state->window_y = SDL_WINDOWPOS_CENTERED_DISPLAY(state->display);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   187
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   188
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   189
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   190
    if (SDL_strcasecmp(argv[index], "--fullscreen") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   191
        state->window_flags |= SDL_WINDOW_FULLSCREEN;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   192
        state->num_windows = 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   193
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   194
    }
6783
001f59dc43be Added --fullscreen-desktop option to test the new SDL_WINDOW_FULLSCREEN_DESKTOP functionality
Sam Lantinga <slouken@libsdl.org>
parents: 6727
diff changeset
   195
    if (SDL_strcasecmp(argv[index], "--fullscreen-desktop") == 0) {
001f59dc43be Added --fullscreen-desktop option to test the new SDL_WINDOW_FULLSCREEN_DESKTOP functionality
Sam Lantinga <slouken@libsdl.org>
parents: 6727
diff changeset
   196
        state->window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
001f59dc43be Added --fullscreen-desktop option to test the new SDL_WINDOW_FULLSCREEN_DESKTOP functionality
Sam Lantinga <slouken@libsdl.org>
parents: 6727
diff changeset
   197
        state->num_windows = 1;
001f59dc43be Added --fullscreen-desktop option to test the new SDL_WINDOW_FULLSCREEN_DESKTOP functionality
Sam Lantinga <slouken@libsdl.org>
parents: 6727
diff changeset
   198
        return 1;
001f59dc43be Added --fullscreen-desktop option to test the new SDL_WINDOW_FULLSCREEN_DESKTOP functionality
Sam Lantinga <slouken@libsdl.org>
parents: 6727
diff changeset
   199
    }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   200
    if (SDL_strcasecmp(argv[index], "--windows") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   201
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   202
        if (!argv[index] || !SDL_isdigit(*argv[index])) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   203
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   204
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   205
        if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   206
            state->num_windows = SDL_atoi(argv[index]);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   207
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   208
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   209
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   210
    if (SDL_strcasecmp(argv[index], "--title") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   211
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   212
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   213
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   214
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   215
        state->window_title = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   216
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   217
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   218
    if (SDL_strcasecmp(argv[index], "--icon") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   219
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   220
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   221
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   222
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   223
        state->window_icon = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   224
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   225
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   226
    if (SDL_strcasecmp(argv[index], "--center") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   227
        state->window_x = SDL_WINDOWPOS_CENTERED;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   228
        state->window_y = SDL_WINDOWPOS_CENTERED;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   229
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   230
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   231
    if (SDL_strcasecmp(argv[index], "--position") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   232
        char *x, *y;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   233
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   234
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   235
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   236
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   237
        x = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   238
        y = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   239
        while (*y && *y != ',') {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   240
            ++y;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   241
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   242
        if (!*y) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   243
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   244
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   245
        *y++ = '\0';
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   246
        state->window_x = SDL_atoi(x);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   247
        state->window_y = SDL_atoi(y);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   248
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   249
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   250
    if (SDL_strcasecmp(argv[index], "--geometry") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   251
        char *w, *h;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   252
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   253
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   254
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   255
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   256
        w = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   257
        h = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   258
        while (*h && *h != 'x') {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   259
            ++h;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   260
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   261
        if (!*h) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   262
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   263
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   264
        *h++ = '\0';
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   265
        state->window_w = SDL_atoi(w);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   266
        state->window_h = SDL_atoi(h);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   267
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   268
    }
6788
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   269
    if (SDL_strcasecmp(argv[index], "--min-geometry") == 0) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   270
        char *w, *h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   271
        ++index;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   272
        if (!argv[index]) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   273
            return -1;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   274
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   275
        w = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   276
        h = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   277
        while (*h && *h != 'x') {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   278
            ++h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   279
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   280
        if (!*h) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   281
            return -1;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   282
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   283
        *h++ = '\0';
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   284
        state->window_minW = SDL_atoi(w);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   285
        state->window_minH = SDL_atoi(h);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   286
        return 2;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   287
    }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   288
    if (SDL_strcasecmp(argv[index], "--max-geometry") == 0) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   289
        char *w, *h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   290
        ++index;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   291
        if (!argv[index]) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   292
            return -1;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   293
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   294
        w = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   295
        h = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   296
        while (*h && *h != 'x') {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   297
            ++h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   298
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   299
        if (!*h) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   300
            return -1;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   301
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   302
        *h++ = '\0';
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   303
        state->window_maxW = SDL_atoi(w);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   304
        state->window_maxH = SDL_atoi(h);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   305
        return 2;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   306
    }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   307
    if (SDL_strcasecmp(argv[index], "--depth") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   308
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   309
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   310
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   311
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   312
        state->depth = SDL_atoi(argv[index]);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   313
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   314
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   315
    if (SDL_strcasecmp(argv[index], "--refresh") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   316
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   317
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   318
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   319
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   320
        state->refresh_rate = SDL_atoi(argv[index]);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   321
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   322
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   323
    if (SDL_strcasecmp(argv[index], "--vsync") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   324
        state->render_flags |= SDL_RENDERER_PRESENTVSYNC;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   325
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   326
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   327
    if (SDL_strcasecmp(argv[index], "--noframe") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   328
        state->window_flags |= SDL_WINDOW_BORDERLESS;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   329
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   330
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   331
    if (SDL_strcasecmp(argv[index], "--resize") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   332
        state->window_flags |= SDL_WINDOW_RESIZABLE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   333
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   334
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   335
    if (SDL_strcasecmp(argv[index], "--minimize") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   336
        state->window_flags |= SDL_WINDOW_MINIMIZED;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   337
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   338
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   339
    if (SDL_strcasecmp(argv[index], "--maximize") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   340
        state->window_flags |= SDL_WINDOW_MAXIMIZED;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   341
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   342
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   343
    if (SDL_strcasecmp(argv[index], "--grab") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   344
        state->window_flags |= SDL_WINDOW_INPUT_GRABBED;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   345
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   346
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   347
    if (SDL_strcasecmp(argv[index], "--rate") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   348
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   349
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   350
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   351
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   352
        state->audiospec.freq = SDL_atoi(argv[index]);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   353
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   354
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   355
    if (SDL_strcasecmp(argv[index], "--format") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   356
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   357
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   358
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   359
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   360
        if (SDL_strcasecmp(argv[index], "U8") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   361
            state->audiospec.format = AUDIO_U8;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   362
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   363
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   364
        if (SDL_strcasecmp(argv[index], "S8") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   365
            state->audiospec.format = AUDIO_S8;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   366
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   367
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   368
        if (SDL_strcasecmp(argv[index], "U16") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   369
            state->audiospec.format = AUDIO_U16;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   370
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   371
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   372
        if (SDL_strcasecmp(argv[index], "U16LE") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   373
            state->audiospec.format = AUDIO_U16LSB;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   374
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   375
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   376
        if (SDL_strcasecmp(argv[index], "U16BE") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   377
            state->audiospec.format = AUDIO_U16MSB;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   378
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   379
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   380
        if (SDL_strcasecmp(argv[index], "S16") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   381
            state->audiospec.format = AUDIO_S16;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   382
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   383
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   384
        if (SDL_strcasecmp(argv[index], "S16LE") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   385
            state->audiospec.format = AUDIO_S16LSB;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   386
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   387
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   388
        if (SDL_strcasecmp(argv[index], "S16BE") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   389
            state->audiospec.format = AUDIO_S16MSB;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   390
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   391
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   392
        return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   393
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   394
    if (SDL_strcasecmp(argv[index], "--channels") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   395
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   396
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   397
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   398
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   399
        state->audiospec.channels = (Uint8) SDL_atoi(argv[index]);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   400
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   401
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   402
    if (SDL_strcasecmp(argv[index], "--samples") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   403
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   404
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   405
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   406
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   407
        state->audiospec.samples = (Uint16) SDL_atoi(argv[index]);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   408
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   409
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   410
    if ((SDL_strcasecmp(argv[index], "-h") == 0)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   411
        || (SDL_strcasecmp(argv[index], "--help") == 0)) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   412
        /* Print the usage message */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   413
        return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   414
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   415
    if (SDL_strcmp(argv[index], "-NSDocumentRevisionsDebugMode") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   416
	/* Debug flag sent by Xcode */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   417
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   418
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   419
    return 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   420
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   421
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   422
const char *
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   423
SDLTest_CommonUsage(SDLTest_CommonState * state)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   424
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   425
    switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   426
    case SDL_INIT_VIDEO:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   427
        return VIDEO_USAGE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   428
    case SDL_INIT_AUDIO:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   429
        return AUDIO_USAGE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   430
    case (SDL_INIT_VIDEO | SDL_INIT_AUDIO):
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   431
        return VIDEO_USAGE " " AUDIO_USAGE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   432
    default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   433
        return "";
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   434
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   435
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   436
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   437
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   438
SDLTest_PrintRendererFlag(Uint32 flag)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   439
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   440
    switch (flag) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   441
    case SDL_RENDERER_PRESENTVSYNC:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   442
        fprintf(stderr, "PresentVSync");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   443
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   444
    case SDL_RENDERER_ACCELERATED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   445
        fprintf(stderr, "Accelerated");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   446
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   447
    default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   448
        fprintf(stderr, "0x%8.8x", flag);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   449
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   450
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   451
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   452
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   453
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   454
SDLTest_PrintPixelFormat(Uint32 format)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   455
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   456
    switch (format) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   457
    case SDL_PIXELFORMAT_UNKNOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   458
        fprintf(stderr, "Unknwon");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   459
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   460
    case SDL_PIXELFORMAT_INDEX1LSB:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   461
        fprintf(stderr, "Index1LSB");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   462
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   463
    case SDL_PIXELFORMAT_INDEX1MSB:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   464
        fprintf(stderr, "Index1MSB");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   465
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   466
    case SDL_PIXELFORMAT_INDEX4LSB:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   467
        fprintf(stderr, "Index4LSB");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   468
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   469
    case SDL_PIXELFORMAT_INDEX4MSB:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   470
        fprintf(stderr, "Index4MSB");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   471
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   472
    case SDL_PIXELFORMAT_INDEX8:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   473
        fprintf(stderr, "Index8");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   474
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   475
    case SDL_PIXELFORMAT_RGB332:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   476
        fprintf(stderr, "RGB332");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   477
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   478
    case SDL_PIXELFORMAT_RGB444:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   479
        fprintf(stderr, "RGB444");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   480
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   481
    case SDL_PIXELFORMAT_RGB555:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   482
        fprintf(stderr, "RGB555");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   483
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   484
    case SDL_PIXELFORMAT_BGR555:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   485
        fprintf(stderr, "BGR555");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   486
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   487
    case SDL_PIXELFORMAT_ARGB4444:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   488
        fprintf(stderr, "ARGB4444");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   489
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   490
    case SDL_PIXELFORMAT_ABGR4444:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   491
        fprintf(stderr, "ABGR4444");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   492
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   493
    case SDL_PIXELFORMAT_ARGB1555:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   494
        fprintf(stderr, "ARGB1555");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   495
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   496
    case SDL_PIXELFORMAT_ABGR1555:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   497
        fprintf(stderr, "ABGR1555");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   498
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   499
    case SDL_PIXELFORMAT_RGB565:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   500
        fprintf(stderr, "RGB565");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   501
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   502
    case SDL_PIXELFORMAT_BGR565:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   503
        fprintf(stderr, "BGR565");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   504
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   505
    case SDL_PIXELFORMAT_RGB24:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   506
        fprintf(stderr, "RGB24");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   507
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   508
    case SDL_PIXELFORMAT_BGR24:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   509
        fprintf(stderr, "BGR24");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   510
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   511
    case SDL_PIXELFORMAT_RGB888:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   512
        fprintf(stderr, "RGB888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   513
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   514
    case SDL_PIXELFORMAT_BGR888:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   515
        fprintf(stderr, "BGR888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   516
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   517
    case SDL_PIXELFORMAT_ARGB8888:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   518
        fprintf(stderr, "ARGB8888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   519
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   520
    case SDL_PIXELFORMAT_RGBA8888:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   521
        fprintf(stderr, "RGBA8888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   522
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   523
    case SDL_PIXELFORMAT_ABGR8888:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   524
        fprintf(stderr, "ABGR8888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   525
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   526
    case SDL_PIXELFORMAT_BGRA8888:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   527
        fprintf(stderr, "BGRA8888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   528
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   529
    case SDL_PIXELFORMAT_ARGB2101010:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   530
        fprintf(stderr, "ARGB2101010");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   531
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   532
    case SDL_PIXELFORMAT_YV12:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   533
        fprintf(stderr, "YV12");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   534
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   535
    case SDL_PIXELFORMAT_IYUV:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   536
        fprintf(stderr, "IYUV");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   537
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   538
    case SDL_PIXELFORMAT_YUY2:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   539
        fprintf(stderr, "YUY2");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   540
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   541
    case SDL_PIXELFORMAT_UYVY:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   542
        fprintf(stderr, "UYVY");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   543
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   544
    case SDL_PIXELFORMAT_YVYU:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   545
        fprintf(stderr, "YVYU");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   546
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   547
    default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   548
        fprintf(stderr, "0x%8.8x", format);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   549
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   550
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   551
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   552
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   553
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   554
SDLTest_PrintRenderer(SDL_RendererInfo * info)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   555
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   556
    int i, count;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   557
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   558
    fprintf(stderr, "  Renderer %s:\n", info->name);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   559
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   560
    fprintf(stderr, "    Flags: 0x%8.8X", info->flags);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   561
    fprintf(stderr, " (");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   562
    count = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   563
    for (i = 0; i < sizeof(info->flags) * 8; ++i) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   564
        Uint32 flag = (1 << i);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   565
        if (info->flags & flag) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   566
            if (count > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   567
                fprintf(stderr, " | ");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   568
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   569
            SDLTest_PrintRendererFlag(flag);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   570
            ++count;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   571
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   572
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   573
    fprintf(stderr, ")\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   574
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   575
    fprintf(stderr, "    Texture formats (%d): ", info->num_texture_formats);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   576
    for (i = 0; i < (int) info->num_texture_formats; ++i) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   577
        if (i > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   578
            fprintf(stderr, ", ");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   579
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   580
        SDLTest_PrintPixelFormat(info->texture_formats[i]);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   581
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   582
    fprintf(stderr, "\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   583
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   584
    if (info->max_texture_width || info->max_texture_height) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   585
        fprintf(stderr, "    Max Texture Size: %dx%d\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   586
                info->max_texture_width, info->max_texture_height);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   587
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   588
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   589
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   590
static SDL_Surface *
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   591
SDLTest_LoadIcon(const char *file)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   592
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   593
    SDL_Surface *icon;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   594
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   595
    /* Load the icon surface */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   596
    icon = SDL_LoadBMP(file);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   597
    if (icon == NULL) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   598
        fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   599
        return (NULL);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   600
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   601
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   602
    if (icon->format->palette) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   603
        /* Set the colorkey */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   604
        SDL_SetColorKey(icon, 1, *((Uint8 *) icon->pixels));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   605
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   606
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   607
    return (icon);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   608
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   609
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   610
SDL_bool
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   611
SDLTest_CommonInit(SDLTest_CommonState * state)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   612
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   613
    int i, j, m, n, w, h;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   614
    SDL_DisplayMode fullscreen_mode;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   615
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   616
    if (state->flags & SDL_INIT_VIDEO) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   617
        if (state->verbose & VERBOSE_VIDEO) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   618
            n = SDL_GetNumVideoDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   619
            if (n == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   620
                fprintf(stderr, "No built-in video drivers\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   621
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   622
                fprintf(stderr, "Built-in video drivers:");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   623
                for (i = 0; i < n; ++i) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   624
                    if (i > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   625
                        fprintf(stderr, ",");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   626
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   627
                    fprintf(stderr, " %s", SDL_GetVideoDriver(i));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   628
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   629
                fprintf(stderr, "\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   630
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   631
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   632
        if (SDL_VideoInit(state->videodriver) < 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   633
            fprintf(stderr, "Couldn't initialize video driver: %s\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   634
                    SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   635
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   636
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   637
        if (state->verbose & VERBOSE_VIDEO) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   638
            fprintf(stderr, "Video driver: %s\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   639
                    SDL_GetCurrentVideoDriver());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   640
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   641
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   642
        /* Upload GL settings */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   643
        SDL_GL_SetAttribute(SDL_GL_RED_SIZE, state->gl_red_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   644
        SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, state->gl_green_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   645
        SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, state->gl_blue_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   646
        SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, state->gl_alpha_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   647
        SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, state->gl_double_buffer);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   648
        SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, state->gl_buffer_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   649
        SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, state->gl_depth_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   650
        SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, state->gl_stencil_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   651
        SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, state->gl_accum_red_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   652
        SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, state->gl_accum_green_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   653
        SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, state->gl_accum_blue_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   654
        SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, state->gl_accum_alpha_size);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   655
        SDL_GL_SetAttribute(SDL_GL_STEREO, state->gl_stereo);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   656
        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, state->gl_multisamplebuffers);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   657
        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, state->gl_multisamplesamples);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   658
        if (state->gl_accelerated >= 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   659
            SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   660
                                state->gl_accelerated);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   661
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   662
        SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, state->gl_retained_backing);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   663
        if (state->gl_major_version) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   664
            SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, state->gl_major_version);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   665
            SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, state->gl_minor_version);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   666
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   667
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   668
        if (state->verbose & VERBOSE_MODES) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   669
            SDL_Rect bounds;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   670
            SDL_DisplayMode mode;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   671
            int bpp;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   672
            Uint32 Rmask, Gmask, Bmask, Amask;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   673
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   674
            n = SDL_GetNumVideoDisplays();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   675
            fprintf(stderr, "Number of displays: %d\n", n);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   676
            for (i = 0; i < n; ++i) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   677
                fprintf(stderr, "Display %d:\n", i);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   678
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   679
                SDL_zero(bounds);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   680
                SDL_GetDisplayBounds(i, &bounds);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   681
                fprintf(stderr, "Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   682
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   683
                SDL_GetDesktopDisplayMode(i, &mode);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   684
                SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   685
                                           &Bmask, &Amask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   686
                fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   687
                        "  Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   688
                        mode.w, mode.h, mode.refresh_rate, bpp,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   689
                        SDL_GetPixelFormatName(mode.format));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   690
                if (Rmask || Gmask || Bmask) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   691
                    fprintf(stderr, "      Red Mask   = 0x%.8x\n", Rmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   692
                    fprintf(stderr, "      Green Mask = 0x%.8x\n", Gmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   693
                    fprintf(stderr, "      Blue Mask  = 0x%.8x\n", Bmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   694
                    if (Amask)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   695
                        fprintf(stderr, "      Alpha Mask = 0x%.8x\n", Amask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   696
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   697
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   698
                /* Print available fullscreen video modes */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   699
                m = SDL_GetNumDisplayModes(i);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   700
                if (m == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   701
                    fprintf(stderr, "No available fullscreen video modes\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   702
                } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   703
                    fprintf(stderr, "  Fullscreen video modes:\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   704
                    for (j = 0; j < m; ++j) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   705
                        SDL_GetDisplayMode(i, j, &mode);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   706
                        SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   707
                                                   &Gmask, &Bmask, &Amask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   708
                        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   709
                                "    Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   710
                                j, mode.w, mode.h, mode.refresh_rate, bpp,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   711
                                SDL_GetPixelFormatName(mode.format));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   712
                        if (Rmask || Gmask || Bmask) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   713
                            fprintf(stderr, "        Red Mask   = 0x%.8x\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   714
                                    Rmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   715
                            fprintf(stderr, "        Green Mask = 0x%.8x\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   716
                                    Gmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   717
                            fprintf(stderr, "        Blue Mask  = 0x%.8x\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   718
                                    Bmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   719
                            if (Amask)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   720
                                fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   721
                                        "        Alpha Mask = 0x%.8x\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   722
                                        Amask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   723
                        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   724
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   725
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   726
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   727
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   728
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   729
        if (state->verbose & VERBOSE_RENDER) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   730
            SDL_RendererInfo info;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   731
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   732
            n = SDL_GetNumRenderDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   733
            if (n == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   734
                fprintf(stderr, "No built-in render drivers\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   735
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   736
                fprintf(stderr, "Built-in render drivers:\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   737
                for (i = 0; i < n; ++i) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   738
                    SDL_GetRenderDriverInfo(i, &info);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   739
                    SDLTest_PrintRenderer(&info);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   740
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   741
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   742
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   743
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   744
        SDL_zero(fullscreen_mode);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   745
        switch (state->depth) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   746
        case 8:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   747
            fullscreen_mode.format = SDL_PIXELFORMAT_INDEX8;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   748
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   749
        case 15:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   750
            fullscreen_mode.format = SDL_PIXELFORMAT_RGB555;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   751
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   752
        case 16:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   753
            fullscreen_mode.format = SDL_PIXELFORMAT_RGB565;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   754
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   755
        case 24:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   756
            fullscreen_mode.format = SDL_PIXELFORMAT_RGB24;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   757
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   758
        default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   759
            fullscreen_mode.format = SDL_PIXELFORMAT_RGB888;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   760
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   761
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   762
        fullscreen_mode.refresh_rate = state->refresh_rate;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   763
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   764
        state->windows =
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   765
            (SDL_Window **) SDL_malloc(state->num_windows *
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   766
                                        sizeof(*state->windows));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   767
        state->renderers =
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   768
            (SDL_Renderer **) SDL_malloc(state->num_windows *
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   769
                                        sizeof(*state->renderers));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   770
        if (!state->windows || !state->renderers) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   771
            fprintf(stderr, "Out of memory!\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   772
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   773
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   774
        for (i = 0; i < state->num_windows; ++i) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   775
            char title[1024];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   776
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   777
            if (state->num_windows > 1) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   778
                SDL_snprintf(title, SDL_arraysize(title), "%s %d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   779
                             state->window_title, i + 1);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   780
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   781
                SDL_strlcpy(title, state->window_title, SDL_arraysize(title));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   782
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   783
            state->windows[i] =
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   784
                SDL_CreateWindow(title, state->window_x, state->window_y,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   785
                                 state->window_w, state->window_h,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   786
                                 state->window_flags);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   787
            if (!state->windows[i]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   788
                fprintf(stderr, "Couldn't create window: %s\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   789
                        SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   790
                return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   791
            }
6788
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   792
            if (state->window_minW || state->window_minH) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   793
                SDL_SetWindowMinimumSize(state->windows[i], state->window_minW, state->window_minH);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   794
            }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   795
            if (state->window_maxW || state->window_maxH) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   796
                SDL_SetWindowMaximumSize(state->windows[i], state->window_maxW, state->window_maxH);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   797
            }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   798
            SDL_GetWindowSize(state->windows[i], &w, &h);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   799
            if (!(state->window_flags & SDL_WINDOW_RESIZABLE) &&
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   800
                (w != state->window_w || h != state->window_h)) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   801
                printf("Window requested size %dx%d, got %dx%d\n", state->window_w, state->window_h, w, h);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   802
                state->window_w = w;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   803
                state->window_h = h;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   804
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   805
            if (SDL_SetWindowDisplayMode(state->windows[i], &fullscreen_mode) < 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   806
                fprintf(stderr, "Can't set up fullscreen display mode: %s\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   807
                        SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   808
                return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   809
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   810
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   811
            if (state->window_icon) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   812
                SDL_Surface *icon = SDLTest_LoadIcon(state->window_icon);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   813
                if (icon) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   814
                    SDL_SetWindowIcon(state->windows[i], icon);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   815
                    SDL_FreeSurface(icon);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   816
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   817
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   818
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   819
            SDL_ShowWindow(state->windows[i]);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   820
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   821
            state->renderers[i] = NULL;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   822
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   823
            if (!state->skip_renderer
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   824
                && (state->renderdriver
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   825
                    || !(state->window_flags & SDL_WINDOW_OPENGL))) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   826
                m = -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   827
                if (state->renderdriver) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   828
                    SDL_RendererInfo info;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   829
                    n = SDL_GetNumRenderDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   830
                    for (j = 0; j < n; ++j) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   831
                        SDL_GetRenderDriverInfo(j, &info);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   832
                        if (SDL_strcasecmp(info.name, state->renderdriver) ==
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   833
                            0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   834
                            m = j;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   835
                            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   836
                        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   837
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   838
                    if (m == n) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   839
                        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   840
                                "Couldn't find render driver named %s",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   841
                                state->renderdriver);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   842
                        return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   843
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   844
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   845
                state->renderers[i] = SDL_CreateRenderer(state->windows[i],
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   846
                                            m, state->render_flags);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   847
                if (!state->renderers[i]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   848
                    fprintf(stderr, "Couldn't create renderer: %s\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   849
                            SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   850
                    return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   851
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   852
                if (state->verbose & VERBOSE_RENDER) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   853
                    SDL_RendererInfo info;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   854
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   855
                    fprintf(stderr, "Current renderer:\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   856
                    SDL_GetRendererInfo(state->renderers[i], &info);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   857
                    SDLTest_PrintRenderer(&info);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   858
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   859
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   860
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   861
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   862
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   863
    if (state->flags & SDL_INIT_AUDIO) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   864
        if (state->verbose & VERBOSE_AUDIO) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   865
            n = SDL_GetNumAudioDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   866
            if (n == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   867
                fprintf(stderr, "No built-in audio drivers\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   868
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   869
                fprintf(stderr, "Built-in audio drivers:");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   870
                for (i = 0; i < n; ++i) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   871
                    if (i > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   872
                        fprintf(stderr, ",");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   873
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   874
                    fprintf(stderr, " %s", SDL_GetAudioDriver(i));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   875
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   876
                fprintf(stderr, "\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   877
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   878
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   879
        if (SDL_AudioInit(state->audiodriver) < 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   880
            fprintf(stderr, "Couldn't initialize audio driver: %s\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   881
                    SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   882
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   883
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   884
        if (state->verbose & VERBOSE_VIDEO) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   885
            fprintf(stderr, "Audio driver: %s\n",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   886
                    SDL_GetCurrentAudioDriver());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   887
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   888
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   889
        if (SDL_OpenAudio(&state->audiospec, NULL) < 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   890
            fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   891
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   892
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   893
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   894
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   895
    return SDL_TRUE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   896
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   897
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   898
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   899
SDLTest_PrintEvent(SDL_Event * event)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   900
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   901
    if (event->type == SDL_MOUSEMOTION) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   902
        /* Mouse motion is really spammy */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   903
        //return;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   904
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   905
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   906
    fprintf(stderr, "SDL EVENT: ");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   907
    switch (event->type) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   908
    case SDL_WINDOWEVENT:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   909
        switch (event->window.event) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   910
        case SDL_WINDOWEVENT_SHOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   911
            fprintf(stderr, "Window %d shown", event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   912
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   913
        case SDL_WINDOWEVENT_HIDDEN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   914
            fprintf(stderr, "Window %d hidden", event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   915
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   916
        case SDL_WINDOWEVENT_EXPOSED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   917
            fprintf(stderr, "Window %d exposed", event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   918
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   919
        case SDL_WINDOWEVENT_MOVED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   920
            fprintf(stderr, "Window %d moved to %d,%d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   921
                    event->window.windowID, event->window.data1,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   922
                    event->window.data2);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   923
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   924
        case SDL_WINDOWEVENT_RESIZED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   925
            fprintf(stderr, "Window %d resized to %dx%d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   926
                    event->window.windowID, event->window.data1,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   927
                    event->window.data2);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   928
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   929
        case SDL_WINDOWEVENT_SIZE_CHANGED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   930
            fprintf(stderr, "Window %d changed size to %dx%d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   931
                    event->window.windowID, event->window.data1,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   932
                    event->window.data2);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   933
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   934
        case SDL_WINDOWEVENT_MINIMIZED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   935
            fprintf(stderr, "Window %d minimized", event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   936
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   937
        case SDL_WINDOWEVENT_MAXIMIZED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   938
            fprintf(stderr, "Window %d maximized", event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   939
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   940
        case SDL_WINDOWEVENT_RESTORED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   941
            fprintf(stderr, "Window %d restored", event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   942
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   943
        case SDL_WINDOWEVENT_ENTER:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   944
            fprintf(stderr, "Mouse entered window %d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   945
                    event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   946
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   947
        case SDL_WINDOWEVENT_LEAVE:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   948
            fprintf(stderr, "Mouse left window %d", event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   949
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   950
        case SDL_WINDOWEVENT_FOCUS_GAINED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   951
            fprintf(stderr, "Window %d gained keyboard focus",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   952
                    event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   953
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   954
        case SDL_WINDOWEVENT_FOCUS_LOST:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   955
            fprintf(stderr, "Window %d lost keyboard focus",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   956
                    event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   957
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   958
        case SDL_WINDOWEVENT_CLOSE:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   959
            fprintf(stderr, "Window %d closed", event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   960
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   961
        default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   962
            fprintf(stderr, "Window %d got unknown event %d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   963
                    event->window.windowID, event->window.event);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   964
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   965
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   966
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   967
    case SDL_KEYDOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   968
        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   969
                "Keyboard: key pressed  in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   970
                event->key.windowID,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   971
                event->key.keysym.scancode,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   972
                SDL_GetScancodeName(event->key.keysym.scancode),
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   973
                event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   974
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   975
    case SDL_KEYUP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   976
        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   977
                "Keyboard: key released in window %d: scancode 0x%08X = %s, keycode 0x%08X = %s",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   978
                event->key.windowID,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   979
                event->key.keysym.scancode,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   980
                SDL_GetScancodeName(event->key.keysym.scancode),
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   981
                event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   982
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   983
    case SDL_TEXTINPUT:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   984
        fprintf(stderr, "Keyboard: text input \"%s\" in window %d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   985
                event->text.text, event->text.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   986
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   987
    case SDL_MOUSEMOTION:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   988
        fprintf(stderr, "Mouse: moved to %d,%d (%d,%d) in window %d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   989
                event->motion.x, event->motion.y,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   990
                event->motion.xrel, event->motion.yrel,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   991
                event->motion.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   992
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   993
    case SDL_MOUSEBUTTONDOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   994
        fprintf(stderr, "Mouse: button %d pressed at %d,%d in window %d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   995
                event->button.button, event->button.x, event->button.y,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   996
                event->button.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   997
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   998
    case SDL_MOUSEBUTTONUP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   999
        fprintf(stderr, "Mouse: button %d released at %d,%d in window %d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1000
                event->button.button, event->button.x, event->button.y,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1001
                event->button.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1002
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1003
    case SDL_MOUSEWHEEL:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1004
        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1005
                "Mouse: wheel scrolled %d in x and %d in y in window %d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1006
                event->wheel.x, event->wheel.y, event->wheel.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1007
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1008
    case SDL_JOYBALLMOTION:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1009
        fprintf(stderr, "Joystick %d: ball %d moved by %d,%d",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1010
                event->jball.which, event->jball.ball, event->jball.xrel,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1011
                event->jball.yrel);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1012
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1013
    case SDL_JOYHATMOTION:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1014
        fprintf(stderr, "Joystick %d: hat %d moved to ", event->jhat.which,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1015
                event->jhat.hat);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1016
        switch (event->jhat.value) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1017
        case SDL_HAT_CENTERED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1018
            fprintf(stderr, "CENTER");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1019
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1020
        case SDL_HAT_UP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1021
            fprintf(stderr, "UP");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1022
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1023
        case SDL_HAT_RIGHTUP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1024
            fprintf(stderr, "RIGHTUP");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1025
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1026
        case SDL_HAT_RIGHT:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1027
            fprintf(stderr, "RIGHT");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1028
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1029
        case SDL_HAT_RIGHTDOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1030
            fprintf(stderr, "RIGHTDOWN");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1031
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1032
        case SDL_HAT_DOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1033
            fprintf(stderr, "DOWN");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1034
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1035
        case SDL_HAT_LEFTDOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1036
            fprintf(stderr, "LEFTDOWN");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1037
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1038
        case SDL_HAT_LEFT:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1039
            fprintf(stderr, "LEFT");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1040
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1041
        case SDL_HAT_LEFTUP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1042
            fprintf(stderr, "LEFTUP");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1043
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1044
        default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1045
            fprintf(stderr, "UNKNOWN");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1046
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1047
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1048
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1049
    case SDL_JOYBUTTONDOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1050
        fprintf(stderr, "Joystick %d: button %d pressed",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1051
                event->jbutton.which, event->jbutton.button);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1052
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1053
    case SDL_JOYBUTTONUP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1054
        fprintf(stderr, "Joystick %d: button %d released",
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1055
                event->jbutton.which, event->jbutton.button);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1056
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1057
    case SDL_CLIPBOARDUPDATE:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1058
        fprintf(stderr, "Clipboard updated");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1059
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1060
    case SDL_QUIT:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1061
        fprintf(stderr, "Quit requested");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1062
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1063
    case SDL_USEREVENT:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1064
        fprintf(stderr, "User event %d", event->user.code);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1065
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1066
    default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1067
        fprintf(stderr, "Unknown event %d", event->type);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1068
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1069
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1070
    fprintf(stderr, "\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1071
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1072
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1073
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1074
SDLTest_ScreenShot(SDL_Renderer *renderer)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1075
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1076
    SDL_Rect viewport;