forked from jaildesigner-jailgames/jaildoctors_dilemma
unificats els resources en un namespace
This commit is contained in:
@@ -5,26 +5,26 @@
|
||||
#include <utility>
|
||||
#include <vector> // Para vector
|
||||
|
||||
#include "core/audio/audio.hpp" // Para Audio
|
||||
#include "core/input/global_inputs.hpp" // Para check
|
||||
#include "core/input/input.hpp" // Para Input, InputAction, Input::DO_NOT_ALLOW_REPEAT
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
|
||||
#include "core/resources/asset.hpp" // Para Asset
|
||||
#include "core/resources/resource.hpp" // Para ResourceRoom, Resource
|
||||
#include "core/system/global_events.hpp" // Para check
|
||||
#include "game/gameplay/cheevos.hpp" // Para Cheevos
|
||||
#include "game/gameplay/item_tracker.hpp" // Para ItemTracker
|
||||
#include "game/gameplay/room.hpp" // Para Room, RoomData
|
||||
#include "game/gameplay/room_tracker.hpp" // Para RoomTracker
|
||||
#include "game/gameplay/scoreboard.hpp" // Para Scoreboard::Data, Scoreboard
|
||||
#include "game/gameplay/stats.hpp" // Para Stats
|
||||
#include "game/options.hpp" // Para Options, options, Cheat, SectionState
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "game/ui/notifier.hpp" // Para Notifier, NotificationText, CHEEVO_NO...
|
||||
#include "utils/defines.hpp" // Para TILE_SIZE, PLAY_AREA_HEIGHT, RoomBorder::BOTTOM
|
||||
#include "utils/utils.hpp" // Para PaletteColor, stringToColor
|
||||
#include "core/audio/audio.hpp" // Para Audio
|
||||
#include "core/input/global_inputs.hpp" // Para check
|
||||
#include "core/input/input.hpp" // Para Input, InputAction, Input::DO_NOT_ALLOW_REPEAT
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
|
||||
#include "core/resources/resource_cache.hpp" // Para ResourceRoom, Resource
|
||||
#include "core/resources/resource_list.hpp" // Para Asset
|
||||
#include "core/system/global_events.hpp" // Para check
|
||||
#include "game/gameplay/cheevos.hpp" // Para Cheevos
|
||||
#include "game/gameplay/item_tracker.hpp" // Para ItemTracker
|
||||
#include "game/gameplay/room.hpp" // Para Room, RoomData
|
||||
#include "game/gameplay/room_tracker.hpp" // Para RoomTracker
|
||||
#include "game/gameplay/scoreboard.hpp" // Para Scoreboard::Data, Scoreboard
|
||||
#include "game/gameplay/stats.hpp" // Para Stats
|
||||
#include "game/options.hpp" // Para Options, options, Cheat, SectionState
|
||||
#include "game/scene_manager.hpp" // Para SceneManager
|
||||
#include "game/ui/notifier.hpp" // Para Notifier, NotificationText, CHEEVO_NO...
|
||||
#include "utils/defines.hpp" // Para TILE_SIZE, PLAY_AREA_HEIGHT, RoomBorder::BOTTOM
|
||||
#include "utils/utils.hpp" // Para PaletteColor, stringToColor
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include "core/system/debug.hpp" // Para Debug
|
||||
@@ -35,7 +35,7 @@ Game::Game(Mode mode)
|
||||
: board_(std::make_shared<Scoreboard::Data>(0, 9, 0, true, 0, SDL_GetTicks(), Options::cheats.jail_is_open == Options::Cheat::State::ENABLED)),
|
||||
scoreboard_(std::make_shared<Scoreboard>(board_)),
|
||||
room_tracker_(std::make_shared<RoomTracker>()),
|
||||
stats_(std::make_shared<Stats>(Asset::get()->get("stats.csv"), Asset::get()->get("stats_buffer.csv"))),
|
||||
stats_(std::make_shared<Stats>(Resource::List::get()->get("stats.csv"), Resource::List::get()->get("stats_buffer.csv"))),
|
||||
mode_(mode),
|
||||
#ifdef _DEBUG
|
||||
current_room_("03.room"),
|
||||
@@ -229,7 +229,7 @@ void Game::handleDebugEvents(const SDL_Event& event) {
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_R:
|
||||
Resource::get()->reload();
|
||||
Resource::Cache::get()->reload();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_W:
|
||||
@@ -273,7 +273,7 @@ auto Game::changeRoom(const std::string& room_path) -> bool {
|
||||
}
|
||||
|
||||
// Verifica que exista el fichero que se va a cargar
|
||||
if (!Asset::get()->get(room_path).empty()) {
|
||||
if (!Resource::List::get()->get(room_path).empty()) {
|
||||
// Crea un objeto habitación nuevo a partir del fichero
|
||||
room_ = std::make_shared<Room>(room_path, board_);
|
||||
|
||||
@@ -441,7 +441,7 @@ auto Game::checkEndGame() -> bool {
|
||||
// Obtiene la cantidad total de items que hay en el mapeado del juego
|
||||
auto Game::getTotalItems() -> int {
|
||||
int items = 0;
|
||||
auto rooms = Resource::get()->getRooms();
|
||||
auto rooms = Resource::Cache::get()->getRooms();
|
||||
|
||||
for (const auto& room : rooms) {
|
||||
items += room.room->items.size();
|
||||
@@ -486,7 +486,7 @@ void Game::checkRestoringJail(float delta_time) {
|
||||
|
||||
// Inicializa el diccionario de las estadísticas
|
||||
void Game::initStats() {
|
||||
auto list = Resource::get()->getRooms();
|
||||
auto list = Resource::Cache::get()->getRooms();
|
||||
|
||||
for (const auto& room : list) {
|
||||
stats_->addDictionary(room.room->number, room.room->name);
|
||||
@@ -505,7 +505,7 @@ void Game::fillRoomNameTexture() {
|
||||
room_name_surface_->clear(stringToColor("white"));
|
||||
|
||||
// Escribe el texto en la textura
|
||||
auto text = Resource::get()->getText("smb2");
|
||||
auto text = Resource::Cache::get()->getText("smb2");
|
||||
text->writeDX(TEXT_CENTER | TEXT_COLOR, GAMECANVAS_CENTER_X, text->getCharacterSize() / 2, room_->getName(), 1, room_->getBGColor());
|
||||
|
||||
// Deja el renderizador por defecto
|
||||
@@ -580,7 +580,7 @@ void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr<Room
|
||||
|
||||
// Crea la textura para poner el nombre de la habitación
|
||||
void Game::createRoomNameTexture() {
|
||||
auto text = Resource::get()->getText("smb2");
|
||||
auto text = Resource::Cache::get()->getText("smb2");
|
||||
room_name_surface_ = std::make_shared<Surface>(Options::game.width, text->getCharacterSize() * 2);
|
||||
|
||||
// Establece el destino de la textura
|
||||
|
||||
Reference in New Issue
Block a user