Mercurial > repos > blastem
comparison render_sdl.c @ 914:28ec32e720b2
Scale mouse data based on window size
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 14 Dec 2015 19:36:01 -0800 |
parents | b5d35222047e |
children | 9e882eca717e |
comparison
equal
deleted
inserted
replaced
913:a5a51465f8b0 | 914:28ec32e720b2 |
---|---|
20 SDL_Renderer *main_renderer; | 20 SDL_Renderer *main_renderer; |
21 SDL_Texture *main_texture; | 21 SDL_Texture *main_texture; |
22 SDL_Rect main_clip; | 22 SDL_Rect main_clip; |
23 SDL_GLContext *main_context; | 23 SDL_GLContext *main_context; |
24 | 24 |
25 int main_width, main_height; | |
26 | |
25 uint8_t render_dbg = 0; | 27 uint8_t render_dbg = 0; |
26 uint8_t debug_pal = 0; | 28 uint8_t debug_pal = 0; |
27 uint8_t render_gl = 1; | 29 uint8_t render_gl = 1; |
28 | 30 |
29 uint32_t last_frame = 0; | 31 uint32_t last_frame = 0; |
92 int num_joysticks; | 94 int num_joysticks; |
93 | 95 |
94 int render_num_joysticks() | 96 int render_num_joysticks() |
95 { | 97 { |
96 return num_joysticks; | 98 return num_joysticks; |
99 } | |
100 | |
101 int render_width() | |
102 { | |
103 return main_width; | |
104 } | |
105 | |
106 int render_height() | |
107 { | |
108 return main_height; | |
97 } | 109 } |
98 | 110 |
99 uint32_t render_map_color(uint8_t r, uint8_t g, uint8_t b) | 111 uint32_t render_map_color(uint8_t r, uint8_t g, uint8_t b) |
100 { | 112 { |
101 return 255 << 24 | r << 16 | g << 8 | b; | 113 return 255 << 24 | r << 16 | g << 8 | b; |
249 //the SDL2 migration guide suggests setting width and height to 0 when using SDL_WINDOW_FULLSCREEN_DESKTOP | 261 //the SDL2 migration guide suggests setting width and height to 0 when using SDL_WINDOW_FULLSCREEN_DESKTOP |
250 //but that doesn't seem to work right when using OpenGL, at least on Linux anyway | 262 //but that doesn't seem to work right when using OpenGL, at least on Linux anyway |
251 width = mode.w; | 263 width = mode.w; |
252 height = mode.h; | 264 height = mode.h; |
253 } | 265 } |
266 main_width = width; | |
267 main_height = height; | |
254 | 268 |
255 render_gl = 0; | 269 render_gl = 0; |
256 | 270 |
257 #ifndef DISABLE_OPENGL | 271 #ifndef DISABLE_OPENGL |
258 flags |= SDL_WINDOW_OPENGL; | 272 flags |= SDL_WINDOW_OPENGL; |