Dawn/src/dawnpokergame/scenes/TestScene.hpp
2022-12-01 22:37:42 -08:00

70 lines
2.3 KiB
C++

// 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 "util/array.hpp"
#include "scene/components/Components.hpp"
#include "ui/PokerGameTextbox.hpp"
#include "visualnovel/VisualNovelManager.hpp"
#include "visualnovel/events/VisualNovelTextboxEvent.hpp"
#include "poker/PokerGame.hpp"
#include "visualnovel/events/PokerBetLoopEvent.hpp"
#include "visualnovel/events/PokerInitialEvent.hpp"
#include "visualnovel/events/SimpleLoopEvent.hpp"
#include "ui/PokerPlayerDisplay.hpp"
namespace Dawn {
class TestScene : public Scene {
public:
TestScene(DawnGame *game) : Scene(game) {
}
std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager;
std::vector<Asset*> assets;
vectorAppend(&assets, &PokerGameTextbox::getAssets(assMan));
return assets;
}
void stage() override {
// Camera
auto camera = Camera::create(this);
camera->transform->lookAt(glm::vec3(50, 50, 50), glm::vec3(0, 0, 0));
// UI
auto canvas = UICanvas::createCanvas(this);
auto textbox = PokerGameTextbox::create(canvas);
// VN Manager
auto vnManagerItem = this->createSceneItem();
auto vnManager = vnManagerItem->addComponent<VisualNovelManager>();
// Poker Test
auto pokerGameItem = this->createSceneItem();
auto pokerGame = pokerGameItem->addComponent<PokerGame>();
for(int32_t i = 0; i < 4; i++) {
auto pokerPlayerInstance = this->createSceneItem();
auto pokerPlayer = pokerPlayerInstance->addComponent<PokerPlayer>();
auto uiPlayer = canvas->addElement<PokerPlayerDisplay>();
uiPlayer->setTransform(UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_STRETCH, glm::vec4(0, 0, 0, 0), 0);
uiPlayer->setPlayer(pokerPlayer);
}
auto betting = vnManager
->setEvent(new VisualNovelTextboxEvent(vnManager, "Starting Game"))
->then(new PokerNewGameEvent(vnManager))
->then(new VisualNovelTextboxEvent(vnManager, "Game Started"))
->then(new PokerInitialEvent(vnManager))
;
}
};
}