1 #ifndef __R_STATE_H
2 #define __R_STATE_H
3 
4 /*
5 Copyright 2011 Jared Krinke.
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 THE SOFTWARE.
24 */
25 
26 #include <lua.h>
27 #include <setjmp.h>
28 
29 #include "r_defs.h"
30 #include "r_transform2d.h"
31 
32 /* Stores the state of the Radius Engine */
33 typedef struct _r_state
34 {
35     /* Arguments */
36     const char                      *argv0;
37 
38     /* Exit the application if this is R_TRUE */
39     r_boolean_t                     done;
40 
41     /* Log file */
42     void                            *log_file;
43 
44     /* Video parameters */
45     r_boolean_t                     video_mode_set;
46     const char                      *default_font_path;
47     int                             video_width;
48     int                             video_height;
49     r_boolean_t                     video_full_featured;
50     unsigned int                    min_texture_size;
51     unsigned int                    max_texture_size;
52     r_transform2d_t                 pixels_to_coordinates;
53 
54     /* Audio state (note: audio lock must be held when manipulating audio state) */
55     void                            *audio;
56     unsigned char                   audio_volume;
57     unsigned char                   audio_music_volume;
58     void                            *audio_decoder;
59 
60     /* Capture state */
61     void                            *capture;
62 
63     /* Script state */
64     lua_State                       *script_state;
65     jmp_buf                         script_error_return_point;
66 
67     /* Event state */
68     void                            *event_state;
69 } r_state_t;
70 
71 extern r_status_t r_state_init(r_state_t *rs, const char *argv0);
72 extern r_status_t r_state_cleanup(r_state_t *rs);
73 
74 #endif
75 
76