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:
@@ -22,8 +22,6 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *
|
|||||||
SDL_GetRendererOutputSize(renderer, &windowWidth, &windowHeight);
|
SDL_GetRendererOutputSize(renderer, &windowWidth, &windowHeight);
|
||||||
gameCanvasWidth = options->video.gameWidth;
|
gameCanvasWidth = options->video.gameWidth;
|
||||||
gameCanvasHeight = options->video.gameHeight;
|
gameCanvasHeight = options->video.gameHeight;
|
||||||
borderWidth = options->video.border.width * 2;
|
|
||||||
borderHeight = options->video.border.height * 2;
|
|
||||||
dest = {0, 0, 0, 0};
|
dest = {0, 0, 0, 0};
|
||||||
borderColor = {0, 0, 0};
|
borderColor = {0, 0, 0};
|
||||||
flashEffect.enabled = false;
|
flashEffect.enabled = false;
|
||||||
@@ -40,7 +38,11 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *
|
|||||||
fpsTicks = 0;
|
fpsTicks = 0;
|
||||||
fpsCounter = 0;
|
fpsCounter = 0;
|
||||||
fps = 0;
|
fps = 0;
|
||||||
|
#ifdef DEBUG
|
||||||
|
showFps = true;
|
||||||
|
#else
|
||||||
showFps = false;
|
showFps = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Crea los objetos
|
// Crea los objetos
|
||||||
notify = new Notify(renderer, asset->get("notify.png"), asset->get("8bithud.png"), asset->get("8bithud.txt"), asset->get("notify.wav"), options);
|
notify = new Notify(renderer, asset->get("notify.png"), asset->get("8bithud.png"), asset->get("8bithud.txt"), asset->get("notify.wav"), options);
|
||||||
@@ -147,19 +149,9 @@ void Screen::setVideoMode(int videoMode)
|
|||||||
// Muestra el puntero
|
// Muestra el puntero
|
||||||
SDL_ShowCursor(SDL_ENABLE);
|
SDL_ShowCursor(SDL_ENABLE);
|
||||||
|
|
||||||
if (options->video.border.enabled)
|
windowWidth = gameCanvasWidth;
|
||||||
{
|
windowHeight = gameCanvasHeight;
|
||||||
windowWidth = gameCanvasWidth + borderWidth;
|
dest = {0, 0, gameCanvasWidth, gameCanvasHeight};
|
||||||
windowHeight = gameCanvasHeight + borderHeight;
|
|
||||||
dest = {0 + (borderWidth / 2), 0 + (borderHeight / 2), gameCanvasWidth, gameCanvasHeight};
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
windowWidth = gameCanvasWidth;
|
|
||||||
windowHeight = gameCanvasHeight;
|
|
||||||
dest = {0, 0, gameCanvasWidth, gameCanvasHeight};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modifica el tamaño de la ventana
|
// Modifica el tamaño de la ventana
|
||||||
SDL_SetWindowSize(window, windowWidth * options->video.window.size, windowHeight * options->video.window.size);
|
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);
|
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
|
// Actualiza la lógica de la clase
|
||||||
void Screen::update()
|
void Screen::update()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ private:
|
|||||||
int windowHeight; // Alto de la pantalla o ventana
|
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 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 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
|
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
|
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
|
bool attenuateEffect; // Indica si la pantalla ha de estar atenuada
|
||||||
@@ -117,16 +115,6 @@ public:
|
|||||||
// Cambia el tipo de mezcla
|
// Cambia el tipo de mezcla
|
||||||
void setBlendMode(SDL_BlendMode blendMode);
|
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
|
// Agita la pantalla
|
||||||
void shake();
|
void shake();
|
||||||
|
|
||||||
|
|||||||
@@ -87,14 +87,6 @@ struct demoKeys_t
|
|||||||
Uint8 fireRight;
|
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
|
// Estructura para las opciones de la ventana
|
||||||
struct op_window_t
|
struct op_window_t
|
||||||
{
|
{
|
||||||
@@ -114,7 +106,6 @@ struct op_video_t
|
|||||||
bool vSync; // Indica si se quiere usar vsync o no
|
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 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
|
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
|
bool shaders; // Indica si se van a usar shaders para los filtros de video
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -224,14 +224,7 @@ bool Director::initSDL()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Crea la ventana
|
// Crea la ventana
|
||||||
int incW = 0;
|
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, param->gameWidth * options->video.window.size, param->gameHeight * options->video.window.size, SDL_WINDOW_HIDDEN);
|
||||||
int incH = 0;
|
|
||||||
if (options->video.border.enabled)
|
|
||||||
{
|
|
||||||
incW = options->video.border.width * 2;
|
|
||||||
incH = options->video.border.height * 2;
|
|
||||||
}
|
|
||||||
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (param->gameWidth + incW) * options->video.window.size, (param->gameHeight + incH) * options->video.window.size, SDL_WINDOW_HIDDEN);
|
|
||||||
if (window == nullptr)
|
if (window == nullptr)
|
||||||
{
|
{
|
||||||
if (options->console)
|
if (options->console)
|
||||||
@@ -463,9 +456,6 @@ void Director::initOptions()
|
|||||||
options->video.vSync = true;
|
options->video.vSync = true;
|
||||||
options->video.integerScale = true;
|
options->video.integerScale = true;
|
||||||
options->video.keepAspect = true;
|
options->video.keepAspect = true;
|
||||||
options->video.border.width = 0;
|
|
||||||
options->video.border.height = 0;
|
|
||||||
options->video.border.enabled = false;
|
|
||||||
options->video.shaders = true;
|
options->video.shaders = true;
|
||||||
|
|
||||||
// Opciones de las notificaciones
|
// Opciones de las notificaciones
|
||||||
@@ -694,9 +684,6 @@ bool Director::saveConfigFile()
|
|||||||
file << "video.vSync=" + boolToString(options->video.vSync) + "\n";
|
file << "video.vSync=" + boolToString(options->video.vSync) + "\n";
|
||||||
file << "video.integerScale=" + boolToString(options->video.integerScale) + "\n";
|
file << "video.integerScale=" + boolToString(options->video.integerScale) + "\n";
|
||||||
file << "video.keepAspect=" + boolToString(options->video.keepAspect) + "\n";
|
file << "video.keepAspect=" + boolToString(options->video.keepAspect) + "\n";
|
||||||
file << "video.border.enabled=" + boolToString(options->video.border.enabled) + "\n";
|
|
||||||
file << "video.border.width=" + std::to_string(options->video.border.width) + "\n";
|
|
||||||
file << "video.border.height=" + std::to_string(options->video.border.height) + "\n";
|
|
||||||
|
|
||||||
// Opciones de notificaciones
|
// Opciones de notificaciones
|
||||||
file << "\n\n## NOTIFICATION\n";
|
file << "\n\n## NOTIFICATION\n";
|
||||||
@@ -975,21 +962,6 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
|||||||
options->video.keepAspect = stringToBool(value);
|
options->video.keepAspect = stringToBool(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "video.border.enabled")
|
|
||||||
{
|
|
||||||
options->video.border.enabled = stringToBool(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (var == "video.border.width")
|
|
||||||
{
|
|
||||||
options->video.border.width = std::stoi(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (var == "video.border.height")
|
|
||||||
{
|
|
||||||
options->video.border.height = std::stoi(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Opciones de notificaciones
|
// Opciones de notificaciones
|
||||||
else if (var == "notification.posH")
|
else if (var == "notification.posH")
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user