- punter del mouse amagat soles
- canvas de wasm mes gran
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include <algorithm> // for max, min
|
||||
#include <iostream> // for basic_ostream, operator<<, cout, endl
|
||||
#include <string> // for basic_string, char_traits, string
|
||||
|
||||
#include "mouse.hpp" // for Mouse::cursorVisible, Mouse::lastMouseMoveTime
|
||||
class Asset;
|
||||
|
||||
// Constructor
|
||||
@@ -86,8 +88,10 @@ void Screen::setVideoMode(int videoMode) {
|
||||
|
||||
// Si está activo el modo ventana quita el borde
|
||||
if (videoMode == 0) {
|
||||
// Muestra el puntero
|
||||
// Muestra el puntero y reinicia el temporizador de inactividad
|
||||
SDL_ShowCursor();
|
||||
Mouse::cursorVisible = true;
|
||||
Mouse::lastMouseMoveTime = SDL_GetTicks();
|
||||
|
||||
// Esconde la ventana
|
||||
// SDL_HideWindow(window);
|
||||
@@ -104,6 +108,17 @@ void Screen::setVideoMode(int videoMode) {
|
||||
dest = {0, 0, gameCanvasWidth, gameCanvasHeight};
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
// En WASM el tamaño de ventana está fijado a 1x, así que
|
||||
// escalamos el renderizado por 3 aprovechando el modo NEAREST
|
||||
// de la textura del juego para que los píxeles salgan nítidos.
|
||||
constexpr int WASM_RENDER_SCALE = 3;
|
||||
windowWidth *= WASM_RENDER_SCALE;
|
||||
windowHeight *= WASM_RENDER_SCALE;
|
||||
dest.w *= WASM_RENDER_SCALE;
|
||||
dest.h *= WASM_RENDER_SCALE;
|
||||
#endif
|
||||
|
||||
// Modifica el tamaño de la ventana
|
||||
SDL_SetWindowSize(window, windowWidth * options->windowSize, windowHeight * options->windowSize);
|
||||
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
||||
@@ -116,6 +131,7 @@ void Screen::setVideoMode(int videoMode) {
|
||||
else if (videoMode == SDL_WINDOW_FULLSCREEN) {
|
||||
// Oculta el puntero
|
||||
SDL_HideCursor();
|
||||
Mouse::cursorVisible = false;
|
||||
|
||||
// Obten el alto y el ancho de la ventana
|
||||
SDL_GetWindowSize(window, &windowWidth, &windowHeight);
|
||||
|
||||
Reference in New Issue
Block a user