Trabajando en el fichero de configuración

This commit is contained in:
2022-09-12 14:07:59 +02:00
parent 561f957bca
commit c5aa28d738
8 changed files with 275 additions and 25 deletions

View File

@@ -15,9 +15,8 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, i
// Define el color del borde para el modo de pantalla completa
borderColor = {0x00, 0x00, 0x00};
borderEnabled = true;
borderWidth = 0.1f;
borderHeight = 0.1f;
borderEnabled = false;
borderSize = 0.1f;
// Crea la textura donde se dibujan los graficos del juego
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
@@ -83,8 +82,8 @@ void Screen::setVideoMode(int fullScreenMode)
{
if (borderEnabled)
{
const int incWidth = gameCanvasWidth * borderWidth;
const int incHeight = gameCanvasHeight * borderHeight;
const int incWidth = gameCanvasWidth * borderSize;
const int incHeight = gameCanvasHeight * borderSize;
screenWidth = gameCanvasWidth + incWidth;
screenHeight = gameCanvasHeight + incHeight;
dest = {0 + (incWidth / 2), 0 + (incHeight / 2), gameCanvasWidth, gameCanvasHeight};
@@ -189,10 +188,9 @@ void Screen::setBlendMode(SDL_BlendMode blendMode)
}
// Establece el tamaño del borde
void Screen::setBorderSize(float w, float h)
void Screen::setBorderSize(float s)
{
borderWidth = w;
borderHeight = h;
borderSize = s;
}
// Establece si se ha de ver el borde en el modo ventana