Example Poker VN Scene

This commit is contained in:
2022-12-14 08:35:50 -08:00
parent 6404f35b1c
commit 2f48f61e9a
9 changed files with 140 additions and 45 deletions

View File

@ -0,0 +1,40 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "PokerVNScene.hpp"
using namespace Dawn;
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));
return assets;
}
void PokerVNScene::vnStage() {
SimpleVNScene::vnStage();
auto pokerGameItem = this->createSceneItem();
this->pokerGame = pokerGameItem->addComponent<PokerGame>();
this->pokerPlayers = this->getPokerPlayers();
auto it = this->pokerPlayers.begin();
int32_t i = 0;
while(it != this->pokerPlayers.end()) {
auto player = *it;
auto uiPlayer = canvas->addElement<PokerPlayerDisplay>();
uiPlayer->setTransform(UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, glm::vec4(i * 220, 0, 220, 200), 0);
uiPlayer->setPlayer(player);
++it;
++i;
}
}