Eliminado todo el código de las notificaciones
This commit is contained in:
@@ -1,285 +0,0 @@
|
|||||||
#include "notify.h"
|
|
||||||
#include <string>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
// Constructor
|
|
||||||
Notify::Notify(SDL_Renderer *renderer, std::string iconFile, std::string bitmapFile, std::string textFile, std::string soundFile, options_t *options)
|
|
||||||
{
|
|
||||||
// Inicializa variables
|
|
||||||
this->renderer = renderer;
|
|
||||||
this->options = options;
|
|
||||||
bgColor = options->notifications.color;
|
|
||||||
waitTime = 300;
|
|
||||||
|
|
||||||
// Crea objetos
|
|
||||||
iconTexture = new Texture(renderer, iconFile);
|
|
||||||
textTexture = new Texture(renderer, bitmapFile);
|
|
||||||
text = new Text(textFile, textTexture, renderer);
|
|
||||||
sound = JA_LoadSound(soundFile.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Destructor
|
|
||||||
Notify::~Notify()
|
|
||||||
{
|
|
||||||
// Libera la memoria de los objetos
|
|
||||||
delete textTexture;
|
|
||||||
delete iconTexture;
|
|
||||||
delete text;
|
|
||||||
JA_DeleteSound(sound);
|
|
||||||
|
|
||||||
for (auto notification : notifications)
|
|
||||||
{
|
|
||||||
delete notification.sprite;
|
|
||||||
delete notification.texture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dibuja las notificaciones por pantalla
|
|
||||||
void Notify::render()
|
|
||||||
{
|
|
||||||
for (int i = (int)notifications.size() - 1; i >= 0; --i)
|
|
||||||
{
|
|
||||||
notifications[i].sprite->render();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actualiza el estado de las notificaiones
|
|
||||||
void Notify::update()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < (int)notifications.size(); ++i)
|
|
||||||
{
|
|
||||||
// Si la notificación anterior está "saliendo", no hagas nada
|
|
||||||
if (i > 0)
|
|
||||||
{
|
|
||||||
if (notifications[i - 1].state == ns_rising)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
notifications[i].counter++;
|
|
||||||
|
|
||||||
// Hace sonar la notificación en el primer frame
|
|
||||||
if (notifications[i].counter == 1)
|
|
||||||
{
|
|
||||||
if (options->notifications.sound)
|
|
||||||
{
|
|
||||||
if (notifications[i].state == ns_rising)
|
|
||||||
{ // Reproduce el sonido de la notificación
|
|
||||||
JA_PlaySound(sound);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba los estados
|
|
||||||
if (notifications[i].state == ns_rising)
|
|
||||||
{
|
|
||||||
const float step = ((float)notifications[i].counter / notifications[i].travelDist);
|
|
||||||
const int alpha = 255 * step;
|
|
||||||
|
|
||||||
if (options->notifications.posV == pos_top)
|
|
||||||
{
|
|
||||||
notifications[i].rect.y++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
notifications[i].rect.y--;
|
|
||||||
}
|
|
||||||
notifications[i].texture->setAlpha(alpha);
|
|
||||||
|
|
||||||
if (notifications[i].rect.y == notifications[i].y)
|
|
||||||
{
|
|
||||||
notifications[i].state = ns_stay;
|
|
||||||
notifications[i].texture->setAlpha(255);
|
|
||||||
notifications[i].counter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (notifications[i].state == ns_stay)
|
|
||||||
{
|
|
||||||
if (notifications[i].counter == waitTime)
|
|
||||||
{
|
|
||||||
notifications[i].state = ns_vanishing;
|
|
||||||
notifications[i].counter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (notifications[i].state == ns_vanishing)
|
|
||||||
{
|
|
||||||
|
|
||||||
const float step = (notifications[i].counter / (float)notifications[i].travelDist);
|
|
||||||
const int alpha = 255 * (1 - step);
|
|
||||||
|
|
||||||
if (options->notifications.posV == pos_top)
|
|
||||||
{
|
|
||||||
notifications[i].rect.y--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
notifications[i].rect.y++;
|
|
||||||
}
|
|
||||||
notifications[i].texture->setAlpha(alpha);
|
|
||||||
|
|
||||||
if (notifications[i].rect.y == notifications[i].y - notifications[i].travelDist)
|
|
||||||
{
|
|
||||||
notifications[i].state = ns_finished;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
notifications[i].sprite->setRect(notifications[i].rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
clearFinishedNotifications();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Elimina las notificaciones finalizadas
|
|
||||||
void Notify::clearFinishedNotifications()
|
|
||||||
{
|
|
||||||
for (int i = (int)notifications.size() - 1; i >= 0; --i)
|
|
||||||
{
|
|
||||||
if (notifications[i].state == ns_finished)
|
|
||||||
{
|
|
||||||
delete notifications[i].sprite;
|
|
||||||
delete notifications[i].texture;
|
|
||||||
notifications.erase(notifications.begin() + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Muestra una notificación de texto por pantalla;
|
|
||||||
void Notify::showText(std::string text1, std::string text2, int icon)
|
|
||||||
{
|
|
||||||
// Inicializa variables
|
|
||||||
const int iconSize = 16;
|
|
||||||
const int padding = text->getCharacterSize();
|
|
||||||
const int iconSpace = icon >= 0 ? iconSize + padding : 0;
|
|
||||||
const std::string txt = text1.length() > text2.length() ? text1 : text2;
|
|
||||||
const int width = text->lenght(txt) + (padding * 2) + iconSpace;
|
|
||||||
const int height = (text->getCharacterSize() * 2) + (padding * 2);
|
|
||||||
|
|
||||||
// Posición horizontal
|
|
||||||
int despH = 0;
|
|
||||||
if (options->notifications.posH == pos_left)
|
|
||||||
{
|
|
||||||
despH = padding;
|
|
||||||
}
|
|
||||||
else if (options->notifications.posH == pos_middle)
|
|
||||||
{
|
|
||||||
despH = ((options->video.windowWidth * options->video.windowSize) / 2 - (width / 2));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
despH = (options->video.windowWidth * options->video.windowSize) - width - padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Posición vertical
|
|
||||||
int despV = 0;
|
|
||||||
if (options->notifications.posV == pos_top)
|
|
||||||
{
|
|
||||||
despV = padding;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
despV = (options->video.windowHeight * options->video.windowSize) - height - padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int travelDist = height + padding;
|
|
||||||
|
|
||||||
// Offset
|
|
||||||
int offset = 0;
|
|
||||||
if (options->notifications.posV == pos_top)
|
|
||||||
{
|
|
||||||
offset = (int)notifications.size() > 0 ? notifications.back().y + travelDist : despV;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
offset = (int)notifications.size() > 0 ? notifications.back().y - travelDist : despV;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Crea la notificacion
|
|
||||||
notification_t n;
|
|
||||||
|
|
||||||
// Inicializa variables
|
|
||||||
n.y = offset;
|
|
||||||
n.travelDist = travelDist;
|
|
||||||
n.counter = 0;
|
|
||||||
n.state = ns_rising;
|
|
||||||
n.text1 = text1;
|
|
||||||
n.text2 = text2;
|
|
||||||
if (options->notifications.posV == pos_top)
|
|
||||||
{
|
|
||||||
n.rect = {despH, offset - travelDist, width, height};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
n.rect = {despH, offset + travelDist, width, height};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Crea la textura
|
|
||||||
n.texture = new Texture(renderer);
|
|
||||||
n.texture->createBlank(renderer, width, height, SDL_TEXTUREACCESS_TARGET);
|
|
||||||
n.texture->setBlendMode(SDL_BLENDMODE_BLEND);
|
|
||||||
|
|
||||||
// Prepara para dibujar en la textura
|
|
||||||
n.texture->setAsRenderTarget(renderer);
|
|
||||||
|
|
||||||
// Dibuja el fondo de la notificación
|
|
||||||
SDL_SetRenderDrawColor(renderer, bgColor.r, bgColor.g, bgColor.b, 255);
|
|
||||||
SDL_Rect rect;
|
|
||||||
rect = {4, 0, width - (4 * 2), height};
|
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
|
||||||
|
|
||||||
rect = {4 / 2, 1, width - 4, height - 2};
|
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
|
||||||
|
|
||||||
rect = {1, 4 / 2, width - 2, height - 4};
|
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
|
||||||
|
|
||||||
rect = {0, 4, width, height - (4 * 2)};
|
|
||||||
SDL_RenderFillRect(renderer, &rect);
|
|
||||||
|
|
||||||
// Dibuja el icono de la notificación
|
|
||||||
if (icon >= 0)
|
|
||||||
{
|
|
||||||
Sprite *sp = new Sprite({0, 0, iconSize, iconSize}, iconTexture, renderer);
|
|
||||||
sp->setPos({padding, padding, iconSize, iconSize});
|
|
||||||
sp->setSpriteClip({iconSize * (icon % 10), iconSize * (icon / 10), iconSize, iconSize});
|
|
||||||
sp->render();
|
|
||||||
delete sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Escribe el texto de la notificación
|
|
||||||
color_t color = {255, 255, 255};
|
|
||||||
if (text2 != "")
|
|
||||||
{ // Dos lineas de texto
|
|
||||||
text->writeColored(padding + iconSpace, padding, text1, color);
|
|
||||||
text->writeColored(padding + iconSpace, padding + text->getCharacterSize() + 1, text2, color);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Una linea de texto
|
|
||||||
text->writeColored(padding + iconSpace, (height / 2) - (text->getCharacterSize() / 2), text1, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deja de dibujar en la textura
|
|
||||||
SDL_SetRenderTarget(renderer, nullptr);
|
|
||||||
|
|
||||||
// Crea el sprite de la notificación
|
|
||||||
n.sprite = new Sprite(n.rect, n.texture, renderer);
|
|
||||||
|
|
||||||
// Deja la notificación invisible
|
|
||||||
n.texture->setAlpha(0);
|
|
||||||
|
|
||||||
// Añade la notificación a la lista
|
|
||||||
notifications.push_back(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Indica si hay notificaciones activas
|
|
||||||
bool Notify::active()
|
|
||||||
{
|
|
||||||
if ((int)notifications.size() > 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
#include "jail_audio.h"
|
|
||||||
#include "sprite.h"
|
|
||||||
#include "text.h"
|
|
||||||
#include "texture.h"
|
|
||||||
#include "utils.h"
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#ifndef NOTIFY_H
|
|
||||||
#define NOTIFY_H
|
|
||||||
|
|
||||||
class Notify
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
enum notification_state_e
|
|
||||||
{
|
|
||||||
ns_rising,
|
|
||||||
ns_stay,
|
|
||||||
ns_vanishing,
|
|
||||||
ns_finished
|
|
||||||
};
|
|
||||||
|
|
||||||
enum notification_position_e
|
|
||||||
{
|
|
||||||
upperLeft,
|
|
||||||
upperCenter,
|
|
||||||
upperRight,
|
|
||||||
middleLeft,
|
|
||||||
middleRight,
|
|
||||||
bottomLeft,
|
|
||||||
bottomCenter,
|
|
||||||
bottomRight
|
|
||||||
};
|
|
||||||
|
|
||||||
struct notification_t
|
|
||||||
{
|
|
||||||
std::string text1;
|
|
||||||
std::string text2;
|
|
||||||
int counter;
|
|
||||||
notification_state_e state;
|
|
||||||
notification_position_e position;
|
|
||||||
Texture *texture;
|
|
||||||
Sprite *sprite;
|
|
||||||
SDL_Rect rect;
|
|
||||||
int y;
|
|
||||||
int travelDist;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Objetos y punteros
|
|
||||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
|
||||||
Texture *textTexture; // Textura para la fuente de las notificaciones
|
|
||||||
Texture *iconTexture; // Textura para los iconos de las notificaciones
|
|
||||||
Text *text; // Objeto para dibujar texto
|
|
||||||
options_t *options; // Variable con todas las opciones del programa
|
|
||||||
|
|
||||||
// Variables
|
|
||||||
color_t bgColor; // Color de fondo de las notificaciones
|
|
||||||
int waitTime; // Tiempo que se ve la notificación
|
|
||||||
std::vector<notification_t> notifications; // La lista de notificaciones activas
|
|
||||||
JA_Sound_t *sound; // Sonido a reproducir cuando suena la notificación
|
|
||||||
|
|
||||||
// Elimina las notificaciones finalizadas
|
|
||||||
void clearFinishedNotifications();
|
|
||||||
|
|
||||||
public:
|
|
||||||
// Dibuja las notificaciones por pantalla
|
|
||||||
void render();
|
|
||||||
|
|
||||||
// Actualiza el estado de las notificaiones
|
|
||||||
void update();
|
|
||||||
|
|
||||||
// Constructor
|
|
||||||
Notify(SDL_Renderer *renderer, std::string iconFile, std::string bitmapFile, std::string textFile, std::string soundFile, options_t *options);
|
|
||||||
|
|
||||||
// Destructor
|
|
||||||
~Notify();
|
|
||||||
|
|
||||||
// Muestra una notificación de texto por pantalla;
|
|
||||||
void showText(std::string text1 = "", std::string text2 = "", int icon = -1);
|
|
||||||
|
|
||||||
// Indica si hay notificaciones activas
|
|
||||||
bool active();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -11,13 +11,10 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options
|
|||||||
this->options = options;
|
this->options = options;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
|
|
||||||
// Crea los objetos
|
|
||||||
notify = new Notify(renderer, asset->get("notify.png"), asset->get("smb2.png"), asset->get("smb2.txt"), asset->get("notify.wav"), options);
|
|
||||||
|
|
||||||
gameCanvasWidth = options->video.gameWidth;
|
gameCanvasWidth = options->video.gameWidth;
|
||||||
gameCanvasHeight = options->video.gameHeight;
|
gameCanvasHeight = options->video.gameHeight;
|
||||||
borderWidth = options->video.borderWidth * 2;
|
borderWidth = options->video.border.width * 2;
|
||||||
borderHeight = options->video.borderHeight * 2;
|
borderHeight = options->video.border.height * 2;
|
||||||
notificationLogicalWidth = gameCanvasWidth;
|
notificationLogicalWidth = gameCanvasWidth;
|
||||||
notificationLogicalHeight = gameCanvasHeight;
|
notificationLogicalHeight = gameCanvasHeight;
|
||||||
|
|
||||||
@@ -39,7 +36,6 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options
|
|||||||
// Destructor
|
// Destructor
|
||||||
Screen::~Screen()
|
Screen::~Screen()
|
||||||
{
|
{
|
||||||
delete notify;
|
|
||||||
SDL_DestroyTexture(gameCanvas);
|
SDL_DestroyTexture(gameCanvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,9 +65,6 @@ void Screen::blit()
|
|||||||
// Copia la textura de juego en el renderizador en la posición adecuada
|
// Copia la textura de juego en el renderizador en la posición adecuada
|
||||||
SDL_RenderCopy(renderer, gameCanvas, nullptr, &dest);
|
SDL_RenderCopy(renderer, gameCanvas, nullptr, &dest);
|
||||||
|
|
||||||
// Dibuja las notificaciones
|
|
||||||
renderNotifications();
|
|
||||||
|
|
||||||
// Muestra por pantalla el renderizador
|
// Muestra por pantalla el renderizador
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
}
|
}
|
||||||
@@ -91,7 +84,7 @@ void Screen::setVideoMode(int videoMode)
|
|||||||
// Esconde la ventana
|
// Esconde la ventana
|
||||||
//SDL_HideWindow(window);
|
//SDL_HideWindow(window);
|
||||||
|
|
||||||
if (options->video.borderEnabled)
|
if (options->video.border.enabled)
|
||||||
{
|
{
|
||||||
windowWidth = gameCanvasWidth + borderWidth;
|
windowWidth = gameCanvasWidth + borderWidth;
|
||||||
windowHeight = gameCanvasHeight + borderHeight;
|
windowHeight = gameCanvasHeight + borderHeight;
|
||||||
@@ -106,11 +99,8 @@ void Screen::setVideoMode(int videoMode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Modifica el tamaño de la ventana
|
// Modifica el tamaño de la ventana
|
||||||
SDL_SetWindowSize(window, windowWidth * options->video.windowSize, windowHeight * options->video.windowSize);
|
SDL_SetWindowSize(window, windowWidth * options->video.window.size, windowHeight * options->video.window.size);
|
||||||
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
||||||
|
|
||||||
// Muestra la ventana
|
|
||||||
//SDL_ShowWindow(window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si está activo el modo de pantalla completa añade el borde
|
// Si está activo el modo de pantalla completa añade el borde
|
||||||
@@ -168,11 +158,8 @@ void Screen::setVideoMode(int videoMode)
|
|||||||
|
|
||||||
// Actualiza las opciones
|
// Actualiza las opciones
|
||||||
options->video.mode = videoMode;
|
options->video.mode = videoMode;
|
||||||
options->video.windowWidth = windowWidth;
|
options->video.window.width = windowWidth;
|
||||||
options->video.windowHeight = windowHeight;
|
options->video.window.height = windowHeight;
|
||||||
|
|
||||||
// Establece el tamaño de las notificaciones
|
|
||||||
setNotificationSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Camibia entre pantalla completa y ventana
|
// Camibia entre pantalla completa y ventana
|
||||||
@@ -185,23 +172,23 @@ void Screen::switchVideoMode()
|
|||||||
// Cambia el tamaño de la ventana
|
// Cambia el tamaño de la ventana
|
||||||
void Screen::setWindowSize(int size)
|
void Screen::setWindowSize(int size)
|
||||||
{
|
{
|
||||||
options->video.windowSize = size;
|
options->video.window.size = size;
|
||||||
setVideoMode(0);
|
setVideoMode(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reduce el tamaño de la ventana
|
// Reduce el tamaño de la ventana
|
||||||
void Screen::decWindowSize()
|
void Screen::decWindowSize()
|
||||||
{
|
{
|
||||||
--options->video.windowSize;
|
--options->video.window.size;
|
||||||
options->video.windowSize = std::max(options->video.windowSize, 1);
|
options->video.window.size = std::max(options->video.window.size, 1);
|
||||||
setVideoMode(0);
|
setVideoMode(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aumenta el tamaño de la ventana
|
// Aumenta el tamaño de la ventana
|
||||||
void Screen::incWindowSize()
|
void Screen::incWindowSize()
|
||||||
{
|
{
|
||||||
++options->video.windowSize;
|
++options->video.window.size;
|
||||||
options->video.windowSize = std::min(options->video.windowSize, 4);
|
options->video.window.size = std::min(options->video.window.size, 4);
|
||||||
setVideoMode(0);
|
setVideoMode(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,25 +207,25 @@ void Screen::setBlendMode(SDL_BlendMode blendMode)
|
|||||||
// Establece el tamaño del borde
|
// Establece el tamaño del borde
|
||||||
void Screen::setBorderWidth(int s)
|
void Screen::setBorderWidth(int s)
|
||||||
{
|
{
|
||||||
options->video.borderWidth = s;
|
options->video.border.width = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el tamaño del borde
|
// Establece el tamaño del borde
|
||||||
void Screen::setBorderHeight(int s)
|
void Screen::setBorderHeight(int s)
|
||||||
{
|
{
|
||||||
options->video.borderHeight = s;
|
options->video.border.height = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece si se ha de ver el borde en el modo ventana
|
// Establece si se ha de ver el borde en el modo ventana
|
||||||
void Screen::setBorderEnabled(bool value)
|
void Screen::setBorderEnabled(bool value)
|
||||||
{
|
{
|
||||||
options->video.borderEnabled = value;
|
options->video.border.enabled = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambia entre borde visible y no visible
|
// Cambia entre borde visible y no visible
|
||||||
void Screen::switchBorder()
|
void Screen::switchBorder()
|
||||||
{
|
{
|
||||||
options->video.borderEnabled = !options->video.borderEnabled;
|
options->video.border.enabled = !options->video.border.enabled;
|
||||||
setVideoMode(0);
|
setVideoMode(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,54 +312,4 @@ void Screen::updateFX()
|
|||||||
void Screen::renderFX()
|
void Screen::renderFX()
|
||||||
{
|
{
|
||||||
renderFade();
|
renderFade();
|
||||||
}
|
|
||||||
|
|
||||||
// Actualiza el notificador
|
|
||||||
void Screen::updateNotifier()
|
|
||||||
{
|
|
||||||
notify->update();
|
|
||||||
notifyActive = notify->active();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Muestra una notificación de texto por pantalla;
|
|
||||||
void Screen::showNotification(std::string text1, std::string text2, int icon)
|
|
||||||
{
|
|
||||||
notify->showText(text1, text2, icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dibuja las notificaciones
|
|
||||||
void Screen::renderNotifications()
|
|
||||||
{
|
|
||||||
if (!notifyActive)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_RenderSetLogicalSize(renderer, notificationLogicalWidth, notificationLogicalHeight);
|
|
||||||
notify->render();
|
|
||||||
SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Establece el tamaño de las notificaciones
|
|
||||||
void Screen::setNotificationSize()
|
|
||||||
{
|
|
||||||
if (options->video.mode == 0)
|
|
||||||
{
|
|
||||||
if (options->video.windowSize == 3)
|
|
||||||
{
|
|
||||||
notificationLogicalWidth = (windowWidth * 3) / 2;
|
|
||||||
notificationLogicalHeight = (windowHeight * 3) / 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
notificationLogicalWidth = windowWidth * 2;
|
|
||||||
notificationLogicalHeight = windowHeight * 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options->video.mode == SDL_WINDOW_FULLSCREEN_DESKTOP)
|
|
||||||
{
|
|
||||||
notificationLogicalWidth = windowWidth / 3;
|
|
||||||
notificationLogicalHeight = windowHeight / 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "asset.h"
|
#include "asset.h"
|
||||||
#include "notify.h"
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "../const.h"
|
#include "../const.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -22,7 +21,6 @@ private:
|
|||||||
Asset *asset; // Objeto con el listado de recursos
|
Asset *asset; // Objeto con el listado de recursos
|
||||||
SDL_Texture *gameCanvas; // Textura para completar la ventana de juego hasta la pantalla completa
|
SDL_Texture *gameCanvas; // Textura para completar la ventana de juego hasta la pantalla completa
|
||||||
options_t *options; // Variable con todas las opciones del programa
|
options_t *options; // Variable con todas las opciones del programa
|
||||||
Notify *notify; // Dibuja notificaciones por pantalla
|
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
int windowWidth; // Ancho de la pantalla o ventana
|
int windowWidth; // Ancho de la pantalla o ventana
|
||||||
@@ -55,12 +53,6 @@ private:
|
|||||||
// Dibuja el fade
|
// Dibuja el fade
|
||||||
void renderFade();
|
void renderFade();
|
||||||
|
|
||||||
// Dibuja las notificaciones
|
|
||||||
void renderNotifications();
|
|
||||||
|
|
||||||
// Establece el tamaño de las notificaciones
|
|
||||||
void setNotificationSize();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options_t *options);
|
Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options_t *options);
|
||||||
@@ -125,12 +117,6 @@ public:
|
|||||||
|
|
||||||
// Dibuja los efectos
|
// Dibuja los efectos
|
||||||
void renderFX();
|
void renderFX();
|
||||||
|
|
||||||
// Actualiza el notificador
|
|
||||||
void updateNotifier();
|
|
||||||
|
|
||||||
// Muestra una notificación de texto por pantalla;
|
|
||||||
void showNotification(std::string text1 = "", std::string text2 = "", int icon = -1);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -93,12 +93,26 @@ struct input_t
|
|||||||
Uint8 deviceType; // Tipo de dispositivo (teclado o mando)
|
Uint8 deviceType; // Tipo de dispositivo (teclado o mando)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 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
|
||||||
|
{
|
||||||
|
int width; // Ancho de la ventana
|
||||||
|
int height; // Alto de la ventana
|
||||||
|
int size; // Contiene el valor por el que se multiplica el tamaño de la ventana
|
||||||
|
};
|
||||||
|
|
||||||
// Estructura con opciones para el video
|
// Estructura con opciones para el video
|
||||||
struct op_video_t
|
struct op_video_t
|
||||||
{
|
{
|
||||||
int windowWidth; // Ancho de la ventana
|
op_window_t window; // Opciones para la ventana del programa
|
||||||
int windowHeight; // Alto de la ventana
|
|
||||||
int windowSize; // Contiene el valor por el que se multiplica el tamaño de la ventana
|
|
||||||
Uint32 mode; // Contiene el valor del modo de pantalla completa
|
Uint32 mode; // Contiene el valor del modo de pantalla completa
|
||||||
Uint32 filter; // Filtro usado para el escalado de la imagen
|
Uint32 filter; // Filtro usado para el escalado de la imagen
|
||||||
bool vSync; // Indica si se quiere usar vsync o no
|
bool vSync; // Indica si se quiere usar vsync o no
|
||||||
@@ -106,38 +120,40 @@ struct op_video_t
|
|||||||
int gameHeight; // Alto de la resolucion nativa del juego
|
int gameHeight; // Alto de la resolucion nativa del juego
|
||||||
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
|
||||||
bool borderEnabled; // Indica si ha de mostrar el borde en el modo de ventana
|
op_border_t border; // Opciones para el borde la pantalla de juego
|
||||||
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
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Estructura para las opciones de las notificaciones
|
// Estructura para las opciones de musica
|
||||||
struct op_notification_t
|
struct op_music_t
|
||||||
{
|
{
|
||||||
not_pos_e posH; // Ubicación de las notificaciones en pantalla
|
bool enabled; // Indica si la musica suena o no
|
||||||
not_pos_e posV; // Ubicación de las notificaciones en pantalla
|
int volume; // Volumen al que suena la música
|
||||||
bool sound; // Indica si las notificaciones suenan
|
};
|
||||||
color_t color; // Color de las notificaciones
|
|
||||||
|
// Estructura para las opciones de sonido
|
||||||
|
struct op_sound_t
|
||||||
|
{
|
||||||
|
bool enabled; // Indica si los sonidos suenan o no
|
||||||
|
int volume; // Volumen al que suenan los sonidos
|
||||||
};
|
};
|
||||||
|
|
||||||
// Estructura para las opciones de audio
|
// Estructura para las opciones de audio
|
||||||
struct op_audio_t
|
struct op_audio_t
|
||||||
{
|
{
|
||||||
bool musicEnabled;
|
op_music_t music; // Opciones para la música
|
||||||
bool soundEnabled;
|
op_sound_t sound; // Opciones para los efectos de sonido
|
||||||
};
|
};
|
||||||
|
|
||||||
// Estructura con todas las opciones de configuración del programa
|
// Estructura con todas las opciones de configuración del programa
|
||||||
struct options_t
|
struct options_t
|
||||||
{
|
{
|
||||||
Uint8 difficulty; // Dificultad del juego
|
Uint8 difficulty; // Dificultad del juego
|
||||||
Uint8 playerSelected; // Jugador seleccionado para el modo 1P
|
Uint8 playerSelected; // Jugador seleccionado para el modo 1P
|
||||||
std::vector<input_t> input; // Modo de control (teclado o mando)
|
std::vector<input_t> input; // Modo de control (teclado o mando)
|
||||||
Uint8 language; // Idioma usado en el juego
|
Uint8 language; // Idioma usado en el juego
|
||||||
bool console; // Indica si ha de mostrar información por la consola de texto
|
bool console; // Indica si ha de mostrar información por la consola de texto
|
||||||
op_video_t video; // Opciones relativas a la clase screen
|
op_video_t video; // Opciones relativas a la clase screen
|
||||||
op_notification_t notifications; // Opciones relativas a las notificaciones;
|
op_audio_t audio; // Opciones para el audio
|
||||||
op_audio_t audio; // Opciones para el audio
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calcula el cuadrado de la distancia entre dos puntos
|
// Calcula el cuadrado de la distancia entre dos puntos
|
||||||
|
|||||||
@@ -166,12 +166,12 @@ bool Director::initSDL()
|
|||||||
// Crea la ventana
|
// Crea la ventana
|
||||||
int incW = 0;
|
int incW = 0;
|
||||||
int incH = 0;
|
int incH = 0;
|
||||||
if (options->video.borderEnabled)
|
if (options->video.border.enabled)
|
||||||
{
|
{
|
||||||
incW = options->video.borderWidth * 2;
|
incW = options->video.border.width * 2;
|
||||||
incH = options->video.borderHeight * 2;
|
incH = options->video.border.height * 2;
|
||||||
}
|
}
|
||||||
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (options->video.gameWidth + incW) * options->video.windowSize, (options->video.gameHeight + incH) * options->video.windowSize, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
|
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (options->video.gameWidth + incW) * options->video.window.size, (options->video.gameHeight + incH) * options->video.window.size, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
if (window == nullptr)
|
if (window == nullptr)
|
||||||
{
|
{
|
||||||
if (options->console)
|
if (options->console)
|
||||||
@@ -184,13 +184,13 @@ bool Director::initSDL()
|
|||||||
{
|
{
|
||||||
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
||||||
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
||||||
//Uint32 flags = SDL_RENDERER_SOFTWARE;
|
// Uint32 flags = SDL_RENDERER_SOFTWARE;
|
||||||
//Uint32 flags = SDL_RENDERER_ACCELERATED;
|
// Uint32 flags = SDL_RENDERER_ACCELERATED;
|
||||||
Uint32 flags = 0;
|
Uint32 flags = 0;
|
||||||
if (options->video.vSync)
|
if (options->video.vSync)
|
||||||
{
|
{
|
||||||
flags = flags | SDL_RENDERER_PRESENTVSYNC;
|
flags = flags | SDL_RENDERER_PRESENTVSYNC;
|
||||||
}
|
}
|
||||||
renderer = SDL_CreateRenderer(window, -1, flags);
|
renderer = SDL_CreateRenderer(window, -1, flags);
|
||||||
|
|
||||||
if (renderer == nullptr)
|
if (renderer == nullptr)
|
||||||
@@ -381,32 +381,28 @@ void Director::initOptions()
|
|||||||
options->video.gameWidth = GAMECANVAS_WIDTH;
|
options->video.gameWidth = GAMECANVAS_WIDTH;
|
||||||
options->video.gameHeight = GAMECANVAS_HEIGHT;
|
options->video.gameHeight = GAMECANVAS_HEIGHT;
|
||||||
options->video.mode = 0;
|
options->video.mode = 0;
|
||||||
options->video.windowSize = 3;
|
options->video.window.size = 3;
|
||||||
options->video.windowWidth = options->video.windowSize * options->video.gameWidth;
|
options->video.window.width = options->video.window.size * options->video.gameWidth;
|
||||||
options->video.windowHeight = options->video.windowSize * options->video.gameHeight;
|
options->video.window.height = options->video.window.size * options->video.gameHeight;
|
||||||
options->video.filter = FILTER_NEAREST;
|
options->video.filter = FILTER_NEAREST;
|
||||||
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.borderWidth = 0;
|
options->video.border.width = 0;
|
||||||
options->video.borderHeight = 0;
|
options->video.border.height = 0;
|
||||||
options->video.borderEnabled = false;
|
options->video.border.enabled = false;
|
||||||
|
|
||||||
// Opciones de audio
|
// Opciones de audio
|
||||||
options->audio.musicEnabled = false;
|
options->audio.music.enabled = false;
|
||||||
options->audio.soundEnabled = false;
|
options->audio.music.volume = 128;
|
||||||
|
options->audio.sound.enabled = false;
|
||||||
|
options->audio.sound.volume = 128;
|
||||||
|
|
||||||
// Opciones varios
|
// Opciones varios
|
||||||
options->playerSelected = 0;
|
options->playerSelected = 0;
|
||||||
options->difficulty = DIFFICULTY_NORMAL;
|
options->difficulty = DIFFICULTY_NORMAL;
|
||||||
options->language = ba_BA;
|
options->language = ba_BA;
|
||||||
options->console = false;
|
options->console = false;
|
||||||
|
|
||||||
// Opciones de las notificaciones
|
|
||||||
options->notifications.posV = pos_top;
|
|
||||||
options->notifications.posH = pos_left;
|
|
||||||
options->notifications.sound = true;
|
|
||||||
options->notifications.color = {48, 48, 48};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba los parametros del programa
|
// Comprueba los parametros del programa
|
||||||
@@ -536,9 +532,9 @@ bool Director::loadConfigFile()
|
|||||||
options->video.mode = 0;
|
options->video.mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options->video.windowSize < 1 || options->video.windowSize > 4)
|
if (options->video.window.size < 1 || options->video.window.size > 4)
|
||||||
{
|
{
|
||||||
options->video.windowSize = 3;
|
options->video.window.size = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options->language < 0 || options->language > MAX_LANGUAGES)
|
if (options->language < 0 || options->language > MAX_LANGUAGES)
|
||||||
@@ -572,11 +568,11 @@ bool Director::saveConfigFile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opciones g´raficas
|
// Opciones de video
|
||||||
file << "## VISUAL OPTIONS\n";
|
file << "## VIDEO\n";
|
||||||
if (options->video.mode == 0)
|
if (options->video.mode == 0)
|
||||||
{
|
{
|
||||||
file << "videoMode=0\n";
|
file << "mode=0\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (options->video.mode == SDL_WINDOW_FULLSCREEN)
|
else if (options->video.mode == SDL_WINDOW_FULLSCREEN)
|
||||||
@@ -589,7 +585,7 @@ bool Director::saveConfigFile()
|
|||||||
file << "fullScreenMode=SDL_WINDOW_FULLSCREEN_DESKTOP\n";
|
file << "fullScreenMode=SDL_WINDOW_FULLSCREEN_DESKTOP\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
file << "windowSize=" + std::to_string(options->video.windowSize) + "\n";
|
file << "window.size=" + std::to_string(options->video.window.size) + "\n";
|
||||||
|
|
||||||
if (options->video.filter == FILTER_NEAREST)
|
if (options->video.filter == FILTER_NEAREST)
|
||||||
{
|
{
|
||||||
@@ -603,45 +599,24 @@ bool Director::saveConfigFile()
|
|||||||
file << "vSync=" + boolToString(options->video.vSync) + "\n";
|
file << "vSync=" + boolToString(options->video.vSync) + "\n";
|
||||||
file << "integerScale=" + boolToString(options->video.integerScale) + "\n";
|
file << "integerScale=" + boolToString(options->video.integerScale) + "\n";
|
||||||
file << "keepAspect=" + boolToString(options->video.keepAspect) + "\n";
|
file << "keepAspect=" + boolToString(options->video.keepAspect) + "\n";
|
||||||
file << "borderEnabled=" + boolToString(options->video.borderEnabled) + "\n";
|
file << "border.enabled=" + boolToString(options->video.border.enabled) + "\n";
|
||||||
file << "borderWidth=" + std::to_string(options->video.borderWidth) + "\n";
|
file << "border.width=" + std::to_string(options->video.border.width) + "\n";
|
||||||
file << "borderHeight=" + std::to_string(options->video.borderHeight) + "\n";
|
file << "border.height=" + std::to_string(options->video.border.height) + "\n";
|
||||||
|
|
||||||
// Otras opciones del programa
|
// Opciones de audio
|
||||||
file << "\n## OTHER OPTIONS\n";
|
file << "\n## AUDIO\n";
|
||||||
|
file << "music.enabled=" + boolToString(options->audio.music.enabled) + "\n";
|
||||||
|
file << "music.volume=" + std::to_string(options->audio.music.volume) + "\n";
|
||||||
|
file << "sound.enabled=" + boolToString(options->audio.sound.enabled) + "\n";
|
||||||
|
file << "sound.volume=" + std::to_string(options->audio.sound.volume) + "\n";
|
||||||
|
|
||||||
|
// Opciones del juego
|
||||||
|
file << "\n## GAME\n";
|
||||||
file << "language=" + std::to_string(options->language) + "\n";
|
file << "language=" + std::to_string(options->language) + "\n";
|
||||||
file << "difficulty=" + std::to_string(options->difficulty) + "\n";
|
file << "difficulty=" + std::to_string(options->difficulty) + "\n";
|
||||||
file << "input0=" + std::to_string(options->input[0].deviceType) + "\n";
|
file << "input0=" + std::to_string(options->input[0].deviceType) + "\n";
|
||||||
file << "input1=" + std::to_string(options->input[1].deviceType) + "\n";
|
file << "input1=" + std::to_string(options->input[1].deviceType) + "\n";
|
||||||
|
|
||||||
// Opciones de las notificaciones
|
|
||||||
file << "\n## NOTIFICATION OPTIONS\n";
|
|
||||||
file << "## notifications.posV = pos_top | pos_bottom\n";
|
|
||||||
if (options->notifications.posV == pos_top)
|
|
||||||
{
|
|
||||||
file << "notifications.posV=pos_top\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file << "notifications.posV=pos_bottom\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
file << "## notifications.posH = pos_left | pos_middle | pos_right\n";
|
|
||||||
if (options->notifications.posH == pos_left)
|
|
||||||
{
|
|
||||||
file << "notifications.posH=pos_left\n";
|
|
||||||
}
|
|
||||||
else if (options->notifications.posH == pos_middle)
|
|
||||||
{
|
|
||||||
file << "notifications.posH=pos_middle\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file << "notifications.posH=pos_right\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
file << "notifications.sound=" + boolToString(options->notifications.sound) + "\n";
|
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
@@ -710,7 +685,7 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
// Opciones de video
|
// Opciones de video
|
||||||
if (var == "videoMode")
|
if (var == "mode")
|
||||||
{
|
{
|
||||||
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP")
|
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP")
|
||||||
{
|
{
|
||||||
@@ -726,12 +701,12 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "windowSize")
|
else if (var == "window.size")
|
||||||
{
|
{
|
||||||
options->video.windowSize = std::stoi(value);
|
options->video.window.size = std::stoi(value);
|
||||||
if ((options->video.windowSize < 1) || (options->video.windowSize > 4))
|
if ((options->video.window.size < 1) || (options->video.window.size > 4))
|
||||||
{
|
{
|
||||||
options->video.windowSize = 3;
|
options->video.window.size = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -762,22 +737,43 @@ 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 == "borderEnabled")
|
else if (var == "border.enabled")
|
||||||
{
|
{
|
||||||
options->video.borderEnabled = stringToBool(value);
|
options->video.border.enabled = stringToBool(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "borderWidth")
|
else if (var == "border.width")
|
||||||
{
|
{
|
||||||
options->video.borderWidth = std::stoi(value);
|
options->video.border.width = std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (var == "borderHeight")
|
else if (var == "border.height")
|
||||||
{
|
{
|
||||||
options->video.borderHeight = std::stoi(value);
|
options->video.border.height = std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opciones varias
|
// Opciones de audio
|
||||||
|
else if (var == "music.enabled")
|
||||||
|
{
|
||||||
|
options->audio.music.enabled = stringToBool(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "music.volume")
|
||||||
|
{
|
||||||
|
options->audio.music.volume = std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "sound.enabled")
|
||||||
|
{
|
||||||
|
options->audio.sound.enabled = stringToBool(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "sound.volume")
|
||||||
|
{
|
||||||
|
options->audio.sound.volume = std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opciones de juego
|
||||||
else if (var == "language")
|
else if (var == "language")
|
||||||
{
|
{
|
||||||
options->language = std::stoi(value);
|
options->language = std::stoi(value);
|
||||||
@@ -798,40 +794,6 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
|||||||
options->input[1].deviceType = std::stoi(value);
|
options->input[1].deviceType = std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opciones de notificaciones
|
|
||||||
else if (var == "notifications.posH")
|
|
||||||
{
|
|
||||||
if (value == "pos_left")
|
|
||||||
{
|
|
||||||
options->notifications.posH = pos_left;
|
|
||||||
}
|
|
||||||
else if (value == "pos_middle")
|
|
||||||
{
|
|
||||||
options->notifications.posH = pos_middle;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
options->notifications.posH = pos_right;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (var == "notifications.posV")
|
|
||||||
{
|
|
||||||
if (value == "pos_top")
|
|
||||||
{
|
|
||||||
options->notifications.posV = pos_top;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
options->notifications.posV = pos_bottom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (var == "notifications.sound")
|
|
||||||
{
|
|
||||||
options->notifications.sound = stringToBool(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lineas vacias o que empiezan por comentario
|
// Lineas vacias o que empiezan por comentario
|
||||||
else if (var == "" || var.substr(0, 1) == "#")
|
else if (var == "" || var.substr(0, 1) == "#")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2638,9 +2638,6 @@ void Game::update()
|
|||||||
// Actualiza el contador de ticks
|
// Actualiza el contador de ticks
|
||||||
ticks = SDL_GetTicks();
|
ticks = SDL_GetTicks();
|
||||||
|
|
||||||
// Actualiza las notificaciones
|
|
||||||
screen->updateNotifier();
|
|
||||||
|
|
||||||
// Actualiza el contador de juego
|
// Actualiza el contador de juego
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
@@ -3243,9 +3240,6 @@ void Game::updatePausedGame()
|
|||||||
// Actualiza el contador de ticks
|
// Actualiza el contador de ticks
|
||||||
ticks = SDL_GetTicks();
|
ticks = SDL_GetTicks();
|
||||||
|
|
||||||
// Actualiza las notificaciones
|
|
||||||
screen->updateNotifier();
|
|
||||||
|
|
||||||
if (leavingPauseMenu)
|
if (leavingPauseMenu)
|
||||||
{
|
{
|
||||||
if (pauseCounter > 0)
|
if (pauseCounter > 0)
|
||||||
@@ -3388,9 +3382,6 @@ void Game::updateGameOverScreen()
|
|||||||
// Actualiza el contador de ticks
|
// Actualiza el contador de ticks
|
||||||
ticks = SDL_GetTicks();
|
ticks = SDL_GetTicks();
|
||||||
|
|
||||||
// Actualiza las notificaciones
|
|
||||||
screen->updateNotifier();
|
|
||||||
|
|
||||||
// Actualiza la lógica del menu
|
// Actualiza la lógica del menu
|
||||||
gameOverMenu->update();
|
gameOverMenu->update();
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,6 @@ void HiScoreTable::update()
|
|||||||
// Actualiza el contador de ticks
|
// Actualiza el contador de ticks
|
||||||
ticks = SDL_GetTicks();
|
ticks = SDL_GetTicks();
|
||||||
|
|
||||||
// Actualiza las notificaciones
|
|
||||||
screen->updateNotifier();
|
|
||||||
|
|
||||||
if (mode == mhst_auto)
|
if (mode == mhst_auto)
|
||||||
{ // Modo automático
|
{ // Modo automático
|
||||||
counter++;
|
counter++;
|
||||||
|
|||||||
@@ -398,9 +398,6 @@ void Intro::update()
|
|||||||
|
|
||||||
// Actualiza las escenas de la intro
|
// Actualiza las escenas de la intro
|
||||||
updateScenes();
|
updateScenes();
|
||||||
|
|
||||||
// Actualiza las notificaciones
|
|
||||||
screen->updateNotifier();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,9 +119,6 @@ void Logo::update()
|
|||||||
|
|
||||||
// Comprueba si ha terminado el logo
|
// Comprueba si ha terminado el logo
|
||||||
checkLogoEnd();
|
checkLogoEnd();
|
||||||
|
|
||||||
// Actualiza las notificaciones
|
|
||||||
screen->updateNotifier();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,9 +197,6 @@ void Title::update()
|
|||||||
// Actualiza el contador de ticks
|
// Actualiza el contador de ticks
|
||||||
ticks = SDL_GetTicks();
|
ticks = SDL_GetTicks();
|
||||||
|
|
||||||
// Actualiza las notificaciones
|
|
||||||
screen->updateNotifier();
|
|
||||||
|
|
||||||
switch (section->subsection)
|
switch (section->subsection)
|
||||||
{
|
{
|
||||||
// Sección 1 - Titulo desplazandose
|
// Sección 1 - Titulo desplazandose
|
||||||
|
|||||||
Reference in New Issue
Block a user