Just making tiny improvements to things.
This commit is contained in:
@ -6,9 +6,9 @@
|
||||
# Check for build target, or default
|
||||
if(NOT DEFINED DAWN_BUILD_TARGET)
|
||||
if(WIN32)
|
||||
set(DAWN_BUILD_TARGET "target-pokergame-win32-glfw")
|
||||
set(DAWN_BUILD_TARGET "target-platformergame-win32-glfw")
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
set(DAWN_BUILD_TARGET "target-pokergame-linux64-glfw")
|
||||
set(DAWN_BUILD_TARGET "target-platformergame-linux64-glfw")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
# Copyright (c) 2022 Dominic Masters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
set(DAWN_BUILDING dawnbarrygame CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
||||
set(DAWN_TARGET_LINUX64 true CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
||||
set(DAWN_TARGET_GLFW true CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
@ -3,6 +3,6 @@
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
set(DAWN_BUILDING dawnbarrygame CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
||||
set(DAWN_BUILDING dawnplatformergame CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
||||
set(DAWN_TARGET_WIN32 true CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
||||
set(DAWN_TARGET_GLFW true CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
@ -28,4 +28,7 @@ add_subdirectory(save)
|
||||
add_subdirectory(scene)
|
||||
add_subdirectory(time)
|
||||
add_subdirectory(ui)
|
||||
add_subdirectory(visualnovel)
|
||||
|
||||
if(DAWN_VISUAL_NOVEL)
|
||||
add_subdirectory(visualnovel)
|
||||
endif()
|
@ -96,6 +96,19 @@ namespace Dawn {
|
||||
}
|
||||
}
|
||||
|
||||
float_t getAxis(inputbind_t negative, inputbind_t positive) {
|
||||
return -getValue(negative) + getValue(positive);
|
||||
}
|
||||
|
||||
glm::vec2 getAxis2D(
|
||||
inputbind_t negativeX,
|
||||
inputbind_t positiveX,
|
||||
inputbind_t negativeY,
|
||||
inputbind_t positiveY
|
||||
) {
|
||||
return glm::vec2(getAxis(negativeX, positiveX), getAxis(negativeY, positiveY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given bind is currently being pressed (a non-zero
|
||||
* value).
|
||||
|
@ -15,4 +15,6 @@ target_sources(${DAWN_TARGET_NAME}
|
||||
)
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(visualnovel)
|
||||
if(DAWN_VISUAL_NOVEL)
|
||||
add_subdirectory(visualnovel)
|
||||
endif()
|
@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
#include "asset/AssetManager.hpp"
|
||||
#include "scene/Scene.hpp"
|
||||
#include "util/array.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
template<class T, typename J, class P = T>
|
||||
|
@ -11,7 +11,7 @@ namespace Dawn {
|
||||
template<class T>
|
||||
class SceneItemPrefab :
|
||||
public SceneItem,
|
||||
public Prefab<T, Scene>
|
||||
public Prefab<T, Scene, T>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "scene/components/display/MeshHost.hpp"
|
||||
#include "scene/components/display/MeshRenderer.hpp"
|
||||
#include "scene/components/display/Material.hpp"
|
||||
#include "scene/components/display/PixelPerfectCamera.hpp"
|
||||
#include "scene/components/display/TiledSprite.hpp"
|
||||
|
||||
#include "scene/components/example/ExampleSpin.hpp"
|
||||
|
@ -11,5 +11,6 @@ target_sources(${DAWN_TARGET_NAME}
|
||||
Material.cpp
|
||||
MeshHost.cpp
|
||||
MeshRenderer.cpp
|
||||
PixelPerfectCamera.cpp
|
||||
TiledSprite.cpp
|
||||
)
|
64
src/dawn/scene/components/display/PixelPerfectCamera.cpp
Normal file
64
src/dawn/scene/components/display/PixelPerfectCamera.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "PixelPerfectCamera.hpp"
|
||||
#include "game/DawnGame.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
PixelPerfectCamera::PixelPerfectCamera(SceneItem *i) : SceneItemComponent(i) {
|
||||
|
||||
}
|
||||
|
||||
std::vector<SceneItemComponent*> PixelPerfectCamera::getDependencies() {
|
||||
return std::vector<SceneItemComponent*>{
|
||||
(this->camera = this->item->getComponent<Camera>())
|
||||
};
|
||||
}
|
||||
|
||||
void PixelPerfectCamera::onRenderTargetResized(
|
||||
RenderTarget *t, float_t w, float_t h
|
||||
) {
|
||||
this->updateDimensions();
|
||||
}
|
||||
|
||||
void PixelPerfectCamera::updateDimensions() {
|
||||
float_t w, h;
|
||||
assertNotNull(this->camera);
|
||||
|
||||
auto target = this->camera->getRenderTarget();
|
||||
switch(this->camera->type) {
|
||||
case CAMERA_TYPE_ORTHONOGRAPHIC:
|
||||
w = target->getWidth() / 2.0f / this->scale;
|
||||
h = target->getHeight() / 2.0f / this->scale;
|
||||
camera->orthoLeft = -w;
|
||||
camera->orthoRight = w;
|
||||
camera->orthoTop = h;
|
||||
camera->orthoBottom = -h;
|
||||
camera->updateProjection();
|
||||
break;
|
||||
|
||||
case CAMERA_TYPE_PERSPECTIVE:
|
||||
assertDeprecated();
|
||||
break;
|
||||
|
||||
default:
|
||||
assertUnreachable();
|
||||
}
|
||||
}
|
||||
|
||||
void PixelPerfectCamera::onStart() {
|
||||
assertNotNull(this->camera);
|
||||
this->updateDimensions();
|
||||
camera->getRenderTarget()->eventRenderTargetResized
|
||||
.addListener(this, &PixelPerfectCamera::onRenderTargetResized)
|
||||
;
|
||||
}
|
||||
|
||||
PixelPerfectCamera::~PixelPerfectCamera() {
|
||||
camera->getRenderTarget()->eventRenderTargetResized
|
||||
.removeListener(this, &PixelPerfectCamera::onRenderTargetResized)
|
||||
;
|
||||
}
|
36
src/dawn/scene/components/display/PixelPerfectCamera.hpp
Normal file
36
src/dawn/scene/components/display/PixelPerfectCamera.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "Camera.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class PixelPerfectCamera : public SceneItemComponent {
|
||||
protected:
|
||||
Camera *camera = nullptr;
|
||||
/** Event for when the render target is resized. */
|
||||
void onRenderTargetResized(RenderTarget *target, float_t w, float_t h);
|
||||
|
||||
/**
|
||||
* Updates the underlying camera's projection information.
|
||||
*/
|
||||
void updateDimensions();
|
||||
|
||||
public:
|
||||
float_t scale = 4.0f;
|
||||
|
||||
/**
|
||||
* Create a new PixelPerfectCamera Component.
|
||||
*
|
||||
* @param item Item that this component belongs to.
|
||||
*/
|
||||
PixelPerfectCamera(SceneItem *item);
|
||||
|
||||
std::vector<SceneItemComponent*> getDependencies() override;
|
||||
void onStart() override;
|
||||
|
||||
~PixelPerfectCamera();
|
||||
};
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "SimpleVNScene.hpp"
|
||||
#include "prefabs/ui/VisualNovelTextboxPrefab.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "visualnovel/events/VisualNovelPauseEvent.hpp"
|
||||
#include "visualnovel/events/VisualNovelFadeEvent.hpp"
|
||||
#include "visualnovel/events/VisualNovelChangeSimpleBackgroundEvent.hpp"
|
||||
#include "prefabs/ui/VisualNovelTextboxPrefab.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class SimpleVNScene : public Scene {
|
||||
|
@ -1,9 +0,0 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "input/InputManager.hpp"
|
||||
|
||||
#define INPUT_BIND_ACCEPT ((inputbind_t)1)
|
@ -1,38 +0,0 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "scene/Prefab.hpp"
|
||||
#include "ui/UIBorder.hpp"
|
||||
#include "asset/assets/TextureAsset.hpp"
|
||||
#include "game/DawnGame.hpp"
|
||||
|
||||
#define UI_BORDER_TEXTURE_ASSET "texture_test"
|
||||
|
||||
namespace Dawn {
|
||||
class UIBorderPrefab : public UIPrefab<UIBorder> {
|
||||
protected:
|
||||
static std::vector<Asset*> getAssets(AssetManager *man) override {
|
||||
return std::vector<Asset*>{
|
||||
man->get<TextureAsset>(UI_BORDER_TEXTURE_ASSET)
|
||||
};
|
||||
}
|
||||
|
||||
static SceneItem * uiCreate(UICanvas *canvas) override {
|
||||
auto border = canvas->addElement<UIBorder>();
|
||||
UIPrefab::uiApply(border);
|
||||
return border;
|
||||
}
|
||||
|
||||
public:
|
||||
void uiApply(UIBorder *border) {
|
||||
border->texture = &border
|
||||
->getGame()
|
||||
->assetManager.get<TextureAsset>(UI_BORDER_TEXTURE_ASSET)->texture
|
||||
;
|
||||
border->setBorderSize(glm::vec2(16, 16));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "prefabs/UIBorderPrefab.hpp"
|
||||
#include "visualnovel/ui/VisualNovelTextbox.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class VisualNovelTextboxPrefab : public UIPrefab<VisualNovelTextbox> {
|
||||
public:
|
||||
static std::vector<Asset*> prefabAssets(AssetManager *man) {
|
||||
std::vector<Asset*> assets{
|
||||
man->get<TrueTypeAsset>("truetype_ark")
|
||||
};
|
||||
vectorAppend(&assets, &UIBorderPrefab::getAssets(man));
|
||||
return assets;
|
||||
}
|
||||
|
||||
static void prefabUIApply(VisualNovelTextbox *textbox) override {
|
||||
assertNotNull(textbox);
|
||||
|
||||
auto assetFont = textbox->getGame()->assetManager.get<TrueTypeAsset>("truetype_ark");
|
||||
UIBorderPrefab::uiApply(&textbox->border);
|
||||
textbox->setFont(&assetFont->font);
|
||||
textbox->setFontSize(40);
|
||||
textbox->setLabelPadding(glm::vec2(10, 8));
|
||||
textbox->setTransform(
|
||||
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END,
|
||||
glm::vec4(0, 238, 0, 0),
|
||||
0.0f
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "visualnovel/scene/SimpleVNScene.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class TestScene : public SimpleVNScene {
|
||||
protected:
|
||||
void vnStage() override {
|
||||
SimpleVNScene::vnStage();
|
||||
}
|
||||
|
||||
std::vector<Asset*> getRequiredAssets() override {
|
||||
auto assMan = &this->game->assetManager;
|
||||
std::vector<Asset*> assets;
|
||||
vectorAppend(&assets, &SimpleVNScene::getRequiredAssets());
|
||||
return assets;
|
||||
}
|
||||
|
||||
IVisualNovelEvent * getVNEvent() override {
|
||||
return nullptr;
|
||||
// auto start = new VisualNovelTextboxEvent(vnManager,nullptr,"scene.1.1");
|
||||
// return start;
|
||||
}
|
||||
|
||||
public:
|
||||
TestScene(DawnGame *game) : SimpleVNScene(game) {}
|
||||
};
|
||||
}
|
@ -60,6 +60,10 @@ int32_t DawnHost::init(DawnGame *game) {
|
||||
game->inputManager.bind(INPUT_BIND_ACCEPT, GLFW_KEY_ENTER);
|
||||
game->inputManager.bind(INPUT_BIND_ACCEPT, GLFW_KEY_E);
|
||||
game->inputManager.bind(INPUT_BIND_ACCEPT, GLFW_KEY_SPACE);
|
||||
game->inputManager.bind(INPUT_BIND_NEGATIVE_X, GLFW_KEY_A);
|
||||
game->inputManager.bind(INPUT_BIND_POSITIVE_X, GLFW_KEY_D);
|
||||
game->inputManager.bind(INPUT_BIND_NEGATIVE_Y, GLFW_KEY_S);
|
||||
game->inputManager.bind(INPUT_BIND_POSITIVE_Y, GLFW_KEY_W);
|
||||
|
||||
// Initialize the game
|
||||
auto result = game->init();
|
||||
|
@ -4,7 +4,7 @@
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
# Set up the executable
|
||||
set(DAWN_TARGET_NAME "BarryGame" CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
||||
set(DAWN_TARGET_NAME "PlatformerGame" CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
||||
|
||||
# Build Project
|
||||
add_executable(${DAWN_TARGET_NAME})
|
||||
@ -16,22 +16,18 @@ target_include_directories(${DAWN_TARGET_NAME}
|
||||
)
|
||||
|
||||
# Subdirs
|
||||
add_subdirectory(components)
|
||||
add_subdirectory(game)
|
||||
add_subdirectory(save)
|
||||
|
||||
# Assets
|
||||
tool_language(language_en games/barrygame/locale/en.csv)
|
||||
set(DIR_GAME_ASSETS games/platformergame)
|
||||
tool_language(language_en ${DIR_GAME_ASSETS}/locale/en.csv)
|
||||
tool_texture(texture_test texture_test.png)
|
||||
tool_truetype(truetype_ark
|
||||
ark-pixel.ttf
|
||||
truetype_ark
|
||||
96
|
||||
96
|
||||
10
|
||||
)
|
||||
tool_tileset(tileset_aqua texture_aqua ${DIR_GAME_ASSETS}/tileset/s4m_ur4i_minivania_tilemap_aqua.png 32 32)
|
||||
|
||||
add_dependencies(${DAWN_TARGET_NAME}
|
||||
language_en
|
||||
texture_test
|
||||
truetype_ark
|
||||
tileset_aqua
|
||||
)
|
10
src/dawnplatformergame/components/CMakeLists.txt
Normal file
10
src/dawnplatformergame/components/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
|
||||
PlayerController.cpp
|
||||
)
|
35
src/dawnplatformergame/components/PlayerController.cpp
Normal file
35
src/dawnplatformergame/components/PlayerController.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "PlayerController.hpp"
|
||||
#include "game/DawnGame.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
PlayerController::PlayerController(SceneItem *i) : SceneItemComponent(i) {}
|
||||
|
||||
void PlayerController::onSceneUpdate() {
|
||||
auto im = &getGame()->inputManager;
|
||||
auto delta = getGame()->timeManager.delta;
|
||||
|
||||
glm::vec2 iMove = im->getAxis2D(
|
||||
INPUT_BIND_NEGATIVE_X, INPUT_BIND_POSITIVE_X,
|
||||
INPUT_BIND_NEGATIVE_Y, INPUT_BIND_POSITIVE_Y
|
||||
);
|
||||
|
||||
glm::vec2 pos = this->transform->getLocalPosition();
|
||||
this->transform->setLocalPosition(
|
||||
this->transform->getLocalPosition() + glm::vec3(iMove * delta * 20.0f, 0)
|
||||
);
|
||||
}
|
||||
|
||||
void PlayerController::onStart() {
|
||||
assertNotNull(this->camera);
|
||||
getScene()->eventSceneUnpausedUpdate.addListener(this, &PlayerController::onSceneUpdate);
|
||||
}
|
||||
|
||||
PlayerController::~PlayerController() {
|
||||
getScene()->eventSceneUnpausedUpdate.removeListener(this, &PlayerController::onSceneUpdate);
|
||||
}
|
23
src/dawnplatformergame/components/PlayerController.hpp
Normal file
23
src/dawnplatformergame/components/PlayerController.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "scene/components/Components.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class PlayerController : public SceneItemComponent {
|
||||
protected:
|
||||
void onSceneUpdate();
|
||||
|
||||
public:
|
||||
Camera *camera = nullptr;
|
||||
|
||||
PlayerController(SceneItem *item);
|
||||
|
||||
void onStart() override;
|
||||
|
||||
~PlayerController();
|
||||
};
|
||||
}
|
@ -8,9 +8,6 @@
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
TrueTypeAsset *assetFont;
|
||||
TextureAsset *assetTexture;
|
||||
|
||||
DawnGame::DawnGame(DawnHost *host) :
|
||||
host(host),
|
||||
renderManager(this),
|
@ -6,7 +6,7 @@
|
||||
#pragma once
|
||||
#include "game/_DawnGame.hpp"
|
||||
#include "scene/components/Components.hpp"
|
||||
#include "save/BarrySaveManager.hpp"
|
||||
#include "save/DawnGameSaveManager.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class DawnGame : public IDawnGame {
|
||||
@ -17,7 +17,7 @@ namespace Dawn {
|
||||
InputManager inputManager;
|
||||
TimeManager timeManager;
|
||||
LocaleManager localeManager;
|
||||
BarrySaveManager saveManager;
|
||||
DawnGameSaveManager saveManager;
|
||||
|
||||
DawnGame(DawnHost *host);
|
||||
int32_t init() override;
|
14
src/dawnplatformergame/input/InputBinds.hpp
Normal file
14
src/dawnplatformergame/input/InputBinds.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2022 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)
|
46
src/dawnplatformergame/prefabs/PlayerPrefab.hpp
Normal file
46
src/dawnplatformergame/prefabs/PlayerPrefab.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "prefab/SceneItemPrefab.hpp"
|
||||
#include "scene/components/Components.hpp"
|
||||
#include "components/PlayerController.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class PlayerPrefab : public SceneItemPrefab<PlayerPrefab> {
|
||||
public:
|
||||
static std::vector<Asset*> prefabAssets(AssetManager *man) {
|
||||
std::vector<Asset*> assets;
|
||||
assets.push_back(man->get<TilesetAsset>("tileset_aqua"));
|
||||
assets.push_back(man->get<TextureAsset>("texture_aqua"));
|
||||
return assets;
|
||||
}
|
||||
|
||||
//
|
||||
MeshHost *meshHost;
|
||||
TiledSprite *tiledSprite;
|
||||
Material *material;
|
||||
MeshRenderer *meshRenderer;
|
||||
PlayerController *playerController;
|
||||
|
||||
PlayerPrefab(Scene *s, sceneitemid_t i) : SceneItemPrefab(s, i) {}
|
||||
|
||||
void prefabInit(AssetManager *man) override {
|
||||
auto tileset = man->get<TilesetAsset>("tileset_aqua");
|
||||
auto texture = man->get<TextureAsset>("texture_aqua");
|
||||
|
||||
meshHost = addComponent<MeshHost>();
|
||||
tiledSprite = addComponent<TiledSprite>();
|
||||
material = addComponent<Material>();
|
||||
meshRenderer = addComponent<MeshRenderer>();
|
||||
playerController = addComponent<PlayerController>();
|
||||
|
||||
tiledSprite->setTilesetAndSize(&tileset->tileset);
|
||||
tiledSprite->setTile(896);
|
||||
|
||||
material->textureValues[material->getShader()->getParameterByName("u_Text")] = &texture->texture;
|
||||
}
|
||||
};
|
||||
}
|
@ -6,5 +6,5 @@
|
||||
# Sources
|
||||
target_sources(${DAWN_TARGET_NAME}
|
||||
PRIVATE
|
||||
BarrySaveManager.cpp
|
||||
DawnGameSaveManager.cpp
|
||||
)
|
@ -3,26 +3,26 @@
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "BarrySaveManager.hpp"
|
||||
#include "DawnGameSaveManager.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
BarrySaveManager::BarrySaveManager(DawnGame *game) : SaveManager(game) {
|
||||
DawnGameSaveManager::DawnGameSaveManager(DawnGame *game) : SaveManager(game) {
|
||||
}
|
||||
|
||||
bool_t BarrySaveManager::validateSave(struct SaveFile raw) {
|
||||
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 BarrySaveManager::setExample(int32_t val) {
|
||||
void DawnGameSaveManager::setExample(int32_t val) {
|
||||
savedata_t value;
|
||||
value.i32 = val;
|
||||
this->currentSave.set(POKER_SAVE_KEY_EXAMPLE, value);
|
||||
}
|
||||
|
||||
int32_t BarrySaveManager::getExample() {
|
||||
int32_t DawnGameSaveManager::getExample() {
|
||||
return this->currentSave.get(POKER_SAVE_KEY_EXAMPLE).i32;
|
||||
}
|
@ -9,12 +9,12 @@
|
||||
#define POKER_SAVE_KEY_EXAMPLE "poker.example"
|
||||
|
||||
namespace Dawn {
|
||||
class BarrySaveManager : public SaveManager {
|
||||
class DawnGameSaveManager : public SaveManager {
|
||||
protected:
|
||||
virtual bool_t validateSave(struct SaveFile raw) override;
|
||||
|
||||
public:
|
||||
BarrySaveManager(DawnGame *game);
|
||||
DawnGameSaveManager(DawnGame *game);
|
||||
|
||||
void setExample(int32_t value);
|
||||
int32_t getExample();
|
33
src/dawnplatformergame/scenes/TestScene.hpp
Normal file
33
src/dawnplatformergame/scenes/TestScene.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2022 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "scene/Scene.hpp"
|
||||
#include "prefabs/PlayerPrefab.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class TestScene : public Scene {
|
||||
protected:
|
||||
void stage() override {
|
||||
auto camera = Camera::create(this);
|
||||
camera->type = CAMERA_TYPE_ORTHONOGRAPHIC;
|
||||
camera->item->addComponent<PixelPerfectCamera>();
|
||||
camera->transform->lookAt(glm::vec3(0, 0, 10), glm::vec3(0, 0, 0));
|
||||
|
||||
auto player = PlayerPrefab::create(this);
|
||||
player->playerController->camera = camera;
|
||||
}
|
||||
|
||||
std::vector<Asset*> getRequiredAssets() override {
|
||||
auto assMan = &this->game->assetManager;
|
||||
std::vector<Asset*> assets;
|
||||
vectorAppend(&assets, PlayerPrefab::getRequiredAssets(assMan));
|
||||
return assets;
|
||||
}
|
||||
|
||||
public:
|
||||
TestScene(DawnGame *game) : Scene(game) {}
|
||||
};
|
||||
}
|
@ -6,6 +6,9 @@
|
||||
# Set up the executable
|
||||
set(DAWN_TARGET_NAME "PokerGame" CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
||||
|
||||
# Add Common Engine Parts
|
||||
set(DAWN_VISUAL_NOVEL true CACHE INTERNAL ${DAWN_CACHE_TARGET})
|
||||
|
||||
# Build Project
|
||||
add_executable(${DAWN_TARGET_NAME})
|
||||
|
||||
|
Reference in New Issue
Block a user