Don Melitonitzada la classe Notifier e independitzada de la classe Screen
Ara es poden afegir codis a les notificacions per identificarles
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#include "dbgtxt.h" // for dbg_print
|
||||
#include "global_inputs.h" // for servicePressedCounter
|
||||
#include "input.h" // for Input, inputs_e, INPUT_DO_NOT_ALLOW_REPEAT
|
||||
#include "notify.h" // for Notify
|
||||
#include "notifier.h" // for Notify
|
||||
#include "on_screen_help.h" // for OnScreenHelp
|
||||
#include "options.h" // for options
|
||||
#include "param.h" // for param
|
||||
@@ -47,7 +47,6 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer)
|
||||
: window_(window),
|
||||
renderer_(renderer),
|
||||
|
||||
notify_(std::make_unique<Notify>(renderer_, std::string(), Asset::get()->get("8bithud.png"), Asset::get()->get("8bithud.txt"), Asset::get()->get("notify.wav"))),
|
||||
game_canvas_(SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
|
||||
shader_canvas_(SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
|
||||
|
||||
@@ -127,7 +126,7 @@ void Screen::blit()
|
||||
displayInfo();
|
||||
|
||||
// Muestra las notificaciones
|
||||
notify_->render();
|
||||
Notifier::get()->render();
|
||||
|
||||
#ifdef NO_SHADERS
|
||||
// Vuelve a dejar el renderizador en modo normal
|
||||
@@ -281,7 +280,7 @@ void Screen::setBlendMode(SDL_BlendMode blendMode)
|
||||
void Screen::update()
|
||||
{
|
||||
updateShakeEffect();
|
||||
notify_->update();
|
||||
Notifier::get()->update();
|
||||
updateFPS();
|
||||
OnScreenHelp::get()->update();
|
||||
}
|
||||
@@ -295,7 +294,7 @@ void Screen::checkInput()
|
||||
{
|
||||
switchVideoMode();
|
||||
const std::string mode = options.video.mode == ScreenVideoMode::WINDOW ? "Window" : "Fullscreen";
|
||||
showNotification(mode + " mode");
|
||||
Notifier::get()->showText(mode + " mode");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -304,7 +303,7 @@ void Screen::checkInput()
|
||||
{
|
||||
decWindowSize();
|
||||
const std::string size = std::to_string(options.video.window.size);
|
||||
showNotification("Window size x" + size);
|
||||
Notifier::get()->showText("Window size x" + size);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -313,7 +312,7 @@ void Screen::checkInput()
|
||||
{
|
||||
incWindowSize();
|
||||
const std::string size = std::to_string(options.video.window.size);
|
||||
showNotification("Window size x" + size);
|
||||
Notifier::get()->showText("Window size x" + size);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -443,7 +442,7 @@ void Screen::switchShaders()
|
||||
options.video.shaders = !options.video.shaders;
|
||||
setVideoMode(options.video.mode);
|
||||
const std::string value = options.video.shaders ? "on" : "off";
|
||||
showNotification("Shaders " + value);
|
||||
Notifier::get()->showText("Shaders " + value);
|
||||
}
|
||||
|
||||
// Atenua la pantalla
|
||||
@@ -452,12 +451,6 @@ void Screen::attenuate(bool value)
|
||||
attenuate_effect_ = value;
|
||||
}
|
||||
|
||||
// Muestra una notificación de texto por pantalla;
|
||||
void Screen::showNotification(const std::string &text1, const std::string &text2, int icon)
|
||||
{
|
||||
notify_->showText(text1, text2, icon);
|
||||
}
|
||||
|
||||
// Obtiene el puntero al renderizador
|
||||
SDL_Renderer *Screen::getRenderer()
|
||||
{
|
||||
@@ -491,12 +484,6 @@ void Screen::displayInfo()
|
||||
}
|
||||
}
|
||||
|
||||
// Indica si hay alguna notificación activa en pantalla
|
||||
bool Screen::notificationsAreActive() const
|
||||
{
|
||||
return notify_->active();
|
||||
}
|
||||
|
||||
// Calcula la nueva posición de la ventana a partir de la antigua al cambiarla de tamaño
|
||||
SDL_Point Screen::getNewPosition()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user