12#ifndef ZOAPPURSCENEVIEW_H
13#define ZOAPPURSCENEVIEW_H
15#include "toymaker/sim_system.hpp"
16#include "toymaker/signals.hpp"
17#include "toymaker/text_render.hpp"
39 inline static std::string getSimObjectAspectTypeName() {
return "UrSceneView"; }
40 static std::shared_ptr<BaseSimObjectAspect> create(
const nlohmann::json& jsonAspectProperties);
41 std::shared_ptr<BaseSimObjectAspect>
clone()
const override;
49 LAUNCH_POSITION_SELECTION,
53 std::map<PieceIdentity, std::string> mPieceModelMap {};
54 std::map<PieceIdentity, std::shared_ptr<ToyMaker::SceneNode>> mPieceNodeMap {};
55 std::weak_ptr<ToyMaker::SimObject> mGameOfUrController {};
56 std::weak_ptr<ToyMaker::SimObject> mGameOfUrBoard {};
57 std::priority_queue<UrPieceAnimationKey> mAnimationKeys {};
58 uint32_t mAnimationTimeMillis {};
60 std::string mControllerPath {};
61 Mode mMode { Mode::GENERAL };
64 void onControllerReady();
66 void onBoardClicked(glm::u8vec2 boardLocation);
68 void onLaunchPieceCanceled();
71 void onViewUpdateStarted();
72 void onControlInterface(
PlayerID player);
79 *
this,
"BoardClickedObserved",
80 [
this](glm::u8vec2 boardLocation) { this->onBoardClicked(boardLocation); }
83 *
this,
"LaunchPieceInitiatedObserved",
84 [
this](
PieceTypeID pieceType) { this->onLaunchPieceInitiated(pieceType); }
87 *
this,
"LaunchPieceCanceledObserved",
88 [
this]() { this->onLaunchPieceCanceled(); }
91 *
this,
"MoveMadeObserved",
92 [
this](
const MoveResultData& moveResultData) { this->onMoveMade(moveResultData); }
95 *
this,
"ControlInterfaceObserved",
96 [
this](
PlayerID playerID) { this->onControlInterface(playerID); }
100 *
this,
"LaunchPieceAttempted"
103 *
this,
"MovePieceAttempted"
107 *
this,
"ControllerReadyObserved",
108 [
this]() {this->onControllerReady();}
113 *
this,
"ViewUpdateStartedObserved",
114 [
this](){ this->onViewUpdateStarted(); }
117 *
this,
"ViewUpdateCompleted"
126 bool mRemove {
false };
The class containing the interface to the data model for the whole game (Game of Ur).
Contains the class responsible for mapping locations on the 3D game board model to their equivalent c...
The aspect responsible for mapping points on the 3D game board to their equivalent coordinates on the...
Definition board_locations.hpp:26
The data model representing one instance of Game of Ur.
Definition model.hpp:337
A SignalObserver object, which can subscribe to Signals matching its data signature and receive signa...
Definition signals.hpp:412
A Signal object, designed to emit signals matching some data signature to be received by all the Sign...
Definition signals.hpp:323
An object containing closely related methods and data, and exposing object lifecycle and application ...
Definition sim_system.hpp:956
std::shared_ptr< BaseSimObjectAspect > clone() const override
A method which must be overridden to specify how a new aspect should be constructed as a copy of this...
Definition ur_scene_view.cpp:18
void variableUpdate(uint32_t variableStepMillis) override
Overriding this allows an aspect to respond to variable updates.
Definition ur_scene_view.cpp:239
void onActivated() override
Callback for when the aspect is activated (after it is attached to an active SimObject,...
Definition ur_scene_view.cpp:49
PieceTypeID
Enum listing the different types of pieces present in the game.
Definition piece_type_id.hpp:22
PlayerID
The two players playing the game, as known to GameOfUrModel.
Definition model.hpp:40
Data returned by the GameOfUrModel when making a move, or querying possible moves.
Definition model.hpp:278
Data uniquely identifying a piece used in the game.
Definition piece.hpp:29
A component representing the position, rotation, and scale of an entity.
Definition scene_components.hpp:30
Definition ur_scene_view.hpp:122