src/test/SDL_test_common.c
author Sam Lantinga <slouken@libsdl.org>
Wed, 29 May 2013 03:22:19 -0700
changeset 7240 39eb4958950a
parent 7194 987fb567bba9
child 7249 606c8fcfef2f
permissions -rw-r--r--
When the window is resized, the viewport is automatically reset. This resolves lots of confusion around resizable windows. Most people don't expect a viewport to be implicitly set when the renderer is created and then not to be reset to the window size if the window is resized. Added common test command line parameters --logical WxH and --scale N to test the render logical size and scaling APIs.
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
6885
700f1b25f77f Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 6796
diff changeset
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
6727
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 \
7240
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
    30
"[--video driver] [--renderer driver] [--gldebug] [--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] [--logical WxH] [--scale N] [--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
    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
    48
    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
    49
    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
    50
    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
    51
    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
    52
    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
    53
    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
    54
    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
    55
    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
    56
    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
    57
    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
    58
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    59
    /* 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
    60
    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
    61
    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
    62
    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
    63
    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
    64
    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
    65
    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
    66
    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
    67
    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
    68
    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
    69
    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
    70
    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
    71
    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
    72
    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
    73
    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
    74
    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
    75
    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
    76
    state->gl_accelerated = -1;
7194
987fb567bba9 Fixed bug 1837 - Use error extension instead of glGetError()
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    77
    state->gl_debug = 0;
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    78
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    79
    return state;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    80
}
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
int
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    83
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
    84
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    85
    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
    86
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    87
    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
    88
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    89
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    90
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    91
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    92
        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
    93
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    94
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    95
    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
    96
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    97
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    98
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
    99
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   100
        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
   101
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   102
    }
7194
987fb567bba9 Fixed bug 1837 - Use error extension instead of glGetError()
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   103
    if (SDL_strcasecmp(argv[index], "--gldebug") == 0) {
987fb567bba9 Fixed bug 1837 - Use error extension instead of glGetError()
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   104
        state->gl_debug = 1;
987fb567bba9 Fixed bug 1837 - Use error extension instead of glGetError()
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   105
        return 1;
987fb567bba9 Fixed bug 1837 - Use error extension instead of glGetError()
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   106
    }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   107
    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
   108
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   109
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   110
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   111
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   112
        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
   113
            state->verbose |=
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   114
                (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
   115
                 VERBOSE_EVENT);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   116
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   117
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   118
        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
   119
            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
   120
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   121
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   122
        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
   123
            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
   124
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   125
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   126
        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
   127
            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
   128
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   129
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   130
        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
   131
            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
   132
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   133
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   134
        return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   135
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   136
    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
   137
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   138
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   139
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   140
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   141
        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
   142
            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
   143
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   144
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   145
        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
   146
            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
   147
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   148
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   149
        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
   150
            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
   151
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   152
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   153
        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
   154
            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
   155
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   156
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   157
        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
   158
            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
   159
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   160
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   161
        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
   162
            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
   163
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   164
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   165
        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
   166
            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
   167
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   168
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   169
        return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   170
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   171
    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
   172
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   173
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   174
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   175
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   176
        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
   177
        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
   178
            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
   179
            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
   180
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   181
        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
   182
            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
   183
            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
   184
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   185
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   186
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   187
    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
   188
        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
   189
        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
   190
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   191
    }
6783
001f59dc43be Added --fullscreen-desktop option to test the new SDL_WINDOW_FULLSCREEN_DESKTOP functionality
Sam Lantinga <slouken@libsdl.org>
parents: 6727
diff changeset
   192
    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
   193
        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
   194
        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
   195
        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
   196
    }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   197
    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
   198
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   199
        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
   200
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   201
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   202
        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
   203
            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
   204
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   205
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   206
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   207
    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
   208
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   209
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   210
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   211
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   212
        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
   213
        return 2;
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
    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
   216
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   217
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   218
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   219
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   220
        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
   221
        return 2;
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
    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
   224
        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
   225
        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
   226
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   227
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   228
    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
   229
        char *x, *y;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   230
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   231
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   232
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   233
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   234
        x = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   235
        y = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   236
        while (*y && *y != ',') {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   237
            ++y;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   238
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   239
        if (!*y) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   240
            return -1;
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
        *y++ = '\0';
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   243
        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
   244
        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
   245
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   246
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   247
    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
   248
        char *w, *h;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   249
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   250
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   251
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   252
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   253
        w = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   254
        h = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   255
        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
   256
            ++h;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   257
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   258
        if (!*h) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   259
            return -1;
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
        *h++ = '\0';
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   262
        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
   263
        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
   264
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   265
    }
6788
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   266
    if (SDL_strcasecmp(argv[index], "--min-geometry") == 0) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   267
        char *w, *h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   268
        ++index;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   269
        if (!argv[index]) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   270
            return -1;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   271
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   272
        w = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   273
        h = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   274
        while (*h && *h != 'x') {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   275
            ++h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   276
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   277
        if (!*h) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   278
            return -1;
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
        *h++ = '\0';
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   281
        state->window_minW = SDL_atoi(w);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   282
        state->window_minH = SDL_atoi(h);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   283
        return 2;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   284
    }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   285
    if (SDL_strcasecmp(argv[index], "--max-geometry") == 0) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   286
        char *w, *h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   287
        ++index;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   288
        if (!argv[index]) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   289
            return -1;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   290
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   291
        w = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   292
        h = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   293
        while (*h && *h != 'x') {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   294
            ++h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   295
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   296
        if (!*h) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   297
            return -1;
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
        *h++ = '\0';
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   300
        state->window_maxW = SDL_atoi(w);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   301
        state->window_maxH = SDL_atoi(h);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   302
        return 2;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   303
    }
7240
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   304
    if (SDL_strcasecmp(argv[index], "--logical") == 0) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   305
        char *w, *h;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   306
        ++index;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   307
        if (!argv[index]) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   308
            return -1;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   309
        }
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   310
        w = argv[index];
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   311
        h = argv[index];
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   312
        while (*h && *h != 'x') {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   313
            ++h;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   314
        }
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   315
        if (!*h) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   316
            return -1;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   317
        }
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   318
        *h++ = '\0';
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   319
        state->logical_w = SDL_atoi(w);
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   320
        state->logical_h = SDL_atoi(h);
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   321
        return 2;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   322
    }
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   323
    if (SDL_strcasecmp(argv[index], "--scale") == 0) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   324
        ++index;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   325
        if (!argv[index]) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   326
            return -1;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   327
        }
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   328
        state->scale = SDL_atof(argv[index]);
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   329
        return 2;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   330
    }
6727
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], "--depth") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   332
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   333
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   334
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   335
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   336
        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
   337
        return 2;
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], "--refresh") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   340
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   341
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   342
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   343
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   344
        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
   345
        return 2;
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], "--vsync") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   348
        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
   349
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   350
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   351
    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
   352
        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
   353
        return 1;
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], "--resize") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   356
        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
   357
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   358
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   359
    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
   360
        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
   361
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   362
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   363
    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
   364
        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
   365
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   366
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   367
    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
   368
        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
   369
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   370
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   371
    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
   372
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   373
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   374
            return -1;
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
        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
   377
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   378
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   379
    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
   380
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   381
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   382
            return -1;
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], "U8") == 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_U8;
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], "S8") == 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_S8;
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
        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
   393
            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
   394
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   395
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   396
        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
   397
            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
   398
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   399
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   400
        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
   401
            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
   402
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   403
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   404
        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
   405
            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
   406
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   407
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   408
        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
   409
            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
   410
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   411
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   412
        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
   413
            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
   414
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   415
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   416
        return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   417
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   418
    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
   419
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   420
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   421
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   422
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   423
        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
   424
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   425
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   426
    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
   427
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   428
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   429
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   430
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   431
        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
   432
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   433
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   434
    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
   435
        || (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
   436
        /* 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
   437
        return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   438
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   439
    if (SDL_strcmp(argv[index], "-NSDocumentRevisionsDebugMode") == 0) {
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7141
diff changeset
   440
    /* Debug flag sent by Xcode */
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   441
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   442
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   443
    return 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   444
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   445
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   446
const char *
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   447
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
   448
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   449
    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
   450
    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
   451
        return VIDEO_USAGE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   452
    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
   453
        return AUDIO_USAGE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   454
    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
   455
        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
   456
    default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   457
        return "";
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   458
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   459
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   460
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   461
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   462
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
   463
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   464
    switch (flag) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   465
    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
   466
        fprintf(stderr, "PresentVSync");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   467
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   468
    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
   469
        fprintf(stderr, "Accelerated");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   470
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   471
    default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   472
        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
   473
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   474
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   475
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   476
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   477
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   478
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
   479
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   480
    switch (format) {
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_UNKNOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   482
        fprintf(stderr, "Unknwon");
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_INDEX1LSB:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   485
        fprintf(stderr, "Index1LSB");
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_INDEX1MSB:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   488
        fprintf(stderr, "Index1MSB");
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_INDEX4LSB:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   491
        fprintf(stderr, "Index4LSB");
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_INDEX4MSB:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   494
        fprintf(stderr, "Index4MSB");
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_INDEX8:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   497
        fprintf(stderr, "Index8");
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_RGB332:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   500
        fprintf(stderr, "RGB332");
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_RGB444:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   503
        fprintf(stderr, "RGB444");
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_RGB555:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   506
        fprintf(stderr, "RGB555");
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_BGR555:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   509
        fprintf(stderr, "BGR555");
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_ARGB4444:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   512
        fprintf(stderr, "ARGB4444");
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_ABGR4444:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   515
        fprintf(stderr, "ABGR4444");
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_ARGB1555:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   518
        fprintf(stderr, "ARGB1555");
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_ABGR1555:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   521
        fprintf(stderr, "ABGR1555");
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_RGB565:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   524
        fprintf(stderr, "RGB565");
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_BGR565:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   527
        fprintf(stderr, "BGR565");
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_RGB24:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   530
        fprintf(stderr, "RGB24");
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_BGR24:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   533
        fprintf(stderr, "BGR24");
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_RGB888:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   536
        fprintf(stderr, "RGB888");
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_BGR888:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   539
        fprintf(stderr, "BGR888");
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_ARGB8888:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   542
        fprintf(stderr, "ARGB8888");
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_RGBA8888:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   545
        fprintf(stderr, "RGBA8888");
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
    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
   548
        fprintf(stderr, "ABGR8888");
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
    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
   551
        fprintf(stderr, "BGRA8888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   552
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   553
    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
   554
        fprintf(stderr, "ARGB2101010");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   555
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   556
    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
   557
        fprintf(stderr, "YV12");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   558
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   559
    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
   560
        fprintf(stderr, "IYUV");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   561
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   562
    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
   563
        fprintf(stderr, "YUY2");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   564
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   565
    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
   566
        fprintf(stderr, "UYVY");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   567
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   568
    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
   569
        fprintf(stderr, "YVYU");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   570
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   571
    default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   572
        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
   573
        break;
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
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   576
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   577
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   578
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
   579
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   580
    int i, count;
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, "  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
   583
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   584
    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
   585
    fprintf(stderr, " (");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   586
    count = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   587
    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
   588
        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
   589
        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
   590
            if (count > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   591
                fprintf(stderr, " | ");
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
            SDLTest_PrintRendererFlag(flag);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   594
            ++count;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   595
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   596
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   597
    fprintf(stderr, ")\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   598
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   599
    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
   600
    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
   601
        if (i > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   602
            fprintf(stderr, ", ");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   603
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   604
        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
   605
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   606
    fprintf(stderr, "\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   607
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   608
    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
   609
        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
   610
                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
   611
    }
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
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   614
static SDL_Surface *
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   615
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
   616
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   617
    SDL_Surface *icon;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   618
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   619
    /* 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
   620
    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
   621
    if (icon == NULL) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   622
        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
   623
        return (NULL);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   624
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   625
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   626
    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
   627
        /* Set the colorkey */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   628
        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
   629
    }
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
    return (icon);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   632
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   633
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   634
SDL_bool
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   635
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
   636
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   637
    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
   638
    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
   639
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   640
    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
   641
        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
   642
            n = SDL_GetNumVideoDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   643
            if (n == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   644
                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
   645
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   646
                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
   647
                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
   648
                    if (i > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   649
                        fprintf(stderr, ",");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   650
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   651
                    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
   652
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   653
                fprintf(stderr, "\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   654
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   655
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   656
        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
   657
            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
   658
                    SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   659
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   660
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   661
        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
   662
            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
   663
                    SDL_GetCurrentVideoDriver());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   664
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   665
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   666
        /* Upload GL settings */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   667
        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
   668
        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
   669
        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
   670
        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
   671
        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
   672
        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
   673
        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
   674
        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
   675
        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
   676
        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
   677
        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
   678
        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
   679
        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
   680
        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
   681
        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
   682
        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
   683
            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
   684
                                state->gl_accelerated);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   685
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   686
        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
   687
        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
   688
            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
   689
            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
   690
        }
7194
987fb567bba9 Fixed bug 1837 - Use error extension instead of glGetError()
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   691
        if (state->gl_debug) {
987fb567bba9 Fixed bug 1837 - Use error extension instead of glGetError()
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   692
            SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
987fb567bba9 Fixed bug 1837 - Use error extension instead of glGetError()
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   693
        }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   694
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   695
        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
   696
            SDL_Rect bounds;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   697
            SDL_DisplayMode mode;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   698
            int bpp;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   699
            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
   700
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   701
            n = SDL_GetNumVideoDisplays();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   702
            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
   703
            for (i = 0; i < n; ++i) {
6796
424a12862805 Implemented SDL_GetDisplayName() for X11, which requires the XRandR extension.
Sam Lantinga <slouken@libsdl.org>
parents: 6788
diff changeset
   704
                fprintf(stderr, "Display %d: %s\n", i, SDL_GetDisplayName(i));
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   705
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   706
                SDL_zero(bounds);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   707
                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
   708
                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
   709
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   710
                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
   711
                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
   712
                                           &Bmask, &Amask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   713
                fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   714
                        "  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
   715
                        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
   716
                        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
   717
                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
   718
                    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
   719
                    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
   720
                    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
   721
                    if (Amask)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   722
                        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
   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
                /* 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
   726
                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
   727
                if (m == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   728
                    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
   729
                } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   730
                    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
   731
                    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
   732
                        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
   733
                        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
   734
                                                   &Gmask, &Bmask, &Amask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   735
                        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   736
                                "    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
   737
                                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
   738
                                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
   739
                        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
   740
                            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
   741
                                    Rmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   742
                            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
   743
                                    Gmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   744
                            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
   745
                                    Bmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   746
                            if (Amask)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   747
                                fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   748
                                        "        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
   749
                                        Amask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   750
                        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   751
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   752
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   753
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   754
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   755
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   756
        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
   757
            SDL_RendererInfo info;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   758
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   759
            n = SDL_GetNumRenderDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   760
            if (n == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   761
                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
   762
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   763
                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
   764
                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
   765
                    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
   766
                    SDLTest_PrintRenderer(&info);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   767
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   768
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   769
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   770
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   771
        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
   772
        switch (state->depth) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   773
        case 8:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   774
            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
   775
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   776
        case 15:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   777
            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
   778
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   779
        case 16:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   780
            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
   781
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   782
        case 24:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   783
            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
   784
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   785
        default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   786
            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
   787
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   788
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   789
        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
   790
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   791
        state->windows =
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   792
            (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
   793
                                        sizeof(*state->windows));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   794
        state->renderers =
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   795
            (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
   796
                                        sizeof(*state->renderers));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   797
        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
   798
            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
   799
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   800
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   801
        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
   802
            char title[1024];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   803
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   804
            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
   805
                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
   806
                             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
   807
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   808
                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
   809
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   810
            state->windows[i] =
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   811
                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
   812
                                 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
   813
                                 state->window_flags);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   814
            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
   815
                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
   816
                        SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   817
                return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   818
            }
6788
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   819
            if (state->window_minW || state->window_minH) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   820
                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
   821
            }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   822
            if (state->window_maxW || state->window_maxH) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   823
                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
   824
            }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   825
            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
   826
            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
   827
                (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
   828
                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
   829
                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
   830
                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
   831
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   832
            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
   833
                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
   834
                        SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   835
                return SDL_FALSE;
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 (state->window_icon) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   839
                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
   840
                if (icon) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   841
                    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
   842
                    SDL_FreeSurface(icon);
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
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   846
            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
   847
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   848
            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
   849
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   850
            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
   851
                && (state->renderdriver
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   852
                    || !(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
   853
                m = -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   854
                if (state->renderdriver) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   855
                    SDL_RendererInfo info;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   856
                    n = SDL_GetNumRenderDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   857
                    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
   858
                        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
   859
                        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
   860
                            0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   861
                            m = j;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   862
                            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   863
                        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   864
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   865
                    if (m == n) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   866
                        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   867
                                "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
   868
                                state->renderdriver);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   869
                        return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   870
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   871
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   872
                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
   873
                                            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
   874
                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
   875
                    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
   876
                            SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   877
                    return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   878
                }
7240
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   879
                if (state->logical_w && state->logical_h) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   880
                    SDL_RenderSetLogicalSize(state->renderers[i], state->logical_w, state->logical_h);
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   881
                } else if (state->scale) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   882
                    SDL_RenderSetScale(state->renderers[i], state->scale, state->scale);
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   883
                }
6727
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_RENDER) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   885
                    SDL_RendererInfo info;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   886
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   887
                    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
   888
                    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
   889
                    SDLTest_PrintRenderer(&info);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   890
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   891
            }
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
    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
   896
        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
   897
            n = SDL_GetNumAudioDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   898
            if (n == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   899
                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
   900
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   901
                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
   902
                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
   903
                    if (i > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   904
                        fprintf(stderr, ",");
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, " %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
   907
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   908
                fprintf(stderr, "\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   909
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   910
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   911
        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
   912
            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
   913
                    SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   914
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   915
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   916
        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
   917
            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
   918
                    SDL_GetCurrentAudioDriver());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   919
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   920
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   921
        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
   922
            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
   923
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   924
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   925
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   926
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   927
    return SDL_TRUE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   928
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   929
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   930
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   931
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
   932
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   933
    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
   934
        /* Mouse motion is really spammy */
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7141
diff changeset
   935
        return;
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   936
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   937
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   938
    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
   939
    switch (event->type) {
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:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   941
        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
   942
        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
   943
            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
   944
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   945
        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
   946
            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
   947
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   948
        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
   949
            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
   950
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   951
        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
   952
            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
   953
                    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
   954
                    event->window.data2);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   955
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   956
        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
   957
            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
   958
                    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
   959
                    event->window.data2);
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
        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
   962
            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
   963
                    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
   964
                    event->window.data2);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   965
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   966
        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
   967
            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
   968
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   969
        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
   970
            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
   971
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   972
        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
   973
            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
   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_WINDOWEVENT_ENTER:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   976
            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
   977
                    event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   978
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   979
        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
   980
            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
   981
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   982
        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
   983
            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
   984
                    event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   985
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   986
        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
   987
            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
   988
                    event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   989
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   990
        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
   991
            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
   992
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   993
        default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   994
            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
   995
                    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
   996
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   997
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   998
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   999
    case SDL_KEYDOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1000
        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1001
                "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
  1002
                event->key.windowID,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1003
                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
  1004
                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
  1005
                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
  1006
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1007
    case SDL_KEYUP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1008
        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1009
                "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
  1010
                event->key.windowID,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1011
                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
  1012
                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
  1013
                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
  1014
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1015
    case SDL_TEXTINPUT:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1016
        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
  1017
                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
  1018
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1019
    case SDL_MOUSEMOTION:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1020
        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
  1021
                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
  1022
                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
  1023
                event->motion.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1024
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1025
    case SDL_MOUSEBUTTONDOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1026
        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
  1027
                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
  1028
                event->button.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1029
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1030
    case SDL_MOUSEBUTTONUP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1031
        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
  1032
                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
  1033
                event->button.windowID);
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_MOUSEWHEEL:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1036
        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1037
                "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
  1038
                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
  1039
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1040
    case SDL_JOYBALLMOTION:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1041
        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
  1042
                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
  1043
                event->jball.yrel);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1044
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1045
    case SDL_JOYHATMOTION:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1046
        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
  1047
                event->jhat.hat);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1048
        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
  1049
        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
  1050
            fprintf(stderr, "CENTER");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1051
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1052
        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
  1053
            fprintf(stderr, "UP");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1054
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1055
        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
  1056
            fprintf(stderr, "RIGHTUP");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1057
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1058
        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
  1059
            fprintf(stderr, "RIGHT");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1060
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1061
        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
  1062
            fprintf(stderr, "RIGHTDOWN");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1063
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1064
        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
  1065
            fprintf(stderr, "DOWN");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1066
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1067
        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
  1068
            fprintf(stderr, "LEFTDOWN");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1069
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1070
        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
  1071
            fprintf(stderr, "LEFT");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1072
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1073