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