Eliminado todo el código para añadir un borde a la zona de juego. Eran restos del código del JDD

This commit is contained in:
2024-08-27 23:04:59 +02:00
parent 60cfc1e4d9
commit 50b1acfe8b
4 changed files with 9 additions and 91 deletions

View File

@@ -22,8 +22,6 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *
SDL_GetRendererOutputSize(renderer, &windowWidth, &windowHeight);
gameCanvasWidth = options->video.gameWidth;
gameCanvasHeight = options->video.gameHeight;
borderWidth = options->video.border.width * 2;
borderHeight = options->video.border.height * 2;
dest = {0, 0, 0, 0};
borderColor = {0, 0, 0};
flashEffect.enabled = false;
@@ -40,7 +38,11 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *
fpsTicks = 0;
fpsCounter = 0;
fps = 0;
#ifdef DEBUG
showFps = true;
#else
showFps = false;
#endif
// Crea los objetos
notify = new Notify(renderer, asset->get("notify.png"), asset->get("8bithud.png"), asset->get("8bithud.txt"), asset->get("notify.wav"), options);
@@ -92,7 +94,7 @@ void Screen::blit()
// Actualiza el contador de FPS
fpsCounter++;
// Pinta en pantalla el contador de FPS
if (showFps)
{
@@ -147,19 +149,9 @@ void Screen::setVideoMode(int videoMode)
// Muestra el puntero
SDL_ShowCursor(SDL_ENABLE);
if (options->video.border.enabled)
{
windowWidth = gameCanvasWidth + borderWidth;
windowHeight = gameCanvasHeight + borderHeight;
dest = {0 + (borderWidth / 2), 0 + (borderHeight / 2), gameCanvasWidth, gameCanvasHeight};
}
else
{
windowWidth = gameCanvasWidth;
windowHeight = gameCanvasHeight;
dest = {0, 0, gameCanvasWidth, gameCanvasHeight};
}
windowWidth = gameCanvasWidth;
windowHeight = gameCanvasHeight;
dest = {0, 0, gameCanvasWidth, gameCanvasHeight};
// Modifica el tamaño de la ventana
SDL_SetWindowSize(window, windowWidth * options->video.window.size, windowHeight * options->video.window.size);
@@ -291,31 +283,6 @@ void Screen::setBlendMode(SDL_BlendMode blendMode)
SDL_SetRenderDrawBlendMode(renderer, blendMode);
}
// Establece el tamaño del borde
void Screen::setBorderWidth(int s)
{
options->video.border.width = s;
}
// Establece el tamaño del borde
void Screen::setBorderHeight(int s)
{
options->video.border.height = s;
}
// Establece si se ha de ver el borde en el modo ventana
void Screen::setBorderEnabled(bool value)
{
options->video.border.enabled = value;
}
// Cambia entre borde visible y no visible
void Screen::switchBorder()
{
options->video.border.enabled = !options->video.border.enabled;
setVideoMode(SCREEN_VIDEO_MODE_WINDOW);
}
// Actualiza la lógica de la clase
void Screen::update()
{

View File

@@ -31,8 +31,6 @@ private:
int windowHeight; // Alto de la pantalla o ventana
int gameCanvasWidth; // Resolución interna del juego. Es el ancho de la textura donde se dibuja el juego
int gameCanvasHeight; // Resolución interna del juego. Es el alto de la textura donde se dibuja el juego
int borderWidth; // Anchura del borde
int borderHeight; // Anltura del borde
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 attenuateEffect; // Indica si la pantalla ha de estar atenuada
@@ -117,16 +115,6 @@ public:
// Cambia el tipo de mezcla
void setBlendMode(SDL_BlendMode blendMode);
// Establece el tamaño del borde
void setBorderWidth(int s);
void setBorderHeight(int s);
// Establece si se ha de ver el borde en el modo ventana
void setBorderEnabled(bool value);
// Cambia entre borde visible y no visible
void switchBorder();
// Agita la pantalla
void shake();

View File

@@ -87,14 +87,6 @@ struct demoKeys_t
Uint8 fireRight;
};
// Estructura con las opciones para el borde
struct op_border_t
{
bool enabled; // Indica si ha de mostrar el borde en el modo de ventana
int width; // Cantidad de pixels que se añade en el borde de la ventana
int height; // Cantidad de pixels que se añade en el borde de la ventana
};
// Estructura para las opciones de la ventana
struct op_window_t
{
@@ -114,7 +106,6 @@ struct op_video_t
bool vSync; // Indica si se quiere usar vsync o no
bool integerScale; // Indica si el escalado de la imagen ha de ser entero en el modo a pantalla completa
bool keepAspect; // Indica si se ha de mantener la relación de aspecto al poner el modo a pantalla completa
op_border_t border; // Opciones para el borde la pantalla de juego
bool shaders; // Indica si se van a usar shaders para los filtros de video
};