PETA QUE NI EL PEPE KARTS
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include <string> // Para basic_string, char_traits, string
|
||||
#include "asset.h" // Para Asset
|
||||
#include "jail_shader.h" // Para init, render
|
||||
#include "notify.h" // Para Notify
|
||||
#include "notifier.h" // Para Notify
|
||||
|
||||
// [SINGLETON]
|
||||
Screen *Screen::screen_ = nullptr;
|
||||
@@ -36,12 +36,8 @@ Screen *Screen::get()
|
||||
// Constructor
|
||||
Screen::Screen(SDL_Window *window, SDL_Renderer *renderer)
|
||||
: window_(window),
|
||||
renderer_(renderer),
|
||||
asset_(Asset::get())
|
||||
renderer_(renderer)
|
||||
{
|
||||
// Crea los objetos
|
||||
notify_ = new Notify(renderer, asset_->get("notify.png"), asset_->get("smb2.png"), asset_->get("smb2.txt"), asset_->get("notify.wav"), options_);
|
||||
|
||||
game_canvas_width_ = options_->gameWidth;
|
||||
game_canvas_height_ = options_->gameHeight;
|
||||
notification_logical_width_ = game_canvas_width_;
|
||||
@@ -77,9 +73,6 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer)
|
||||
// Establece el modo de video
|
||||
setVideoMode(options_->videoMode);
|
||||
|
||||
// Inicializa variables
|
||||
notify_active_ = false;
|
||||
|
||||
// Muestra la ventana
|
||||
SDL_ShowWindow(window);
|
||||
}
|
||||
@@ -87,7 +80,6 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer)
|
||||
// Destructor
|
||||
Screen::~Screen()
|
||||
{
|
||||
delete notify_;
|
||||
SDL_DestroyTexture(game_canvas_);
|
||||
SDL_DestroyTexture(border_canvas_);
|
||||
}
|
||||
@@ -217,14 +209,11 @@ void Screen::setVideoMode(int videoMode)
|
||||
options_->screen.windowWidth = window_width_;
|
||||
options_->screen.windowHeight = window_height_;
|
||||
|
||||
// Establece el tamaño de las notificaciones
|
||||
setNotificationSize();
|
||||
|
||||
// Reinicia los shaders
|
||||
if (options_->shaders)
|
||||
{
|
||||
const std::string glsl_file = options_->screen.windowHeight == 192 ? "crtpi_192.glsl" : "crtpi_240.glsl";
|
||||
std::ifstream f(asset_->get(glsl_file).c_str());
|
||||
std::ifstream f(Asset::get()->get(glsl_file).c_str());
|
||||
std::string source((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
|
||||
|
||||
if (options_->borderEnabled)
|
||||
@@ -448,46 +437,21 @@ void Screen::renderFX()
|
||||
// Actualiza el notificador
|
||||
void Screen::updateNotifier()
|
||||
{
|
||||
notify_->update();
|
||||
notify_active_ = notify_->active();
|
||||
Notifier::get()->update();
|
||||
}
|
||||
|
||||
// Muestra una notificación de texto por pantalla;
|
||||
void Screen::showNotification(std::string text1, std::string text2, int icon)
|
||||
{
|
||||
notify_->showText(text1, text2, icon);
|
||||
Notifier::get()->showText(text1, text2, icon);
|
||||
}
|
||||
|
||||
// Dibuja las notificaciones
|
||||
void Screen::renderNotifications()
|
||||
{
|
||||
if (notify_active_)
|
||||
if (Notifier::get()->active())
|
||||
{
|
||||
notify_->render();
|
||||
}
|
||||
}
|
||||
|
||||
// Establece el tamaño de las notificaciones
|
||||
void Screen::setNotificationSize()
|
||||
{
|
||||
if (options_->videoMode == 0)
|
||||
{
|
||||
if (options_->windowSize == 3)
|
||||
{
|
||||
notification_logical_width_ = (window_width_ * 3) / 2;
|
||||
notification_logical_height_ = (window_height_ * 3) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
notification_logical_width_ = window_width_ * 2;
|
||||
notification_logical_height_ = window_height_ * 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (options_->videoMode == SDL_WINDOW_FULLSCREEN_DESKTOP)
|
||||
{
|
||||
notification_logical_width_ = window_width_ / 3;
|
||||
notification_logical_height_ = window_height_ / 3;
|
||||
Notifier::get()->render();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user