Save Manager
This commit is contained in:
@ -20,6 +20,7 @@ add_subdirectory(game)
|
||||
add_subdirectory(prefabs)
|
||||
add_subdirectory(ui)
|
||||
add_subdirectory(visualnovel)
|
||||
add_subdirectory(save)
|
||||
add_subdirectory(scenes)
|
||||
|
||||
# Assets
|
||||
|
@ -15,7 +15,8 @@ DawnGame::DawnGame(DawnHost *host) :
|
||||
host(host),
|
||||
renderManager(this),
|
||||
inputManager(this),
|
||||
localeManager(this)
|
||||
localeManager(this),
|
||||
saveManager(this)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
#include "game/_DawnGame.hpp"
|
||||
#include "scene/components/Components.hpp"
|
||||
#include "save/PokerSaveManager.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class DawnGame : public IDawnGame {
|
||||
@ -16,6 +17,7 @@ namespace Dawn {
|
||||
InputManager inputManager;
|
||||
TimeManager timeManager;
|
||||
LocaleManager localeManager;
|
||||
PokerSaveManager saveManager;
|
||||
|
||||
DawnGame(DawnHost *host);
|
||||
int32_t init() override;
|
||||
|
10
src/dawnpokergame/save/CMakeLists.txt
Normal file
10
src/dawnpokergame/save/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
# Copyright (c) 2022 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
PokerSaveManager.cpp
|
||||
)
|
28
src/dawnpokergame/save/PokerSaveManager.cpp
Normal file
28
src/dawnpokergame/save/PokerSaveManager.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "PokerSaveManager.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
PokerSaveManager::PokerSaveManager(DawnGame *game) : SaveManager(game) {
|
||||
}
|
||||
|
||||
bool_t PokerSaveManager::validateSave(struct SaveFile raw) {
|
||||
if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true;
|
||||
this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void PokerSaveManager::setExample(int32_t val) {
|
||||
savedata_t value;
|
||||
value.i32 = val;
|
||||
this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value);
|
||||
}
|
||||
|
||||
int32_t PokerSaveManager::getExample() {
|
||||
return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32;
|
||||
}
|
22
src/dawnpokergame/save/PokerSaveManager.hpp
Normal file
22
src/dawnpokergame/save/PokerSaveManager.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "save/SaveManager.hpp"
|
||||
|
||||
#define POKER_SAVE_KEY_EXAMPLE "poker.example"
|
||||
|
||||
namespace Dawn {
|
||||
class PokerSaveManager : public SaveManager {
|
||||
protected:
|
||||
virtual bool_t validateSave(struct SaveFile raw) override;
|
||||
|
||||
public:
|
||||
PokerSaveManager(DawnGame *game);
|
||||
|
||||
void setExample(int32_t value);
|
||||
int32_t getExample();
|
||||
};
|
||||
}
|
@ -39,10 +39,6 @@ namespace Dawn {
|
||||
auto start = new VisualNovelChangeSimpleBackgroundEvent(
|
||||
vnManager, &texture->texture
|
||||
);
|
||||
|
||||
struct Locale loc;
|
||||
loc.language = "fr";
|
||||
this->game->localeManager.setLocale(loc);
|
||||
|
||||
start
|
||||
->then(new VisualNovelTextboxEvent(vnManager, "test"))
|
||||
|
Reference in New Issue
Block a user