- Cambiadas las teclas de cambiar el tamaño de ventana para adecuarse al estandar de jailgames

This commit is contained in:
2023-02-12 17:28:48 +01:00
parent 8b3d257baf
commit 31e657d138
14 changed files with 80 additions and 177 deletions

View File

@@ -7,24 +7,6 @@
#ifndef INPUT_H #ifndef INPUT_H
#define INPUT_H #define INPUT_H
#define INPUT_NULL 0
#define INPUT_UP 1
#define INPUT_DOWN 2
#define INPUT_LEFT 3
#define INPUT_RIGHT 4
#define INPUT_ACCEPT 5
#define INPUT_CANCEL 6
#define INPUT_BUTTON_1 7
#define INPUT_BUTTON_2 8
#define INPUT_BUTTON_3 9
#define INPUT_BUTTON_4 10
#define INPUT_BUTTON_5 11
#define INPUT_BUTTON_6 12
#define INPUT_BUTTON_7 13
#define INPUT_BUTTON_8 14
#define INPUT_BUTTON_PAUSE 15
#define INPUT_BUTTON_ESCAPE 16
enum inputs_e enum inputs_e
{ {
// Inputs obligatorios // Inputs obligatorios
@@ -40,15 +22,12 @@ enum inputs_e
// Inputs personalizados // Inputs personalizados
input_jump, input_jump,
input_switch_music, input_window_fullscreen,
input_video_mode, input_window_inc_size,
input_swap_palette, input_window_dec_size,
input_window_size_1,
input_window_size_2,
input_window_size_3,
input_window_size_4,
input_change_windows_size,
input_toggle_border, input_toggle_border,
input_switch_music,
input_swap_palette,
// Input obligatorio // Input obligatorio
input_number_of_inputs input_number_of_inputs

View File

@@ -850,7 +850,7 @@ void Menu::setDefaultActionWhenCancel(int item)
// Gestiona la entrada de teclado y mando durante el menu // Gestiona la entrada de teclado y mando durante el menu
void Menu::checkInput() void Menu::checkInput()
{ {
if (input->checkInput(INPUT_UP, REPEAT_FALSE)) if (input->checkInput(input_up, REPEAT_FALSE))
{ {
if (decreaseSelectorIndex()) if (decreaseSelectorIndex())
{ {
@@ -861,7 +861,7 @@ void Menu::checkInput()
} }
} }
if (input->checkInput(INPUT_DOWN, REPEAT_FALSE)) if (input->checkInput(input_down, REPEAT_FALSE))
{ {
if (increaseSelectorIndex()) if (increaseSelectorIndex())
{ {
@@ -872,7 +872,7 @@ void Menu::checkInput()
} }
} }
if (input->checkInput(INPUT_ACCEPT, REPEAT_FALSE)) if (input->checkInput(input_accept, REPEAT_FALSE))
{ {
itemSelected = selector.index; itemSelected = selector.index;
if (soundAccept) if (soundAccept)
@@ -881,7 +881,7 @@ void Menu::checkInput()
} }
} }
if (input->checkInput(INPUT_CANCEL, REPEAT_FALSE)) if (input->checkInput(input_cancel, REPEAT_FALSE))
{ {
itemSelected = defaultActionWhenCancel; itemSelected = defaultActionWhenCancel;
if (soundCancel) if (soundCancel)

View File

@@ -164,7 +164,7 @@ void Screen::setVideoMode(int videoMode)
dest.x = dest.y = 0; dest.x = dest.y = 0;
} }
} }
// Modifica el tamaño del renderizador // Modifica el tamaño del renderizador
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight); SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
@@ -191,6 +191,22 @@ void Screen::setWindowSize(int size)
setVideoMode(0); setVideoMode(0);
} }
// Reduce el tamaño de la ventana
void Screen::decWindowSize()
{
--options->windowSize;
options->windowSize = std::max(options->windowSize, 1);
setVideoMode(0);
}
// Aumenta el tamaño de la ventana
void Screen::incWindowSize()
{
++options->windowSize;
options->windowSize = std::min(options->windowSize, 4);
setVideoMode(0);
}
// Cambia el color del borde // Cambia el color del borde
void Screen::setBorderColor(color_t color) void Screen::setBorderColor(color_t color)
{ {

View File

@@ -95,6 +95,12 @@ public:
// Cambia el tamaño de la ventana // Cambia el tamaño de la ventana
void setWindowSize(int size); void setWindowSize(int size);
// Reduce el tamaño de la ventana
void decWindowSize();
// Aumenta el tamaño de la ventana
void incWindowSize();
// Cambia el color del borde // Cambia el color del borde
void setBorderColor(color_t color); void setBorderColor(color_t color);

View File

@@ -96,29 +96,19 @@ void Credits::checkInput()
screen->switchBorder(); screen->switchBorder();
} }
else if (input->checkInput(input_video_mode, REPEAT_FALSE)) else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
{ {
screen->switchVideoMode(); screen->switchVideoMode();
} }
else if (input->checkInput(input_window_size_1, REPEAT_FALSE)) else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
{ {
screen->setWindowSize(1); screen->decWindowSize();
} }
else if (input->checkInput(input_window_size_2, REPEAT_FALSE)) else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
{ {
screen->setWindowSize(2); screen->incWindowSize();
}
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
{
screen->setWindowSize(3);
}
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
{
screen->setWindowSize(4);
} }
else if (input->checkInput(input_swap_palette, REPEAT_FALSE)) else if (input->checkInput(input_swap_palette, REPEAT_FALSE))

View File

@@ -91,33 +91,21 @@ void Demo::checkInput()
reLoadTextures(); reLoadTextures();
} }
else if (input->checkInput(input_video_mode, REPEAT_FALSE)) else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
{ {
screen->switchVideoMode(); screen->switchVideoMode();
reLoadTextures(); reLoadTextures();
} }
else if (input->checkInput(input_window_size_1, REPEAT_FALSE)) else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
{ {
screen->setWindowSize(1); screen->decWindowSize();
reLoadTextures(); reLoadTextures();
} }
else if (input->checkInput(input_window_size_2, REPEAT_FALSE)) else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
{ {
screen->setWindowSize(2); screen->incWindowSize();
reLoadTextures();
}
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
{
screen->setWindowSize(3);
reLoadTextures();
}
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
{
screen->setWindowSize(4);
reLoadTextures(); reLoadTextures();
} }

View File

@@ -1234,13 +1234,11 @@ void Director::initInput()
input->bindKey(input_cancel, SDL_SCANCODE_ESCAPE); input->bindKey(input_cancel, SDL_SCANCODE_ESCAPE);
input->bindKey(input_pause, SDL_SCANCODE_H); input->bindKey(input_pause, SDL_SCANCODE_H);
input->bindKey(input_exit, SDL_SCANCODE_ESCAPE); input->bindKey(input_exit, SDL_SCANCODE_ESCAPE);
input->bindKey(input_window_size_1, SDL_SCANCODE_F1); input->bindKey(input_window_dec_size, SDL_SCANCODE_F1);
input->bindKey(input_window_size_2, SDL_SCANCODE_F2); input->bindKey(input_window_inc_size, SDL_SCANCODE_F2);
input->bindKey(input_window_size_3, SDL_SCANCODE_F3); input->bindKey(input_window_fullscreen, SDL_SCANCODE_F3);
input->bindKey(input_window_size_4, SDL_SCANCODE_F4);
input->bindKey(input_swap_palette, SDL_SCANCODE_F5); input->bindKey(input_swap_palette, SDL_SCANCODE_F5);
input->bindKey(input_switch_music, SDL_SCANCODE_M); input->bindKey(input_switch_music, SDL_SCANCODE_M);
input->bindKey(input_video_mode, SDL_SCANCODE_F);
input->bindKey(input_toggle_border, SDL_SCANCODE_B); input->bindKey(input_toggle_border, SDL_SCANCODE_B);
// Mando - Movimiento // Mando - Movimiento

View File

@@ -176,29 +176,19 @@ void Ending::checkInput()
screen->switchBorder(); screen->switchBorder();
} }
else if (input->checkInput(input_video_mode, REPEAT_FALSE)) else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
{ {
screen->switchVideoMode(); screen->switchVideoMode();
} }
else if (input->checkInput(input_window_size_1, REPEAT_FALSE)) else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
{ {
screen->setWindowSize(1); screen->decWindowSize();
} }
else if (input->checkInput(input_window_size_2, REPEAT_FALSE)) else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
{ {
screen->setWindowSize(2); screen->incWindowSize();
}
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
{
screen->setWindowSize(3);
}
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
{
screen->setWindowSize(4);
} }
else if (input->checkInput(input_swap_palette, REPEAT_FALSE)) else if (input->checkInput(input_swap_palette, REPEAT_FALSE))

View File

@@ -210,29 +210,19 @@ void Ending2::checkInput()
screen->switchBorder(); screen->switchBorder();
} }
else if (input->checkInput(input_video_mode, REPEAT_FALSE)) else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
{ {
screen->switchVideoMode(); screen->switchVideoMode();
} }
else if (input->checkInput(input_window_size_1, REPEAT_FALSE)) else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
{ {
screen->setWindowSize(1); screen->decWindowSize();
} }
else if (input->checkInput(input_window_size_2, REPEAT_FALSE)) else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
{ {
screen->setWindowSize(2); screen->incWindowSize();
}
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
{
screen->setWindowSize(3);
}
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
{
screen->setWindowSize(4);
} }
else if (input->checkInput(input_swap_palette, REPEAT_FALSE)) else if (input->checkInput(input_swap_palette, REPEAT_FALSE))

View File

@@ -208,33 +208,21 @@ void Game::checkInput()
reLoadTextures(); reLoadTextures();
} }
else if (input->checkInput(input_video_mode, REPEAT_FALSE)) else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
{ {
screen->switchVideoMode(); screen->switchVideoMode();
reLoadTextures(); reLoadTextures();
} }
else if (input->checkInput(input_window_size_1, REPEAT_FALSE)) else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
{ {
screen->setWindowSize(1); screen->decWindowSize();
reLoadTextures(); reLoadTextures();
} }
else if (input->checkInput(input_window_size_2, REPEAT_FALSE)) else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
{ {
screen->setWindowSize(2); screen->incWindowSize();
reLoadTextures();
}
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
{
screen->setWindowSize(3);
reLoadTextures();
}
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
{
screen->setWindowSize(4);
reLoadTextures(); reLoadTextures();
} }

View File

@@ -147,29 +147,19 @@ void GameOver::checkInput()
screen->switchBorder(); screen->switchBorder();
} }
else if (input->checkInput(input_video_mode, REPEAT_FALSE)) else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
{ {
screen->switchVideoMode(); screen->switchVideoMode();
} }
else if (input->checkInput(input_window_size_1, REPEAT_FALSE)) else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
{ {
screen->setWindowSize(1); screen->decWindowSize();
} }
else if (input->checkInput(input_window_size_2, REPEAT_FALSE)) else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
{ {
screen->setWindowSize(2); screen->incWindowSize();
}
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
{
screen->setWindowSize(3);
}
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
{
screen->setWindowSize(4);
} }
else if (input->checkInput(input_swap_palette, REPEAT_FALSE)) else if (input->checkInput(input_swap_palette, REPEAT_FALSE))

View File

@@ -104,29 +104,19 @@ void Intro::checkInput()
screen->switchBorder(); screen->switchBorder();
} }
else if (input->checkInput(input_video_mode, REPEAT_FALSE)) else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
{ {
screen->switchVideoMode(); screen->switchVideoMode();
} }
else if (input->checkInput(input_window_size_1, REPEAT_FALSE)) else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
{ {
screen->setWindowSize(1); screen->decWindowSize();
} }
else if (input->checkInput(input_window_size_2, REPEAT_FALSE)) else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
{ {
screen->setWindowSize(2); screen->incWindowSize();
}
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
{
screen->setWindowSize(3);
}
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
{
screen->setWindowSize(4);
} }
else if (input->checkInput(input_swap_palette, REPEAT_FALSE)) else if (input->checkInput(input_swap_palette, REPEAT_FALSE))

View File

@@ -98,29 +98,19 @@ void Logo::checkInput()
screen->switchBorder(); screen->switchBorder();
} }
else if (input->checkInput(input_video_mode, REPEAT_FALSE)) else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
{ {
screen->switchVideoMode(); screen->switchVideoMode();
} }
else if (input->checkInput(input_window_size_1, REPEAT_FALSE)) else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
{ {
screen->setWindowSize(1); screen->decWindowSize();
} }
else if (input->checkInput(input_window_size_2, REPEAT_FALSE)) else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
{ {
screen->setWindowSize(2); screen->incWindowSize();
}
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
{
screen->setWindowSize(3);
}
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
{
screen->setWindowSize(4);
} }
else if (input->checkInput(input_swap_palette, REPEAT_FALSE)) else if (input->checkInput(input_swap_palette, REPEAT_FALSE))

View File

@@ -106,33 +106,21 @@ void Title::checkInput()
resource->reLoadTextures(); resource->reLoadTextures();
} }
else if (input->checkInput(input_video_mode, REPEAT_FALSE)) else if (input->checkInput(input_window_fullscreen, REPEAT_FALSE))
{ {
screen->switchVideoMode(); screen->switchVideoMode();
resource->reLoadTextures(); resource->reLoadTextures();
} }
else if (input->checkInput(input_window_size_1, REPEAT_FALSE)) else if (input->checkInput(input_window_dec_size, REPEAT_FALSE))
{ {
screen->setWindowSize(1); screen->decWindowSize();
resource->reLoadTextures(); resource->reLoadTextures();
} }
else if (input->checkInput(input_window_size_2, REPEAT_FALSE)) else if (input->checkInput(input_window_inc_size, REPEAT_FALSE))
{ {
screen->setWindowSize(2); screen->incWindowSize();
resource->reLoadTextures();
}
else if (input->checkInput(input_window_size_3, REPEAT_FALSE))
{
screen->setWindowSize(3);
resource->reLoadTextures();
}
else if (input->checkInput(input_window_size_4, REPEAT_FALSE))
{
screen->setWindowSize(4);
resource->reLoadTextures(); resource->reLoadTextures();
} }