Añadida tecla para activar/desactivar el borde
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
name=void main
|
||||
bgColor=black
|
||||
border=red
|
||||
border=yellow
|
||||
tileset=standard.png
|
||||
roomUp=0
|
||||
roomDown=0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name=case switch
|
||||
bgColor=black
|
||||
border=green
|
||||
border=cyan
|
||||
tileset=standard.png
|
||||
roomUp=0
|
||||
roomDown=04.room
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name=welcome to the jail
|
||||
bgColor=black
|
||||
border=black
|
||||
border=bright_magenta
|
||||
tileset=standard.png
|
||||
roomUp=0
|
||||
roomDown=0
|
||||
|
||||
@@ -102,6 +102,11 @@ void Game::checkEventHandler()
|
||||
board.music ? JA_ResumeMusic() : JA_PauseMusic();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_B:
|
||||
screen->switchBorder();
|
||||
reLoadTextures();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F:
|
||||
screen->switchVideoMode();
|
||||
reLoadTextures();
|
||||
|
||||
@@ -15,8 +15,6 @@ 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 = options->borderEnabled;
|
||||
borderSize = options->borderSize;
|
||||
|
||||
// Crea la textura donde se dibujan los graficos del juego
|
||||
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
|
||||
@@ -80,10 +78,10 @@ void Screen::setVideoMode(int fullScreenMode)
|
||||
// Si está activo el modo ventana quita el borde
|
||||
if (fullScreenMode == 0)
|
||||
{
|
||||
if (borderEnabled)
|
||||
if (options->borderEnabled)
|
||||
{
|
||||
const int incWidth = gameCanvasWidth * borderSize;
|
||||
const int incHeight = gameCanvasHeight * borderSize;
|
||||
const int incWidth = gameCanvasWidth * options->borderSize;
|
||||
const int incHeight = gameCanvasHeight * options->borderSize;
|
||||
screenWidth = gameCanvasWidth + incWidth;
|
||||
screenHeight = gameCanvasHeight + incHeight;
|
||||
dest = {0 + (incWidth / 2), 0 + (incHeight / 2), gameCanvasWidth, gameCanvasHeight};
|
||||
@@ -192,18 +190,18 @@ void Screen::setBlendMode(SDL_BlendMode blendMode)
|
||||
// Establece el tamaño del borde
|
||||
void Screen::setBorderSize(float s)
|
||||
{
|
||||
borderSize = s;
|
||||
options->borderSize = s;
|
||||
}
|
||||
|
||||
// Establece si se ha de ver el borde en el modo ventana
|
||||
void Screen::setBorderEnabled(bool value)
|
||||
{
|
||||
borderEnabled = value;
|
||||
options->borderEnabled = value;
|
||||
}
|
||||
|
||||
// Cambia entre borde visible y no visible
|
||||
void Screen::switchBorder()
|
||||
{
|
||||
borderEnabled = !borderEnabled;
|
||||
options->borderEnabled = !options->borderEnabled;
|
||||
setVideoMode(0);
|
||||
}
|
||||
@@ -32,8 +32,6 @@ private:
|
||||
anchor_t anchor; // Variable con los anclajes de la pantalla
|
||||
SDL_Rect dest; // Coordenadas donde se va a dibujar la textura del juego sobre la pantalla o ventana
|
||||
color_t borderColor; // Color del borde añadido a la textura de juego para rellenar la pantalla
|
||||
bool borderEnabled; // Indica si ha de mostrar el borde en el modo de ventana
|
||||
float borderSize; // Porcentaje de borde que se añade a lo ventana
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
|
||||
Reference in New Issue
Block a user