|
|
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
// Copyright (c) 2023 Dominic Masters
|
|
|
|
|
//
|
|
|
|
|
// This software is released under the MIT License.
|
|
|
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
|
|
|
|
|
|
#include "scenes/SceneList.hpp"
|
|
|
|
|
#include "component/display/Camera.hpp"
|
|
|
|
|
#include "prefab/SimpleSpinningCube.hpp"
|
|
|
|
|
#include "component/display/material/SimpleTexturedMaterial.hpp"
|
|
|
|
|
#include "display/mesh/CubeMesh.hpp"
|
|
|
|
|
|
|
|
|
|
#include "component/ui/UICanvas.hpp"
|
|
|
|
|
#include "ui/elements/UIRectangle.hpp"
|
|
|
|
|
#include "ui/elements/UILabel.hpp"
|
|
|
|
|
#include "ui/UIMenu.hpp"
|
|
|
|
|
#include "ui/container/UIRowContainer.hpp"
|
|
|
|
|
#include "ui/container/UIPaddingContainer.hpp"
|
|
|
|
|
|
|
|
|
|
#include "poker/PokerGame.hpp"
|
|
|
|
|
|
|
|
|
|
using namespace Dawn;
|
|
|
|
|
|
|
|
|
|
void Dawn::testScene(Scene &s) {
|
|
|
|
|
auto cameraItem = s.createSceneItem();
|
|
|
|
|
auto camera = cameraItem->addComponent<Camera>();
|
|
|
|
|
cameraItem->lookAt({ 3, 3, 3 }, { 0, 0, 0 }, { 0, 1, 0 });
|
|
|
|
|
camera->clipFar = 99999.99f;
|
|
|
|
|
|
|
|
|
|
auto cube = s.createSceneItem();
|
|
|
|
|
auto cubeMesh = std::make_shared<Mesh>();
|
|
|
|
|
auto cubeRenderer = cube->addComponent<MeshRenderer>();
|
|
|
|
|
auto cubeMaterial = cube->addComponent<SimpleTexturedMaterial>();
|
|
|
|
|
|
|
|
|
|
cubeRenderer->mesh = cubeMesh;
|
|
|
|
|
cubeMesh->createBuffers(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT);
|
|
|
|
|
CubeMesh::buffer(cubeMesh, glm::vec3(0,0,0), glm::vec3(1, 1, 1), 0, 0);
|
|
|
|
|
|
|
|
|
|
auto canvasItem = s.createSceneItem();
|
|
|
|
|
auto canvas = canvasItem->addComponent<UICanvas>();
|
|
|
|
|
|
|
|
|
|
auto container = std::make_shared<UIContainer>();
|
|
|
|
|
container->align = { 32, 32, UI_ALIGN_SIZE_AUTO, UI_ALIGN_SIZE_AUTO };
|
|
|
|
|
container->alignX = UIAlignmentType::START;
|
|
|
|
|
container->alignY = UIAlignmentType::START;
|
|
|
|
|
canvas->addElement(container);
|
|
|
|
|
|
|
|
|
|
auto rect = std::make_shared<UIRectangle>();
|
|
|
|
|
rect->align = { 0, 0, 32, 32 };
|
|
|
|
|
rect->alignX = UIAlignmentType::START;
|
|
|
|
|
rect->alignY = UIAlignmentType::START;
|
|
|
|
|
rect->color = COLOR_MAGENTA;
|
|
|
|
|
container->appendChild(rect);
|
|
|
|
|
|
|
|
|
|
auto texture = s.getGame()->assetManager.get<TrueTypeTexture>("font_silver", 128);
|
|
|
|
|
while(!s.getGame()->assetManager.isEverythingLoaded()) {
|
|
|
|
|
s.getGame()->assetManager.update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto label = std::make_shared<UILabel>();
|
|
|
|
|
label->align = { 0, 0, UI_ALIGN_SIZE_AUTO, UI_ALIGN_SIZE_AUTO };
|
|
|
|
|
label->alignX = UIAlignmentType::START;
|
|
|
|
|
label->alignY = UIAlignmentType::START;
|
|
|
|
|
label->setFont(texture);
|
|
|
|
|
label->setText(L"Hello World!");
|
|
|
|
|
container->appendChild(label);
|
|
|
|
|
|
|
|
|
|
// auto game = std::make_shared<PokerGame>();
|
|
|
|
|
// auto player0 = game->addNewPlayer();
|
|
|
|
|
// auto player1 = game->addNewPlayer();
|
|
|
|
|
// auto player2 = game->addNewPlayer();
|
|
|
|
|
// auto player3 = game->addNewPlayer();
|
|
|
|
|
// game->newGame();
|
|
|
|
|
// game->takeBlinds();
|
|
|
|
|
// game->dealToEveryone(2);
|
|
|
|
|
|
|
|
|
|
// std::shared_ptr<PokerPlayer> player;
|
|
|
|
|
// while((player = game->getCurrentBetter()) != nullptr) {
|
|
|
|
|
// auto turn = player->getAITurn();
|
|
|
|
|
// std::cout << "Player " << (int)player->playerIndex << " is taking turn: " << (int)turn.type << std::endl;
|
|
|
|
|
// turn.action();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// std::cout << "Reveal flop" << std::endl;
|
|
|
|
|
// game->burnCard();
|
|
|
|
|
// game->turn();
|
|
|
|
|
|
|
|
|
|
// game->newBettingRound();
|
|
|
|
|
// while((player = game->getCurrentBetter()) != nullptr) {
|
|
|
|
|
// auto turn = player->getAITurn();
|
|
|
|
|
// std::cout << "Player " << (int)player->playerIndex << " is taking turn: " << (int)turn.type << std::endl;
|
|
|
|
|
// turn.action();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// std::cout << "Reveal turn" << std::endl;
|
|
|
|
|
// game->burnCard();
|
|
|
|
|
// game->turn();
|
|
|
|
|
|
|
|
|
|
// game->newBettingRound();
|
|
|
|
|
// while((player = game->getCurrentBetter()) != nullptr) {
|
|
|
|
|
// auto turn = player->getAITurn();
|
|
|
|
|
// std::cout << "Player " << (int)player->playerIndex << " is taking turn: " << (int)turn.type << std::endl;
|
|
|
|
|
// turn.action();
|
|
|
|
|
// }
|
|
|
|
|
}
|