test/common.h
author Ryan C. Gordon <icculus@icculus.org>
Fri, 03 Jun 2011 16:03:10 -0400
changeset 5547 4ccecd0901e2
parent 5535 96594ac5fd1a
child 6256 1d905b13b102
permissions -rw-r--r--
Assert code's stdio interface was reading from the wrong variable.

Thanks to Frank Zago for the catch.
slouken@5535
     1
/*
slouken@5535
     2
  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
slouken@5535
     3
slouken@5535
     4
  This software is provided 'as-is', without any express or implied
slouken@5535
     5
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     6
  arising from the use of this software.
slouken@5535
     7
slouken@5535
     8
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
     9
  including commercial applications, and to alter it and redistribute it
slouken@5535
    10
  freely.
slouken@5535
    11
*/
slouken@1914
    12
slouken@1914
    13
/* A simple test program framework */
slouken@1914
    14
slouken@3560
    15
#define SDL_NO_COMPAT
slouken@1914
    16
#include "SDL.h"
slouken@1914
    17
slouken@5517
    18
#ifdef __NDS__
slouken@5517
    19
#define DEFAULT_WINDOW_WIDTH  256
slouken@5517
    20
#define DEFAULT_WINDOW_HEIGHT (2*192)
slouken@5517
    21
#else
lestat@3194
    22
#define DEFAULT_WINDOW_WIDTH  640
lestat@3194
    23
#define DEFAULT_WINDOW_HEIGHT 480
slouken@5517
    24
#endif
lestat@3194
    25
slouken@1914
    26
#define VERBOSE_VIDEO   0x00000001
slouken@1914
    27
#define VERBOSE_MODES   0x00000002
slouken@1914
    28
#define VERBOSE_RENDER  0x00000004
slouken@1914
    29
#define VERBOSE_EVENT   0x00000008
slouken@1914
    30
#define VERBOSE_AUDIO   0x00000010
slouken@1914
    31
slouken@1914
    32
typedef struct
slouken@1914
    33
{
slouken@1914
    34
    /* SDL init flags */
slouken@1914
    35
    char **argv;
slouken@1914
    36
    Uint32 flags;
slouken@1914
    37
    Uint32 verbose;
slouken@1914
    38
slouken@1914
    39
    /* Video info */
slouken@1914
    40
    const char *videodriver;
slouken@1914
    41
    int display;
slouken@1914
    42
    const char *window_title;
slouken@4527
    43
    const char *window_icon;
slouken@1914
    44
    Uint32 window_flags;
slouken@1914
    45
    int window_x;
slouken@1914
    46
    int window_y;
slouken@1914
    47
    int window_w;
slouken@1914
    48
    int window_h;
slouken@1914
    49
    int depth;
slouken@1914
    50
    int refresh_rate;
slouken@1914
    51
    int num_windows;
slouken@3685
    52
    SDL_Window **windows;
slouken@1914
    53
slouken@1914
    54
    /* Renderer info */
slouken@1914
    55
    const char *renderdriver;
slouken@1914
    56
    Uint32 render_flags;
slouken@1933
    57
    SDL_bool skip_renderer;
slouken@5147
    58
    SDL_Renderer **renderers;
slouken@1914
    59
slouken@1914
    60
    /* Audio info */
slouken@1914
    61
    const char *audiodriver;
slouken@1914
    62
    SDL_AudioSpec audiospec;
lestat@3408
    63
lestat@3408
    64
    /* GL settings */
lestat@3408
    65
    int gl_red_size;
lestat@3408
    66
    int gl_green_size;
lestat@3408
    67
    int gl_blue_size;
lestat@3408
    68
    int gl_alpha_size;
lestat@3408
    69
    int gl_buffer_size;
lestat@3408
    70
    int gl_depth_size;
lestat@3408
    71
    int gl_stencil_size;
lestat@3408
    72
    int gl_double_buffer;
lestat@3408
    73
    int gl_accum_red_size;
lestat@3408
    74
    int gl_accum_green_size;
lestat@3408
    75
    int gl_accum_blue_size;
lestat@3408
    76
    int gl_accum_alpha_size;
lestat@3408
    77
    int gl_stereo;
lestat@3408
    78
    int gl_multisamplebuffers;
lestat@3408
    79
    int gl_multisamplesamples;
lestat@3408
    80
    int gl_retained_backing;
lestat@3408
    81
    int gl_accelerated;
lestat@3408
    82
    int gl_major_version;
lestat@3408
    83
    int gl_minor_version;
slouken@1914
    84
} CommonState;
slouken@1914
    85
slouken@1914
    86
extern CommonState *CommonCreateState(char **argv, Uint32 flags);
slouken@1914
    87
extern int CommonArg(CommonState * state, int index);
slouken@1914
    88
extern const char *CommonUsage(CommonState * state);
slouken@1914
    89
extern SDL_bool CommonInit(CommonState * state);
slouken@1914
    90
extern void CommonEvent(CommonState * state, SDL_Event * event, int *done);
slouken@1914
    91
extern void CommonQuit(CommonState * state);
slouken@3514
    92
slouken@3514
    93
/* vi: set ts=4 sw=4 expandtab: */