Added PS Vita support
This commit is contained in:
@ -3,9 +3,6 @@
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Add Common Engine Parts
|
||||
set(DAWN_VISUAL_NOVEL true CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
||||
|
||||
# Build Project
|
||||
add_executable(${DAWN_TARGET_NAME})
|
||||
|
||||
@ -16,4 +13,5 @@ target_include_directories(${DAWN_TARGET_NAME}
|
||||
)
|
||||
|
||||
# Subdirs
|
||||
# add_subdirectory(game)
|
||||
add_subdirectory(game)
|
||||
add_subdirectory(save)
|
@ -1,6 +0,0 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
10
src/dawnhelloworld/game/CMakeLists.txt
Normal file
10
src/dawnhelloworld/game/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
# Copyright (c) 2023 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
DawnGame.cpp
|
||||
)
|
43
src/dawnhelloworld/game/DawnGame.cpp
Normal file
43
src/dawnhelloworld/game/DawnGame.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "DawnGame.hpp"
|
||||
#include "scenes/HelloWorldScene.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
DawnGame::DawnGame(DawnHost *host) :
|
||||
host(host),
|
||||
renderManager(this),
|
||||
inputManager(this),
|
||||
saveManager(this)
|
||||
{
|
||||
}
|
||||
|
||||
int32_t DawnGame::init() {
|
||||
this->assetManager.init();
|
||||
this->renderManager.init();
|
||||
|
||||
this->scene = new HelloWorldScene(this);
|
||||
|
||||
return DAWN_GAME_INIT_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DawnGame::update(float_t delta) {
|
||||
this->assetManager.update();
|
||||
this->inputManager.update();
|
||||
this->timeManager.update(delta);
|
||||
|
||||
if(this->scene != nullptr) this->scene->update();
|
||||
|
||||
this->renderManager.update();
|
||||
|
||||
return DAWN_GAME_UPDATE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
void DawnGame::sceneCutover(Scene *scene) {
|
||||
if(scene == nullptr) scene = this->scene;
|
||||
this->sceneToCutTo = scene;
|
||||
}
|
28
src/dawnhelloworld/game/DawnGame.hpp
Normal file
28
src/dawnhelloworld/game/DawnGame.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "game/_DawnGame.hpp"
|
||||
#include "save/DawnGameSaveManager.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class DawnGame : public IDawnGame {
|
||||
private:
|
||||
Scene *sceneToCutTo = nullptr;
|
||||
|
||||
public:
|
||||
DawnHost *host;
|
||||
RenderManager renderManager;
|
||||
AssetManager assetManager;
|
||||
InputManager inputManager;
|
||||
TimeManager timeManager;
|
||||
DawnGameSaveManager saveManager;
|
||||
|
||||
DawnGame(DawnHost *host);
|
||||
int32_t init() override;
|
||||
int32_t update(float_t delta) override;
|
||||
void sceneCutover(Scene *scene) override;
|
||||
};
|
||||
}
|
19
src/dawnhelloworld/input/InputBinds.hpp
Normal file
19
src/dawnhelloworld/input/InputBinds.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "input/InputManager.hpp"
|
||||
|
||||
#define INPUT_BIND(n) ((inputbind_t)n)
|
||||
|
||||
#define INPUT_BIND_ACCEPT INPUT_BIND(1)
|
||||
#define INPUT_BIND_NEGATIVE_X INPUT_BIND(2)
|
||||
#define INPUT_BIND_POSITIVE_X INPUT_BIND(3)
|
||||
#define INPUT_BIND_NEGATIVE_Y INPUT_BIND(4)
|
||||
#define INPUT_BIND_POSITIVE_Y INPUT_BIND(5)
|
||||
#define INPUT_BIND_MOUSE_X INPUT_BIND(6)
|
||||
#define INPUT_BIND_MOUSE_Y INPUT_BIND(7)
|
||||
#define INPUT_BIND_MOUSE_CLICK INPUT_BIND(8)
|
||||
#define INPUT_BIND_CANCEL INPUT_BIND(9)
|
10
src/dawnhelloworld/save/CMakeLists.txt
Normal file
10
src/dawnhelloworld/save/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
# Copyright (c) 2023 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
DawnGameSaveManager.cpp
|
||||
)
|
28
src/dawnhelloworld/save/DawnGameSaveManager.cpp
Normal file
28
src/dawnhelloworld/save/DawnGameSaveManager.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "DawnGameSaveManager.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
DawnGameSaveManager::DawnGameSaveManager(DawnGame *game) : SaveManager(game) {
|
||||
}
|
||||
|
||||
bool_t DawnGameSaveManager::validateSave(struct SaveFile raw) {
|
||||
if(!raw.has(POKER_SAVE_KEY_EXAMPLE)) return true;
|
||||
this->currentSave.copy(raw, POKER_SAVE_KEY_EXAMPLE);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DawnGameSaveManager::setExample(int32_t val) {
|
||||
savedata_t value;
|
||||
value.i32 = val;
|
||||
this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value);
|
||||
}
|
||||
|
||||
int32_t DawnGameSaveManager::getExample() {
|
||||
return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32;
|
||||
}
|
22
src/dawnhelloworld/save/DawnGameSaveManager.hpp
Normal file
22
src/dawnhelloworld/save/DawnGameSaveManager.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2023 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 DawnGameSaveManager : public SaveManager {
|
||||
protected:
|
||||
virtual bool_t validateSave(struct SaveFile raw) override;
|
||||
|
||||
public:
|
||||
DawnGameSaveManager(DawnGame *game);
|
||||
|
||||
void setExample(int32_t value);
|
||||
int32_t getExample();
|
||||
};
|
||||
}
|
33
src/dawnhelloworld/scenes/HelloWorldScene.hpp
Normal file
33
src/dawnhelloworld/scenes/HelloWorldScene.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "scene/Scene.hpp"
|
||||
#include "prefabs/SimpleSpinningCubePrefab.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class HelloWorldScene : public Scene {
|
||||
protected:
|
||||
Camera *camera;
|
||||
SimpleSpinningCubePrefab *cube;
|
||||
|
||||
void stage() override {
|
||||
camera = Camera::create(this);
|
||||
camera->transform->lookAt(glm::vec3(0, 0, 8), glm::vec3(0, 0, 0));
|
||||
|
||||
cube = SimpleSpinningCubePrefab::create(this);
|
||||
}
|
||||
|
||||
std::vector<Asset*> getRequiredAssets() override {
|
||||
auto assMan = &this->game->assetManager;
|
||||
std::vector<Asset*> assets;
|
||||
vectorAppend(&assets, SimpleSpinningCubePrefab::getRequiredAssets(assMan));
|
||||
return assets;
|
||||
}
|
||||
|
||||
public:
|
||||
HelloWorldScene(DawnGame *game) : Scene(game) {}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user