Precàrrega de tots els recursos al inici del joc
8.000.000 de cherrypickings que he anat fent pel codi
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include <string> // for string
|
||||
#include "jail_audio.h" // for JA_DeleteSound, JA_LoadSound, JA_Pla...
|
||||
#include "param.h" // for param
|
||||
#include "resource.h" // for Resource
|
||||
#include "screen.h" // for Screen
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "text.h" // for Text
|
||||
#include "texture.h" // for Texture
|
||||
@@ -12,9 +14,9 @@
|
||||
Notifier *Notifier::notifier_ = nullptr;
|
||||
|
||||
// [SINGLETON] Crearemos el objeto screen con esta función estática
|
||||
void Notifier::init(SDL_Renderer *renderer, std::string icon_file, std::string bitmap_file, std::string text_file, const std::string &sound_file)
|
||||
void Notifier::init(std::string icon_file, std::shared_ptr<Text> text, const std::string &sound_file)
|
||||
{
|
||||
Notifier::notifier_ = new Notifier(renderer, icon_file, bitmap_file, text_file, sound_file);
|
||||
Notifier::notifier_ = new Notifier(icon_file, text, sound_file);
|
||||
}
|
||||
|
||||
// [SINGLETON] Destruiremos el objeto screen con esta función estática
|
||||
@@ -30,9 +32,9 @@ Notifier *Notifier::get()
|
||||
}
|
||||
|
||||
// Constructor
|
||||
Notifier::Notifier(SDL_Renderer *renderer, std::string icon_file, std::string bitmap_file, std::string text_file, const std::string &sound_file)
|
||||
: renderer_(renderer),
|
||||
text_(std::make_unique<Text>(bitmap_file, text_file, renderer)),
|
||||
Notifier::Notifier(std::string icon_file, std::shared_ptr<Text> text, const std::string &sound_file)
|
||||
: renderer_(Screen::get()->getRenderer()),
|
||||
text_(text),
|
||||
bg_color_(param.notification.color),
|
||||
wait_time_(150),
|
||||
stack_(false),
|
||||
@@ -42,7 +44,7 @@ Notifier::Notifier(SDL_Renderer *renderer, std::string icon_file, std::string bi
|
||||
has_icons_ = !icon_file.empty();
|
||||
|
||||
// Crea objetos
|
||||
icon_texture_ = has_icons_ ? std::make_unique<Texture>(renderer, icon_file) : nullptr;
|
||||
icon_texture_ = has_icons_ ? std::make_unique<Texture>(renderer_, icon_file) : nullptr;
|
||||
}
|
||||
|
||||
// Destructor
|
||||
|
||||
Reference in New Issue
Block a user