This commit is contained in:
@ -30,6 +30,7 @@ add_subdirectory(game)
|
||||
add_subdirectory(locale)
|
||||
add_subdirectory(save)
|
||||
add_subdirectory(scene)
|
||||
add_subdirectory(settings)
|
||||
add_subdirectory(time)
|
||||
add_subdirectory(util)
|
||||
add_subdirectory(ui)
|
||||
|
@ -55,8 +55,13 @@ void IGame::init() {
|
||||
#endif
|
||||
|
||||
inputManager.init(selfAsGame);
|
||||
|
||||
saveManager.init(selfAsGame);
|
||||
|
||||
settingsManager = std::make_shared<SettingsManager>();
|
||||
settingsManager->init(selfAsGame);
|
||||
settingsManager->load();
|
||||
|
||||
this->initManagers();
|
||||
|
||||
// TEST
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "locale/LocaleManager.hpp"
|
||||
#include "save/SaveManager.hpp"
|
||||
#include "physics/PhysicsManager.hpp"
|
||||
#include "settings/SettingsManager.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class Scene;
|
||||
@ -54,6 +55,7 @@ namespace Dawn {
|
||||
std::shared_ptr<RenderHost> renderHost;
|
||||
std::shared_ptr<AssetManager> assetManager;
|
||||
std::shared_ptr<LocaleManager> localeManager;
|
||||
std::shared_ptr<SettingsManager> settingsManager;
|
||||
|
||||
#ifdef DAWN_ENABLE_PHYSICS
|
||||
std::shared_ptr<PhysicsManager> physicsManager;
|
||||
|
9
src/dawn/settings/CMakeLists.txt
Normal file
9
src/dawn/settings/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2024 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
SettingsManager.cpp
|
||||
)
|
27
src/dawn/settings/SettingsManager.cpp
Normal file
27
src/dawn/settings/SettingsManager.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2024 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "SettingsManager.hpp"
|
||||
#include "assert/assert.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
void SettingsManager::init(const std::shared_ptr<Game> game) {
|
||||
this->game = game;
|
||||
}
|
||||
|
||||
std::shared_ptr<Game> SettingsManager::getGame() {
|
||||
auto game = this->game.lock();
|
||||
assertNotNull(game, "Game instance is null.");
|
||||
return game;
|
||||
}
|
||||
|
||||
void SettingsManager::load() {
|
||||
|
||||
}
|
||||
|
||||
void SettingsManager::save() {
|
||||
|
||||
}
|
41
src/dawn/settings/SettingsManager.hpp
Normal file
41
src/dawn/settings/SettingsManager.hpp
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2024 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "dawn.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class Game;
|
||||
|
||||
class SettingsManager final {
|
||||
private:
|
||||
std::weak_ptr<Game> game;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Initializes the SettingsManager with the Game instance.
|
||||
*
|
||||
* @param game The Game instance.
|
||||
*/
|
||||
void init(const std::shared_ptr<Game> game);
|
||||
|
||||
/**
|
||||
* Gets the Game instance.
|
||||
*
|
||||
* @return The Game instance.
|
||||
*/
|
||||
std::shared_ptr<Game> getGame();
|
||||
|
||||
/**
|
||||
* Loads the settings from the settings file.
|
||||
*/
|
||||
void load();
|
||||
|
||||
/**
|
||||
* Saves the settings to the settings file.
|
||||
*/
|
||||
void save();
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user