Added basic prefabs finally

This commit is contained in:
2023-01-03 16:44:16 -08:00
parent 562e6644ef
commit 659ab3d760
29 changed files with 193 additions and 108 deletions

View File

@ -24,7 +24,8 @@ add_subdirectory(save)
add_subdirectory(scenes)
# Assets
tool_language(language_en locale/en.csv)
set(DIR_GAME_ASSETS games/pokergame)
tool_language(language_en ${DIR_GAME_ASSETS}/locale/en.csv)
tool_texture(texture_test texture_test.png)
tool_texture(texture_city_day borrowed/city_day.png)
tool_texture(texture_city_night borrowed/city_night.png)

View File

@ -5,6 +5,7 @@
#include "DawnGame.hpp"
#include "scenes/Scene_1_1.hpp"
#include "scenes/PrefabTestingScene.hpp"
using namespace Dawn;
@ -22,7 +23,7 @@ int32_t DawnGame::init() {
this->localeManager.init();
this->renderManager.init();
this->scene = new Scene_1_1(this);
this->scene = new PrefabTestingScene(this);
return DAWN_GAME_INIT_RESULT_SUCCESS;
}

View File

@ -6,6 +6,5 @@
# Sources
target_sources(${DAWN_TARGET_NAME}
PRIVATE
SimpleVNScene.cpp
PokerVNScene.cpp
)

View File

@ -13,15 +13,13 @@ PokerVNScene::PokerVNScene(DawnGame *game) : SimpleVNScene(game) {
std::vector<Asset*> PokerVNScene::getRequiredAssets() {
auto assMan = &this->game->assetManager;
std::vector<Asset*> assets;
vectorAppend(&assets, &SimpleVNScene::getRequiredAssets());
vectorAppend(&assets, &PokerPlayerDisplay::getAssets(assMan));
std::vector<Asset*> assets, l;
vectorAppend(&assets, &(l = SimpleVNScene::getRequiredAssets()));
vectorAppend(&assets, &(l = PokerPlayerDisplay::getAssets(assMan)));
return assets;
}
void PokerVNScene::vnStage() {
SimpleVNScene::vnStage();
auto pokerGameItem = this->createSceneItem();
this->pokerGame = pokerGameItem->addComponent<PokerGame>();

View File

@ -4,7 +4,7 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "SimpleVNScene.hpp"
#include "visualnovel/scene/SimpleVNScene.hpp"
#include "poker/PokerGame.hpp"
#include "visualnovel/events/PokerBetLoopEvent.hpp"
#include "visualnovel/events/PokerInitialEvent.hpp"

View File

@ -0,0 +1,32 @@
// 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 "game/DawnGame.hpp"
#include "prefabs/display/SimpleCubePrefab.hpp"
namespace Dawn {
class PrefabTestingScene : public Scene {
protected:
SimpleCubePrefab *cube = nullptr;
Camera *camera = nullptr;
public:
PrefabTestingScene(DawnGame *game) : Scene(game) {
}
std::vector<Asset*> getRequiredAssets() override {
return std::vector<Asset*>();
}
void stage() override {
camera = Camera::create(this);
camera->transform->lookAt(glm::vec3(5, 5, 5), glm::vec3(0, 0, 0));
cube = SimpleCubePrefab::create(this);
}
};
}

View File

@ -4,19 +4,17 @@
// https://opensource.org/licenses/MIT
#pragma once
#include "SimpleVNScene.hpp"
#include "visualnovel/scene/SimpleVNScene.hpp"
namespace Dawn {
class Scene_1_1 : 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());
std::vector<Asset*> assets = SimpleVNScene::getRequiredAssets();
return assets;
}

View File

@ -34,7 +34,7 @@ namespace Dawn {
public:
static std::vector<Asset*> getAssets(AssetManager *assMan) {
std::vector<Asset*> assets;
vectorAppend(&assets, &PokerGameBorder::getAssets(assMan));
assets = PokerGameBorder::getAssets(assMan);
assets.push_back(assMan->get<TrueTypeAsset>("truetype_ark"));
return assets;
}