test/common.h
author Andreas Schiffler <aschiffler@ferzkopp.net>
Wed, 26 Dec 2012 22:26:44 -0800
changeset 6773 5ebc5a9e35b4
parent 6256 1d905b13b102
permissions -rw-r--r--
Add surface test suite; minor improvements to render suite; refactor image saving into test lib compare function; fix for Haiku build
     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 #include "SDL.h"
    16 
    17 #ifdef __NDS__
    18 #define DEFAULT_WINDOW_WIDTH  256
    19 #define DEFAULT_WINDOW_HEIGHT (2*192)
    20 #else
    21 #define DEFAULT_WINDOW_WIDTH  640
    22 #define DEFAULT_WINDOW_HEIGHT 480
    23 #endif
    24 
    25 #define VERBOSE_VIDEO   0x00000001
    26 #define VERBOSE_MODES   0x00000002
    27 #define VERBOSE_RENDER  0x00000004
    28 #define VERBOSE_EVENT   0x00000008
    29 #define VERBOSE_AUDIO   0x00000010
    30 
    31 typedef struct
    32 {
    33     /* SDL init flags */
    34     char **argv;
    35     Uint32 flags;
    36     Uint32 verbose;
    37 
    38     /* Video info */
    39     const char *videodriver;
    40     int display;
    41     const char *window_title;
    42     const char *window_icon;
    43     Uint32 window_flags;
    44     int window_x;
    45     int window_y;
    46     int window_w;
    47     int window_h;
    48     int depth;
    49     int refresh_rate;
    50     int num_windows;
    51     SDL_Window **windows;
    52 
    53     /* Renderer info */
    54     const char *renderdriver;
    55     Uint32 render_flags;
    56     SDL_bool skip_renderer;
    57     SDL_Renderer **renderers;
    58 
    59     /* Audio info */
    60     const char *audiodriver;
    61     SDL_AudioSpec audiospec;
    62 
    63     /* GL settings */
    64     int gl_red_size;
    65     int gl_green_size;
    66     int gl_blue_size;
    67     int gl_alpha_size;
    68     int gl_buffer_size;
    69     int gl_depth_size;
    70     int gl_stencil_size;
    71     int gl_double_buffer;
    72     int gl_accum_red_size;
    73     int gl_accum_green_size;
    74     int gl_accum_blue_size;
    75     int gl_accum_alpha_size;
    76     int gl_stereo;
    77     int gl_multisamplebuffers;
    78     int gl_multisamplesamples;
    79     int gl_retained_backing;
    80     int gl_accelerated;
    81     int gl_major_version;
    82     int gl_minor_version;
    83 } CommonState;
    84 
    85 extern CommonState *CommonCreateState(char **argv, Uint32 flags);
    86 extern int CommonArg(CommonState * state, int index);
    87 extern const char *CommonUsage(CommonState * state);
    88 extern SDL_bool CommonInit(CommonState * state);
    89 extern void CommonEvent(CommonState * state, SDL_Event * event, int *done);
    90 extern void CommonQuit(CommonState * state);
    91 
    92 /* vi: set ts=4 sw=4 expandtab: */