src/test/SDL_test_common.c
author Gabriel Jacobo <gabomdq@gmail.com>
Thu, 10 Oct 2013 00:49:57 -0300
changeset 7796 75c80f36038e
parent 7787 e6f3e8fc96ea
child 7828 1451063c8ecd
permissions -rw-r--r--
Adds gl_profile_mask to test framework, uses it in testgles
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 \
7746
6a05d7352575 add in High DPI support (aka Retina)
Edward Rudd <urkle@outoforder.cc>
parents: 7719
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] [--allow-hidpi]"
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
    }
7746
6a05d7352575 add in High DPI support (aka Retina)
Edward Rudd <urkle@outoforder.cc>
parents: 7719
diff changeset
   197
    if (SDL_strcasecmp(argv[index], "--allow-highdpi") == 0) {
6a05d7352575 add in High DPI support (aka Retina)
Edward Rudd <urkle@outoforder.cc>
parents: 7719
diff changeset
   198
        state->window_flags |= SDL_WINDOW_ALLOW_HIGHDPI;
6a05d7352575 add in High DPI support (aka Retina)
Edward Rudd <urkle@outoforder.cc>
parents: 7719
diff changeset
   199
        return 1;
6a05d7352575 add in High DPI support (aka Retina)
Edward Rudd <urkle@outoforder.cc>
parents: 7719
diff changeset
   200
    }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   201
    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
   202
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   203
        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
   204
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   205
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   206
        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
   207
            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
   208
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   209
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   210
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   211
    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
   212
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   213
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   214
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   215
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   216
        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
   217
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   218
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   219
    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
   220
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   221
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   222
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   223
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   224
        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
   225
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   226
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   227
    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
   228
        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
   229
        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
   230
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   231
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   232
    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
   233
        char *x, *y;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   234
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   235
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   236
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   237
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   238
        x = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   239
        y = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   240
        while (*y && *y != ',') {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   241
            ++y;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   242
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   243
        if (!*y) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   244
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   245
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   246
        *y++ = '\0';
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   247
        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
   248
        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
   249
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   250
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   251
    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
   252
        char *w, *h;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   253
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   254
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   255
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   256
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   257
        w = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   258
        h = argv[index];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   259
        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
   260
            ++h;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   261
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   262
        if (!*h) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   263
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   264
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   265
        *h++ = '\0';
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   266
        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
   267
        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
   268
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   269
    }
6788
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   270
    if (SDL_strcasecmp(argv[index], "--min-geometry") == 0) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   271
        char *w, *h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   272
        ++index;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   273
        if (!argv[index]) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   274
            return -1;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   275
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   276
        w = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   277
        h = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   278
        while (*h && *h != 'x') {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   279
            ++h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   280
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   281
        if (!*h) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   282
            return -1;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   283
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   284
        *h++ = '\0';
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   285
        state->window_minW = SDL_atoi(w);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   286
        state->window_minH = SDL_atoi(h);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   287
        return 2;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   288
    }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   289
    if (SDL_strcasecmp(argv[index], "--max-geometry") == 0) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   290
        char *w, *h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   291
        ++index;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   292
        if (!argv[index]) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   293
            return -1;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   294
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   295
        w = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   296
        h = argv[index];
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   297
        while (*h && *h != 'x') {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   298
            ++h;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   299
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   300
        if (!*h) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   301
            return -1;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   302
        }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   303
        *h++ = '\0';
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   304
        state->window_maxW = SDL_atoi(w);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   305
        state->window_maxH = SDL_atoi(h);
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   306
        return 2;
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   307
    }
7240
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   308
    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
   309
        char *w, *h;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   310
        ++index;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   311
        if (!argv[index]) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   312
            return -1;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   313
        }
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   314
        w = argv[index];
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   315
        h = argv[index];
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   316
        while (*h && *h != 'x') {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   317
            ++h;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   318
        }
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   319
        if (!*h) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   320
            return -1;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   321
        }
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   322
        *h++ = '\0';
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   323
        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
   324
        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
   325
        return 2;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   326
    }
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   327
    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
   328
        ++index;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   329
        if (!argv[index]) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   330
            return -1;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   331
        }
7249
606c8fcfef2f Fix bug 1492: Visual Studio builds sdl.lib and sdl.dll for version 2.0 (contributed by Jan Reitz); update SDL_bool handling in test_common to fix VS compiler warnings
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7240
diff changeset
   332
        state->scale = (float)SDL_atof(argv[index]);
7240
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   333
        return 2;
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   334
    }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   335
    if (SDL_strcasecmp(argv[index], "--depth") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   336
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   337
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   338
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   339
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   340
        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
   341
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   342
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   343
    if (SDL_strcasecmp(argv[index], "--refresh") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   344
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   345
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   346
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   347
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   348
        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
   349
        return 2;
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], "--vsync") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   352
        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
   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], "--noframe") == 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_BORDERLESS;
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], "--resize") == 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_RESIZABLE;
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], "--minimize") == 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_MINIMIZED;
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], "--maximize") == 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_MAXIMIZED;
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], "--grab") == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   372
        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
   373
        return 1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   374
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   375
    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
   376
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   377
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   378
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   379
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   380
        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
   381
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   382
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   383
    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
   384
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   385
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   386
            return -1;
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], "U8") == 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_U8;
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], "S8") == 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_S8;
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], "U16") == 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_U16;
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], "U16LE") == 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_U16LSB;
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], "U16BE") == 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_U16MSB;
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], "S16") == 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_S16;
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], "S16LE") == 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_S16LSB;
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
        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
   417
            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
   418
            return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   419
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   420
        return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   421
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   422
    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
   423
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   424
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   425
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   426
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   427
        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
   428
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   429
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   430
    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
   431
        ++index;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   432
        if (!argv[index]) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   433
            return -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   434
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   435
        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
   436
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   437
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   438
    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
   439
        || (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
   440
        /* 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
   441
        return -1;
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
    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
   444
    /* 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
   445
        return 2;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   446
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   447
    return 0;
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
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   450
const char *
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   451
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
   452
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   453
    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
   454
    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
   455
        return VIDEO_USAGE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   456
    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
   457
        return AUDIO_USAGE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   458
    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
   459
        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
   460
    default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   461
        return "";
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   462
    }
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
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   465
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   466
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
   467
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   468
    switch (flag) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   469
    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
   470
        fprintf(stderr, "PresentVSync");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   471
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   472
    case SDL_RENDERER_ACCELERATED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   473
        fprintf(stderr, "Accelerated");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   474
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   475
    default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   476
        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
   477
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   478
    }
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
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   481
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   482
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
   483
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   484
    switch (format) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   485
    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
   486
        fprintf(stderr, "Unknwon");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   487
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   488
    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
   489
        fprintf(stderr, "Index1LSB");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   490
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   491
    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
   492
        fprintf(stderr, "Index1MSB");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   493
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   494
    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
   495
        fprintf(stderr, "Index4LSB");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   496
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   497
    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
   498
        fprintf(stderr, "Index4MSB");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   499
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   500
    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
   501
        fprintf(stderr, "Index8");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   502
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   503
    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
   504
        fprintf(stderr, "RGB332");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   505
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   506
    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
   507
        fprintf(stderr, "RGB444");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   508
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   509
    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
   510
        fprintf(stderr, "RGB555");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   511
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   512
    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
   513
        fprintf(stderr, "BGR555");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   514
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   515
    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
   516
        fprintf(stderr, "ARGB4444");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   517
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   518
    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
   519
        fprintf(stderr, "ABGR4444");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   520
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   521
    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
   522
        fprintf(stderr, "ARGB1555");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   523
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   524
    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
   525
        fprintf(stderr, "ABGR1555");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   526
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   527
    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
   528
        fprintf(stderr, "RGB565");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   529
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   530
    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
   531
        fprintf(stderr, "BGR565");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   532
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   533
    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
   534
        fprintf(stderr, "RGB24");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   535
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   536
    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
   537
        fprintf(stderr, "BGR24");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   538
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   539
    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
   540
        fprintf(stderr, "RGB888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   541
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   542
    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
   543
        fprintf(stderr, "BGR888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   544
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   545
    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
   546
        fprintf(stderr, "ARGB8888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   547
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   548
    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
   549
        fprintf(stderr, "RGBA8888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   550
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   551
    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
   552
        fprintf(stderr, "ABGR8888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   553
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   554
    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
   555
        fprintf(stderr, "BGRA8888");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   556
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   557
    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
   558
        fprintf(stderr, "ARGB2101010");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   559
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   560
    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
   561
        fprintf(stderr, "YV12");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   562
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   563
    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
   564
        fprintf(stderr, "IYUV");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   565
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   566
    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
   567
        fprintf(stderr, "YUY2");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   568
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   569
    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
   570
        fprintf(stderr, "UYVY");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   571
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   572
    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
   573
        fprintf(stderr, "YVYU");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   574
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   575
    default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   576
        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
   577
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   578
    }
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
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   581
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   582
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
   583
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   584
    int i, count;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   585
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   586
    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
   587
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   588
    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
   589
    fprintf(stderr, " (");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   590
    count = 0;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   591
    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
   592
        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
   593
        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
   594
            if (count > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   595
                fprintf(stderr, " | ");
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
            SDLTest_PrintRendererFlag(flag);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   598
            ++count;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   599
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   600
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   601
    fprintf(stderr, ")\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   602
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   603
    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
   604
    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
   605
        if (i > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   606
            fprintf(stderr, ", ");
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
        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
   609
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   610
    fprintf(stderr, "\n");
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
    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
   613
        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
   614
                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
   615
    }
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
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   618
static SDL_Surface *
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   619
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
   620
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   621
    SDL_Surface *icon;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   622
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   623
    /* 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
   624
    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
   625
    if (icon == NULL) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   626
        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
   627
        return (NULL);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   628
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   629
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   630
    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
   631
        /* Set the colorkey */
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   632
        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
   633
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   634
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   635
    return (icon);
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
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   638
SDL_bool
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   639
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
   640
{
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   641
    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
   642
    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
   643
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   644
    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
   645
        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
   646
            n = SDL_GetNumVideoDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   647
            if (n == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   648
                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
   649
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   650
                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
   651
                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
   652
                    if (i > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   653
                        fprintf(stderr, ",");
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
                    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
   656
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   657
                fprintf(stderr, "\n");
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   658
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   659
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   660
        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
   661
            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
   662
                    SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   663
            return SDL_FALSE;
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
        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
   666
            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
   667
                    SDL_GetCurrentVideoDriver());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   668
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   669
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   670
        /* Upload GL settings */
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_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
   672
        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
   673
        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
   674
        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
   675
        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
   676
        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
   677
        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
   678
        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
   679
        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
   680
        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
   681
        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
   682
        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
   683
        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
   684
        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
   685
        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
   686
        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
   687
            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
   688
                                state->gl_accelerated);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   689
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   690
        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
   691
        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
   692
            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
   693
            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
   694
        }
7194
987fb567bba9 Fixed bug 1837 - Use error extension instead of glGetError()
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   695
        if (state->gl_debug) {
987fb567bba9 Fixed bug 1837 - Use error extension instead of glGetError()
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   696
            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
   697
        }
7796
75c80f36038e Adds gl_profile_mask to test framework, uses it in testgles
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7787
diff changeset
   698
        if (state->gl_profile_mask) {
75c80f36038e Adds gl_profile_mask to test framework, uses it in testgles
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7787
diff changeset
   699
            SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, state->gl_profile_mask);
75c80f36038e Adds gl_profile_mask to test framework, uses it in testgles
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7787
diff changeset
   700
        }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   701
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   702
        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
   703
            SDL_Rect bounds;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   704
            SDL_DisplayMode mode;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   705
            int bpp;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   706
            Uint32 Rmask, Gmask, Bmask, Amask;
7756
f45660a4974c Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Sam Lantinga <slouken@libsdl.org>
parents: 7746
diff changeset
   707
#if SDL_VIDEO_DRIVER_WINDOWS
f45660a4974c Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Sam Lantinga <slouken@libsdl.org>
parents: 7746
diff changeset
   708
			int adapterIndex = 0;
f45660a4974c Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Sam Lantinga <slouken@libsdl.org>
parents: 7746
diff changeset
   709
#endif
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   710
            n = SDL_GetNumVideoDisplays();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   711
            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
   712
            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
   713
                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
   714
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   715
                SDL_zero(bounds);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   716
                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
   717
                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
   718
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   719
                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
   720
                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
   721
                                           &Bmask, &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,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   723
                        "  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
   724
                        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
   725
                        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
   726
                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
   727
                    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
   728
                    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
   729
                    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
   730
                    if (Amask)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   731
                        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
   732
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   733
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   734
                /* 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
   735
                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
   736
                if (m == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   737
                    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
   738
                } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   739
                    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
   740
                    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
   741
                        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
   742
                        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
   743
                                                   &Gmask, &Bmask, &Amask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   744
                        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   745
                                "    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
   746
                                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
   747
                                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
   748
                        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
   749
                            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
   750
                                    Rmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   751
                            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
   752
                                    Gmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   753
                            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
   754
                                    Bmask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   755
                            if (Amask)
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   756
                                fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   757
                                        "        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
   758
                                        Amask);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   759
                        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   760
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   761
                }
7756
f45660a4974c Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Sam Lantinga <slouken@libsdl.org>
parents: 7746
diff changeset
   762
f45660a4974c Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Sam Lantinga <slouken@libsdl.org>
parents: 7746
diff changeset
   763
#if SDL_VIDEO_DRIVER_WINDOWS
f45660a4974c Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Sam Lantinga <slouken@libsdl.org>
parents: 7746
diff changeset
   764
				/* Print the adapter index */
f45660a4974c Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Sam Lantinga <slouken@libsdl.org>
parents: 7746
diff changeset
   765
				adapterIndex = SDL_Direct3D9GetAdapterIndex( i );
f45660a4974c Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Sam Lantinga <slouken@libsdl.org>
parents: 7746
diff changeset
   766
				fprintf( stderr, "Adapter Index: %d", adapterIndex );
f45660a4974c Moved D3D_LoadDLL and SDL_Direct3D9GetAdapterIndex to SDL_windowswindow.c at Jorgen's insistence. That file is wrapped in a more appropriate define check so it will work if somebody builds a binary without D3D support.
Sam Lantinga <slouken@libsdl.org>
parents: 7746
diff changeset
   767
#endif
6727
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
        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
   772
            SDL_RendererInfo info;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   773
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   774
            n = SDL_GetNumRenderDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   775
            if (n == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   776
                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
   777
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   778
                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
   779
                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
   780
                    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
   781
                    SDLTest_PrintRenderer(&info);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   782
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   783
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   784
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   785
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   786
        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
   787
        switch (state->depth) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   788
        case 8:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   789
            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
   790
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   791
        case 15:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   792
            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
   793
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   794
        case 16:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   795
            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
   796
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   797
        case 24:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   798
            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
   799
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   800
        default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   801
            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
   802
            break;
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
        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
   805
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   806
        state->windows =
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   807
            (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
   808
                                        sizeof(*state->windows));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   809
        state->renderers =
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   810
            (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
   811
                                        sizeof(*state->renderers));
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   812
        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
   813
            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
   814
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   815
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   816
        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
   817
            char title[1024];
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   818
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   819
            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
   820
                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
   821
                             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
   822
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   823
                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
   824
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   825
            state->windows[i] =
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   826
                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
   827
                                 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
   828
                                 state->window_flags);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   829
            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
   830
                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
   831
                        SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   832
                return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   833
            }
6788
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   834
            if (state->window_minW || state->window_minH) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   835
                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
   836
            }
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   837
            if (state->window_maxW || state->window_maxH) {
036f53f2f5aa Added SDL_SetWindowMaximumSize() and SDL_GetWindowMaximumSize()
Sam Lantinga <slouken@libsdl.org>
parents: 6783
diff changeset
   838
                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
   839
            }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   840
            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
   841
            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
   842
                (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
   843
                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
   844
                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
   845
                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
   846
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   847
            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
   848
                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
   849
                        SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   850
                return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   851
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   852
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   853
            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
   854
                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
   855
                if (icon) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   856
                    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
   857
                    SDL_FreeSurface(icon);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   858
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   859
            }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   860
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   861
            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
   862
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   863
            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
   864
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   865
            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
   866
                && (state->renderdriver
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   867
                    || !(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
   868
                m = -1;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   869
                if (state->renderdriver) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   870
                    SDL_RendererInfo info;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   871
                    n = SDL_GetNumRenderDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   872
                    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
   873
                        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
   874
                        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
   875
                            0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   876
                            m = j;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   877
                            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   878
                        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   879
                    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   880
                    if (m == n) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   881
                        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   882
                                "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
   883
                                state->renderdriver);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   884
                        return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   885
                    }
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
                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
   888
                                            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
   889
                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
   890
                    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
   891
                            SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   892
                    return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   893
                }
7240
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   894
                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
   895
                    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
   896
                } else if (state->scale) {
39eb4958950a When the window is resized, the viewport is automatically reset.
Sam Lantinga <slouken@libsdl.org>
parents: 7194
diff changeset
   897
                    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
   898
                }
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   899
                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
   900
                    SDL_RendererInfo info;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   901
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   902
                    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
   903
                    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
   904
                    SDLTest_PrintRenderer(&info);
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
            }
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
    }
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
    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
   911
        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
   912
            n = SDL_GetNumAudioDrivers();
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   913
            if (n == 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   914
                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
   915
            } else {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   916
                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
   917
                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
   918
                    if (i > 0) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   919
                        fprintf(stderr, ",");
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
                    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
   922
                }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   923
                fprintf(stderr, "\n");
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
        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
   927
            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
   928
                    SDL_GetError());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   929
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   930
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   931
        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
   932
            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
   933
                    SDL_GetCurrentAudioDriver());
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   934
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   935
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   936
        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
   937
            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
   938
            return SDL_FALSE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   939
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   940
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   941
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   942
    return SDL_TRUE;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   943
}
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   944
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   945
static void
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   946
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
   947
{
7470
e2c81eca0326 Added finger events to SDLTest_PrintEvent().
Ryan C. Gordon <icculus@icculus.org>
parents: 7340
diff changeset
   948
    if ((event->type == SDL_MOUSEMOTION) || (event->type == SDL_FINGERMOTION)) {
e2c81eca0326 Added finger events to SDLTest_PrintEvent().
Ryan C. Gordon <icculus@icculus.org>
parents: 7340
diff changeset
   949
        /* Mouse and finger motion are really spammy */
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7141
diff changeset
   950
        return;
6727
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   951
    }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   952
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   953
    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
   954
    switch (event->type) {
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   955
    case SDL_WINDOWEVENT:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   956
        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
   957
        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
   958
            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
   959
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   960
        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
   961
            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
   962
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   963
        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
   964
            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
   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_MOVED:
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 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
   968
                    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
   969
                    event->window.data2);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   970
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   971
        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
   972
            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
   973
                    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
   974
                    event->window.data2);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   975
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   976
        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
   977
            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
   978
                    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
   979
                    event->window.data2);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   980
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   981
        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
   982
            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
   983
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   984
        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
   985
            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
   986
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   987
        case SDL_WINDOWEVENT_RESTORED:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   988
            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
   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_ENTER:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   991
            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
   992
                    event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   993
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   994
        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
   995
            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
   996
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
   997
        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
   998
            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
   999
                    event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1000
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1001
        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
  1002
            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
  1003
                    event->window.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1004
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1005
        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
  1006
            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
  1007
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1008
        default:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1009
            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
  1010
                    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
  1011
            break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1012
        }
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1013
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1014
    case SDL_KEYDOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1015
        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1016
                "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
  1017
                event->key.windowID,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1018
                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
  1019
                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
  1020
                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
  1021
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1022
    case SDL_KEYUP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1023
        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1024
                "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
  1025
                event->key.windowID,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1026
                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
  1027
                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
  1028
                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
  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_TEXTINPUT:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1031
        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
  1032
                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
  1033
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1034
    case SDL_MOUSEMOTION:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1035
        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
  1036
                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
  1037
                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
  1038
                event->motion.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_MOUSEBUTTONDOWN:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1041
        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
  1042
                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
  1043
                event->button.windowID);
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_MOUSEBUTTONUP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1046
        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
  1047
                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
  1048
                event->button.windowID);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1049
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1050
    case SDL_MOUSEWHEEL:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1051
        fprintf(stderr,
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1052
                "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
  1053
                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
  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_JOYBALLMOTION:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1056
        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
  1057
                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
  1058
                event->jball.yrel);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1059
        break;
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1060
    case SDL_JOYHATMOTION:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1061
        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
  1062
                event->jhat.hat);
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1063
        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
  1064
        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
  1065
            fprintf(stderr, "CENTER");
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_UP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff changeset
  1068
            fprintf(stderr, "UP");
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_RIGHTUP:
1b5280cd5885 Added existing common.c/.h functions to test lib; minor assert refactoring
Andreas Schiffler <aschiffler@fe&