Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
UrSceneView Class Reference

The class responsible for managing the 3D representation and interactions of a game in progress. More...

#include <ur_scene_view.hpp>

Inheritance diagram for UrSceneView:

Public Member Functions

std::shared_ptr< BaseSimObjectAspect > clone () const override
 
const GameOfUrModelgetModel () const
 
const BoardLocationsgetBoard () const
 

Static Public Member Functions

static std::string getSimObjectAspectTypeName ()
 
static std::shared_ptr< BaseSimObjectAspect > create (const nlohmann::json &jsonAspectProperties)
 

Public Attributes

ToyMaker::SignalObserver< glm::u8vec2 > mObserveBoardClicked
 
ToyMaker::SignalObserver< PieceTypeIDmObserveLaunchPieceInitiated
 
ToyMaker::SignalObserver mObserveLaunchPieceCancelled
 
ToyMaker::SignalObserver< MoveResultDatamObserveMoveMade
 
ToyMaker::SignalObserver< PlayerIDmObserveControlInterface
 
ToyMaker::Signal< PieceTypeID, glm::u8vec2 > mSigLaunchPieceAttempted
 
ToyMaker::Signal< PieceIdentitymSigMovePieceAttempted
 
ToyMaker::SignalObserver mObserveControllerReady
 
ToyMaker::Signal< std::string > mSigViewSubscribed {*this, "ViewSubscribed"}
 
ToyMaker::SignalObserver mObserveViewUpdateStarted
 
ToyMaker::Signal< std::string > mSigViewUpdateCompleted
 

Private Types

enum class  Mode { GENERAL , LAUNCH_POSITION_SELECTION , TRANSITION }
 

Private Member Functions

void onControllerReady ()
 
void onBoardClicked (glm::u8vec2 boardLocation)
 
void onLaunchPieceInitiated (PieceTypeID piece)
 
void onLaunchPieceCanceled ()
 
void onMoveMade (const MoveResultData &moveResultData)
 
void onViewUpdateStarted ()
 
void onControlInterface (PlayerID player)
 
void onActivated () override
 
void variableUpdate (uint32_t variableStepMillis) override
 

Private Attributes

std::map< PieceIdentity, std::string > mPieceModelMap {}
 
std::map< PieceIdentity, std::shared_ptr< ToyMaker::SceneNode > > mPieceNodeMap {}
 
std::weak_ptr< ToyMaker::SimObject > mGameOfUrController {}
 
std::weak_ptr< ToyMaker::SimObject > mGameOfUrBoard {}
 
std::priority_queue< UrPieceAnimationKeymAnimationKeys {}
 
uint32_t mAnimationTimeMillis {}
 
std::string mControllerPath {}
 
Mode mMode { Mode::GENERAL }
 
PlayerID mControlledBy {}
 

Detailed Description

The class responsible for managing the 3D representation and interactions of a game in progress.

Displays the game board and adds game pieces to it per the current state of the game. The state of the game is read from the game data model (or from changes broadcasted by UrController).

Converts board or game piece clicks into actions usable by the currently active player controller. Also reports view updates (like animations that play after a game state change) to the game controller.

Member Data Documentation

◆ mObserveBoardClicked

ToyMaker::SignalObserver<glm::u8vec2> UrSceneView::mObserveBoardClicked
Initial value:
{
*this, "BoardClickedObserved",
[this](glm::u8vec2 boardLocation) { this->onBoardClicked(boardLocation); }
}

◆ mObserveControlInterface

ToyMaker::SignalObserver<PlayerID> UrSceneView::mObserveControlInterface
Initial value:
{
*this, "ControlInterfaceObserved",
[this](PlayerID playerID) { this->onControlInterface(playerID); }
}
PlayerID
The two players playing the game, as known to GameOfUrModel.
Definition model.hpp:40

◆ mObserveControllerReady

ToyMaker::SignalObserver UrSceneView::mObserveControllerReady
Initial value:
{
*this, "ControllerReadyObserved",
[this]() {this->onControllerReady();}
}

◆ mObserveLaunchPieceCancelled

ToyMaker::SignalObserver UrSceneView::mObserveLaunchPieceCancelled
Initial value:
{
*this, "LaunchPieceCanceledObserved",
[this]() { this->onLaunchPieceCanceled(); }
}

◆ mObserveLaunchPieceInitiated

ToyMaker::SignalObserver<PieceTypeID> UrSceneView::mObserveLaunchPieceInitiated
Initial value:
{
*this, "LaunchPieceInitiatedObserved",
[this](PieceTypeID pieceType) { this->onLaunchPieceInitiated(pieceType); }
}
PieceTypeID
Enum listing the different types of pieces present in the game.
Definition piece_type_id.hpp:22

◆ mObserveMoveMade

ToyMaker::SignalObserver<MoveResultData> UrSceneView::mObserveMoveMade
Initial value:
{
*this, "MoveMadeObserved",
[this](const MoveResultData& moveResultData) { this->onMoveMade(moveResultData); }
}
Data returned by the GameOfUrModel when making a move, or querying possible moves.
Definition model.hpp:278

◆ mObserveViewUpdateStarted

ToyMaker::SignalObserver UrSceneView::mObserveViewUpdateStarted
Initial value:
{
*this, "ViewUpdateStartedObserved",
[this](){ this->onViewUpdateStarted(); }
}

◆ mSigLaunchPieceAttempted

ToyMaker::Signal<PieceTypeID, glm::u8vec2> UrSceneView::mSigLaunchPieceAttempted
Initial value:
{
*this, "LaunchPieceAttempted"
}

◆ mSigMovePieceAttempted

ToyMaker::Signal<PieceIdentity> UrSceneView::mSigMovePieceAttempted
Initial value:
{
*this, "MovePieceAttempted"
}

◆ mSigViewUpdateCompleted

ToyMaker::Signal<std::string> UrSceneView::mSigViewUpdateCompleted
Initial value:
{
*this, "ViewUpdateCompleted"
}

The documentation for this class was generated from the following files: