- [FIX] El ratolí ja va correctament en pantalla completa.
- [FIX] Els shaders ja van correctament a pantalla completa.
This commit is contained in:
@@ -28,6 +28,8 @@ namespace draw
|
||||
static int desktop_height;
|
||||
static int window_width;
|
||||
static int window_height;
|
||||
static int offset_x = 0;
|
||||
static int offset_y = 0;
|
||||
char window_title[256];
|
||||
|
||||
surface *screen {nullptr}; // La superficie screen, que representa la pantalla. Se crea i destrueix internament
|
||||
@@ -64,9 +66,21 @@ namespace draw
|
||||
window_width = canvas_width*screen_zoom;
|
||||
window_height = window_ratio != 1 ? int(float(canvas_width)*window_ratio*float(screen_zoom)) : canvas_height*screen_zoom;
|
||||
}
|
||||
|
||||
if (screen_fullscreen) {
|
||||
window_width = desktop_width;
|
||||
window_height = desktop_height;
|
||||
if (desktop_width * window_ratio > desktop_height) {
|
||||
offset_y = 0;
|
||||
window_height = desktop_height;
|
||||
window_width = desktop_height/window_ratio;
|
||||
offset_x = (desktop_width - window_width)/2;
|
||||
} else {
|
||||
offset_x = 0;
|
||||
window_width = desktop_width;
|
||||
window_height = desktop_width*window_ratio;
|
||||
offset_y = (desktop_height - window_height)/2;
|
||||
}
|
||||
} else {
|
||||
offset_x = offset_y = 0;
|
||||
}
|
||||
|
||||
sdl_window = SDL_CreateWindow(window_title, window_width, window_height, SDL_WINDOW_OPENGL|(screen_fullscreen?SDL_WINDOW_FULLSCREEN:0));
|
||||
@@ -200,6 +214,16 @@ namespace draw
|
||||
return float(window_height) / float(canvas_height);
|
||||
}
|
||||
|
||||
const int getOffsetX()
|
||||
{
|
||||
return offset_x;
|
||||
}
|
||||
|
||||
const int getOffsetY()
|
||||
{
|
||||
return offset_y;
|
||||
}
|
||||
|
||||
bool getFullscreen() {
|
||||
return screen_fullscreen;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user