Compare commits
2 Commits
149e422489
...
7a3c2ffe71
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a3c2ffe71 | |||
| 49cffb3669 |
@@ -139,7 +139,7 @@ void Screen::blit()
|
||||
void Screen::setVideoMode(int videoMode)
|
||||
{
|
||||
// Si está activo el modo ventana quita el borde
|
||||
if (videoMode == VIDEO_MODE_WINDOW)
|
||||
if (videoMode == SCREEN_VIDEO_MODE_WINDOW)
|
||||
{
|
||||
// Aplica el modo de video
|
||||
SDL_SetWindowFullscreen(window, 0);
|
||||
@@ -167,10 +167,10 @@ void Screen::setVideoMode(int videoMode)
|
||||
}
|
||||
|
||||
// Si está activo el modo de pantalla completa añade el borde
|
||||
else if (videoMode == VIDEO_MODE_FULLSCREEN)
|
||||
else if (videoMode == SCREEN_VIDEO_MODE_FULLSCREEN)
|
||||
{
|
||||
// Aplica el modo de video
|
||||
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
|
||||
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
|
||||
// Oculta el puntero
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
@@ -250,7 +250,7 @@ void Screen::setVideoMode(int videoMode)
|
||||
// Camibia entre pantalla completa y ventana
|
||||
void Screen::switchVideoMode()
|
||||
{
|
||||
options->video.mode = options->video.mode == VIDEO_MODE_WINDOW ? VIDEO_MODE_FULLSCREEN : VIDEO_MODE_WINDOW;
|
||||
options->video.mode = options->video.mode == SCREEN_VIDEO_MODE_WINDOW ? SCREEN_VIDEO_MODE_FULLSCREEN : SCREEN_VIDEO_MODE_WINDOW;
|
||||
setVideoMode(options->video.mode);
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ void Screen::switchVideoMode()
|
||||
void Screen::setWindowSize(int size)
|
||||
{
|
||||
options->video.window.size = size;
|
||||
setVideoMode(VIDEO_MODE_WINDOW);
|
||||
setVideoMode(SCREEN_VIDEO_MODE_WINDOW);
|
||||
}
|
||||
|
||||
// Reduce el tamaño de la ventana
|
||||
@@ -266,7 +266,7 @@ void Screen::decWindowSize()
|
||||
{
|
||||
--options->video.window.size;
|
||||
options->video.window.size = std::max(options->video.window.size, 1);
|
||||
setVideoMode(VIDEO_MODE_WINDOW);
|
||||
setVideoMode(SCREEN_VIDEO_MODE_WINDOW);
|
||||
}
|
||||
|
||||
// Aumenta el tamaño de la ventana
|
||||
@@ -274,7 +274,7 @@ void Screen::incWindowSize()
|
||||
{
|
||||
++options->video.window.size;
|
||||
options->video.window.size = std::min(options->video.window.size, 4);
|
||||
setVideoMode(VIDEO_MODE_WINDOW);
|
||||
setVideoMode(SCREEN_VIDEO_MODE_WINDOW);
|
||||
}
|
||||
|
||||
// Cambia el color del borde
|
||||
@@ -311,7 +311,7 @@ void Screen::setBorderEnabled(bool value)
|
||||
void Screen::switchBorder()
|
||||
{
|
||||
options->video.border.enabled = !options->video.border.enabled;
|
||||
setVideoMode(VIDEO_MODE_WINDOW);
|
||||
setVideoMode(SCREEN_VIDEO_MODE_WINDOW);
|
||||
}
|
||||
|
||||
// Actualiza la lógica de la clase
|
||||
@@ -328,7 +328,7 @@ void Screen::checkInput()
|
||||
if (input->checkInput(input_window_fullscreen, DO_NOT_ALLOW_REPEAT))
|
||||
{
|
||||
switchVideoMode();
|
||||
const std::string mode = options->video.mode == VIDEO_MODE_WINDOW ? "Window" : "Fullscreen";
|
||||
const std::string mode = options->video.mode == SCREEN_VIDEO_MODE_WINDOW ? "Window" : "Fullscreen";
|
||||
showNotification(mode + " mode");
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#include "../const.h"
|
||||
#include <vector>
|
||||
|
||||
#define FILTER_NEAREST 0
|
||||
#define FILTER_LINEAL 1
|
||||
#define SCREEN_FILTER_NEAREST 0
|
||||
#define SCREEN_FILTER_LINEAL 1
|
||||
|
||||
#define VIDEO_MODE_WINDOW 0
|
||||
#define VIDEO_MODE_FULLSCREEN 1
|
||||
#define SCREEN_VIDEO_MODE_WINDOW 0
|
||||
#define SCREEN_VIDEO_MODE_FULLSCREEN 1
|
||||
|
||||
class Screen
|
||||
{
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
#define DIFFICULTY_NORMAL 1
|
||||
#define DIFFICULTY_HARD 2
|
||||
|
||||
// Tipo de filtro
|
||||
#define FILTER_NEAREST 0
|
||||
#define FILTER_LINEAL 1
|
||||
|
||||
// Estructura para definir un circulo
|
||||
struct circle_t
|
||||
{
|
||||
|
||||
@@ -458,7 +458,7 @@ void Director::initOptions()
|
||||
// Opciones de video
|
||||
options->video.mode = 0;
|
||||
options->video.window.size = 3;
|
||||
options->video.filter = FILTER_NEAREST;
|
||||
options->video.filter = SCREEN_FILTER_NEAREST;
|
||||
options->video.vSync = true;
|
||||
options->video.integerScale = true;
|
||||
options->video.keepAspect = true;
|
||||
@@ -633,7 +633,7 @@ bool Director::loadConfigFile()
|
||||
const bool c = options->video.mode == SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
if (!(a || b || c))
|
||||
{
|
||||
options->video.mode = 0;
|
||||
options->video.mode = SCREEN_VIDEO_MODE_WINDOW;
|
||||
}
|
||||
|
||||
if (options->video.window.size < 1 || options->video.window.size > 4)
|
||||
@@ -675,19 +675,19 @@ bool Director::saveConfigFile()
|
||||
file << "## video.filter [0: nearest, 1: lineal]\n";
|
||||
file << "\n";
|
||||
|
||||
if (options->video.mode == VIDEO_MODE_WINDOW)
|
||||
if (options->video.mode == SCREEN_VIDEO_MODE_WINDOW)
|
||||
{
|
||||
file << "video.mode=0\n";
|
||||
}
|
||||
|
||||
else if (options->video.mode == VIDEO_MODE_FULLSCREEN)
|
||||
else if (options->video.mode == SCREEN_VIDEO_MODE_FULLSCREEN)
|
||||
{
|
||||
file << "video.mode=1\n";
|
||||
}
|
||||
|
||||
file << "video.window.size=" + std::to_string(options->video.window.size) + "\n";
|
||||
|
||||
options->video.filter == FILTER_NEAREST ? file << "video.filter=0\n" : file << "video.filter=1\n";
|
||||
options->video.filter == SCREEN_FILTER_NEAREST ? file << "video.filter=0\n" : file << "video.filter=1\n";
|
||||
|
||||
file << "video.shaders=" + boolToString(options->video.shaders) + "\n";
|
||||
file << "video.vSync=" + boolToString(options->video.vSync) + "\n";
|
||||
@@ -937,14 +937,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
// Opciones de video
|
||||
if (var == "video.mode")
|
||||
{
|
||||
if (value == "0")
|
||||
{
|
||||
options->video.mode = VIDEO_MODE_WINDOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->video.mode = VIDEO_MODE_FULLSCREEN;
|
||||
}
|
||||
options->video.mode = value == std::to_string(SCREEN_VIDEO_MODE_WINDOW) ? SCREEN_VIDEO_MODE_WINDOW : SCREEN_VIDEO_MODE_FULLSCREEN;
|
||||
}
|
||||
|
||||
else if (var == "video.window.size")
|
||||
@@ -958,14 +951,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
|
||||
else if (var == "video.filter")
|
||||
{
|
||||
if (value == "0")
|
||||
{
|
||||
options->video.filter = FILTER_NEAREST;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->video.filter = FILTER_LINEAL;
|
||||
}
|
||||
options->video.filter = value == std::to_string(SCREEN_FILTER_NEAREST) ? SCREEN_FILTER_NEAREST : SCREEN_FILTER_LINEAL;
|
||||
}
|
||||
|
||||
else if (var == "video.shaders")
|
||||
@@ -1022,14 +1008,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
|
||||
else if (var == "notification.posV")
|
||||
{
|
||||
if (value == "pos_top")
|
||||
{
|
||||
options->notification.posV = pos_top;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->notification.posV = pos_bottom;
|
||||
}
|
||||
options->notification.posV = value == "pos_top" ? pos_top : pos_bottom;
|
||||
}
|
||||
|
||||
else if (var == "notification.sound")
|
||||
|
||||
127
source/game.cpp
127
source/game.cpp
@@ -1792,11 +1792,6 @@ void Game::updateEnemyDeployCounter()
|
||||
// Actualiza el juego
|
||||
void Game::update()
|
||||
{
|
||||
if (paused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Comprueba que la diferencia de ticks sea mayor a la velocidad del juego
|
||||
if (SDL_GetTicks() - ticks > ticksSpeed)
|
||||
{
|
||||
@@ -1853,6 +1848,67 @@ void Game::update()
|
||||
increaseStageCurrentPower(1);
|
||||
}
|
||||
#endif
|
||||
if (!paused)
|
||||
{
|
||||
// Actualiza el objeto fade
|
||||
fade->update();
|
||||
|
||||
// Actualiza las variables del jugador
|
||||
updatePlayers();
|
||||
|
||||
// Actualiza el marcador
|
||||
checkPlayersStatusPlaying();
|
||||
updateScoreboard();
|
||||
|
||||
// Actualiza el fondo
|
||||
updateBackground();
|
||||
|
||||
// Mueve los globos
|
||||
updateBalloons();
|
||||
|
||||
// Actualiza el objeto encargado de las explosiones
|
||||
explosions->update();
|
||||
|
||||
// Mueve las balas
|
||||
moveBullets();
|
||||
|
||||
// Actualiza los items
|
||||
updateItems();
|
||||
|
||||
// Comprueba si hay cambio de fase y actualiza las variables
|
||||
updateStage();
|
||||
|
||||
// Actualiza el estado de muerte
|
||||
updateGameOver();
|
||||
|
||||
// Actualiza los SmartSprites
|
||||
updateSmartSprites();
|
||||
|
||||
// Actualiza los contadores de estado y efectos
|
||||
updateTimeStoppedCounter();
|
||||
updateEnemyDeployCounter();
|
||||
|
||||
// Actualiza el ayudante
|
||||
updateHelper();
|
||||
|
||||
// Comprueba las colisiones entre globos y balas
|
||||
checkBulletBalloonCollision();
|
||||
|
||||
// Comprueba el nivel de amenaza para ver si se han de crear nuevos enemigos
|
||||
updateMenace();
|
||||
|
||||
// Actualiza la velocidad de los enemigos
|
||||
updateBalloonSpeed();
|
||||
|
||||
// Actualiza el tramo final de juego, una vez completado
|
||||
updateGameCompleted();
|
||||
|
||||
// Vacia los vectores
|
||||
freeBullets();
|
||||
freeBalloons();
|
||||
freeItems();
|
||||
freeSmartSprites();
|
||||
}
|
||||
|
||||
// Comprueba si la música ha de estar sonando
|
||||
checkMusicStatus();
|
||||
@@ -1860,65 +1916,6 @@ void Game::update()
|
||||
// Actualiza el objeto screen
|
||||
screen->update();
|
||||
|
||||
// Actualiza el objeto fade
|
||||
fade->update();
|
||||
|
||||
// Actualiza las variables del jugador
|
||||
updatePlayers();
|
||||
|
||||
// Actualiza el marcador
|
||||
checkPlayersStatusPlaying();
|
||||
updateScoreboard();
|
||||
|
||||
// Actualiza el fondo
|
||||
updateBackground();
|
||||
|
||||
// Mueve los globos
|
||||
updateBalloons();
|
||||
|
||||
// Actualiza el objeto encargado de las explosiones
|
||||
explosions->update();
|
||||
|
||||
// Mueve las balas
|
||||
moveBullets();
|
||||
|
||||
// Actualiza los items
|
||||
updateItems();
|
||||
|
||||
// Comprueba si hay cambio de fase y actualiza las variables
|
||||
updateStage();
|
||||
|
||||
// Actualiza el estado de muerte
|
||||
updateGameOver();
|
||||
|
||||
// Actualiza los SmartSprites
|
||||
updateSmartSprites();
|
||||
|
||||
// Actualiza los contadores de estado y efectos
|
||||
updateTimeStoppedCounter();
|
||||
updateEnemyDeployCounter();
|
||||
|
||||
// Actualiza el ayudante
|
||||
updateHelper();
|
||||
|
||||
// Comprueba las colisiones entre globos y balas
|
||||
checkBulletBalloonCollision();
|
||||
|
||||
// Comprueba el nivel de amenaza para ver si se han de crear nuevos enemigos
|
||||
updateMenace();
|
||||
|
||||
// Actualiza la velocidad de los enemigos
|
||||
updateBalloonSpeed();
|
||||
|
||||
// Actualiza el tramo final de juego, una vez completado
|
||||
updateGameCompleted();
|
||||
|
||||
// Vacia los vectores
|
||||
freeBullets();
|
||||
freeBalloons();
|
||||
freeItems();
|
||||
freeSmartSprites();
|
||||
|
||||
// Dibuja los graficos de la zona de juego en la textura
|
||||
fillCanvas();
|
||||
}
|
||||
@@ -2757,7 +2754,7 @@ void Game::checkPlayersStatusPlaying()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (auto player : players)
|
||||
{
|
||||
switch (player->getStatusPlaying())
|
||||
|
||||
Reference in New Issue
Block a user