This commit is contained in:
2022-11-30 08:27:11 +01:00
45 changed files with 262 additions and 178 deletions

View File

@@ -114,7 +114,7 @@ bool Asset::checkFile(std::string path)
// Comprueba si existe el fichero
const std::string filename = path.substr(path.find_last_of("\\/") + 1);
SDL_RWops *file = SDL_RWFromFile(path.c_str(), "r+b");
SDL_RWops *file = SDL_RWFromFile(path.c_str(), "rb");
if (file != nullptr)
{

View File

@@ -16,8 +16,8 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options
gameCanvasWidth = options->gameWidth;
gameCanvasHeight = options->gameHeight;
borderWidth = options->gameWidth * options->borderSize;
borderHeight = options->gameHeight * options->borderSize;
borderWidth = options->borderWidth * 2;
borderHeight = options->borderHeight * 2;
notificationLogicalWidth = gameCanvasWidth;
notificationLogicalHeight = gameCanvasHeight;
@@ -203,9 +203,15 @@ void Screen::setBlendMode(SDL_BlendMode blendMode)
}
// Establece el tamaño del borde
void Screen::setBorderSize(float s)
void Screen::setBorderWidth(int s)
{
options->borderSize = s;
options->borderWidth = s;
}
// Establece el tamaño del borde
void Screen::setBorderHeight(int s)
{
options->borderHeight = s;
}
// Establece si se ha de ver el borde en el modo ventana

View File

@@ -101,7 +101,8 @@ public:
void setBlendMode(SDL_BlendMode blendMode);
// Establece el tamaño del borde
void setBorderSize(float s);
void setBorderWidth(int s);
void setBorderHeight(int s);
// Establece si se ha de ver el borde en el modo ventana
void setBorderEnabled(bool value);

View File

@@ -64,6 +64,14 @@ enum not_pos_e
pos_right
};
// Tipos de control de teclado
enum ctrl_schem_e
{
ctrl_cursor,
ctrl_opqa,
ctrl_wasd
};
// Estructura para las opciones de las notificaciones
struct op_notification_t
{
@@ -128,7 +136,8 @@ struct options_t
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 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
int borderWidth; // Cantidad de pixels que se añade en el borde de la ventana
int borderHeight; // Cantidad de pixels que se añade en el borde de la ventana
palette_e palette; // Paleta de colores a usar en el juego
bool console; // Indica si ha de mostrar información por la consola de texto
cheat_t cheat; // Contiene trucos y ventajas para el juego
@@ -136,6 +145,7 @@ struct options_t
online_t online; // Datos del servicio online
op_notification_t notifications; // Opciones relativas a las notificaciones;
op_screen_t screen; // Opciones relativas a la clase screen
ctrl_schem_e keys; // Teclas usadas para jugar
};
// Calcula el cuadrado de la distancia entre dos puntos