Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
|
The class responsible for managing the 3D representation and interactions of a game in progress. More...
#include <ur_scene_view.hpp>
Public Member Functions | |
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 one. | |
const GameOfUrModel & | getModel () const |
const BoardLocations & | getBoard () const |
![]() | |
virtual | ~BaseSimObjectAspect ()=default |
Destroys this object. | |
virtual void | simulationUpdate (uint32_t simStepMillis) |
Overriding this allows an aspect to respond to simulation updates. | |
bool | handleAction (const ActionData &actionData, const ActionDefinition &actionDefinition) override final |
Pipes an action received from the InputManager via our SimObject to all that action's handler methods on this aspect. | |
ViewportNode & | getLocalViewport () |
Returns the closest ancestor viewport to this node, if one exists (which it should, since this shouldn't be called until this aspect is attached to an active SimObject). | |
![]() | |
SignalTracker () | |
Constructs a new SignalTracker object. | |
SignalTracker (const SignalTracker &other) | |
Constructs a new SignalTracker. | |
SignalTracker & | operator= (const SignalTracker &other) |
Copy assignment operator. | |
SignalTracker (SignalTracker &&other) | |
Moves resources from another SignalTracker into this one, invalidating them from the other. | |
SignalTracker & | operator= (SignalTracker &&other) |
Moves resources from another SignalTracker into this one, destroying this tracker's resources in the process. | |
void | connect (const std::string &theirSignal, const std::string &ourObserver, SignalTracker &other) |
Method that connects one of this objects SignalObservers to another tracker's Signal. | |
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< PieceTypeID > | mObserveLaunchPieceInitiated |
ToyMaker::SignalObserver | mObserveLaunchPieceCancelled |
ToyMaker::SignalObserver< MoveResultData > | mObserveMoveMade |
ToyMaker::SignalObserver< PlayerID > | mObserveControlInterface |
ToyMaker::Signal< PieceTypeID, glm::u8vec2 > | mSigLaunchPieceAttempted |
ToyMaker::Signal< PieceIdentity > | mSigMovePieceAttempted |
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 |
Callback for when the aspect is activated (after it is attached to an active SimObject, or if the SimObject it was attached to has just been activated) | |
void | variableUpdate (uint32_t variableStepMillis) override |
Overriding this allows an aspect to respond to variable updates. | |
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< UrPieceAnimationKey > | mAnimationKeys {} |
uint32_t | mAnimationTimeMillis {} |
std::string | mControllerPath {} |
Mode | mMode { Mode::GENERAL } |
PlayerID | mControlledBy {} |
Additional Inherited Members | |
![]() | |
SimObjectAspect (int explicitlyInitializeMe) | |
![]() | |
BaseSimObjectAspect (const BaseSimObjectAspect &other)=delete | |
BaseSimObjectAspect (BaseSimObjectAspect &&other)=delete | |
SimObject & | getSimObject () |
Returns the sim object that this aspect is attached to. | |
template<typename TComponent> | |
void | addComponent (const TComponent &component) |
Adds a component of some type to the underlying entity. | |
template<typename TComponent> | |
bool | hasComponent () |
Tests whether a component of some specific type is present on the object. | |
template<typename TComponent> | |
void | updateComponent (const TComponent &component) |
Updates the value of a component belonging to this object to a new one. | |
template<typename TComponent> | |
TComponent | getComponent (const float simulationProgress=1.f) const |
Gets the value of a component belonging to this object. | |
template<typename TComponent> | |
void | removeComponent () |
Removes a component of some type belonging to the underlying SimObject. | |
void | addAspect (const nlohmann::json &jsonAspectProperties) |
Adds a new aspect to the underlying SimObject constructed based on its properties in JSON. | |
void | addAspect (const BaseSimObjectAspect &aspect) |
Adds a new aspect to the underlying SimObject copied from an already existing aspect. | |
template<typename TSimObjectAspect> | |
bool | hasAspect () const |
Tests whether an aspect of a particular type is attached to the underlying SimObject. | |
bool | hasAspect (const std::string &aspectType) const |
Tests whether an aspect of a particular type is attached to the underlying SimObject. | |
template<typename TSimObjectAspect> | |
TSimObjectAspect & | getAspect () |
Gets an aspect of a particular type belonging to the underlying SimObject. | |
BaseSimObjectAspect & | getAspect (const std::string &aspectType) |
Gets (a base class reference to) an aspect of a particular type belonging to the underlying SimObject. | |
template<typename TSimObjectAspect> | |
void | removeAspect () |
Removes an aspect from the underlying SimObject. | |
void | addOrReplaceAspect (const BaseSimObjectAspect &aspect) |
Adds or replaces an aspect on the underlying SimObject with a new aspect constructed as a copy of another. | |
void | addOrReplaceAspect (const nlohmann::json &jsonAspectProperties) |
Adds or replaces an aspect on the underlying SimObject with a new aspect constructed from its JSON description. | |
std::weak_ptr< FixedActionBinding > | declareFixedActionBinding (const std::string &context, const std::string &action, std::function< bool(const ActionData &, const ActionDefinition &)>) |
Binds some method (or any function) present on this object to an action generated by the InputManager. | |
EntityID | getEntityID () const |
Gets the ID of the ECSWorld Entity belonging to our SimObject. | |
std::weak_ptr< ECSWorld > | getWorld () const |
Gets a weak reference to the ECSWorld to which our SimObject's entity belongs. | |
![]() | |
template<typename TSimObjectAspectDerived> | |
static void | registerAspect () |
Registers an implementation of an aspect with the SimSystem. | |
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.
|
overridevirtual |
A method which must be overridden to specify how a new aspect should be constructed as a copy of this one.
Implements ToyMaker::BaseSimObjectAspect.
|
overrideprivatevirtual |
Callback for when the aspect is activated (after it is attached to an active SimObject, or if the SimObject it was attached to has just been activated)
Reimplemented from ToyMaker::BaseSimObjectAspect.
|
overrideprivatevirtual |
Overriding this allows an aspect to respond to variable updates.
variableStepMillis | The time since the execution of the last frame, in milliseconds. |
Reimplemented from ToyMaker::BaseSimObjectAspect.
ToyMaker::SignalObserver<glm::u8vec2> UrSceneView::mObserveBoardClicked |
ToyMaker::SignalObserver<PlayerID> UrSceneView::mObserveControlInterface |
ToyMaker::SignalObserver UrSceneView::mObserveControllerReady |
ToyMaker::SignalObserver UrSceneView::mObserveLaunchPieceCancelled |
ToyMaker::SignalObserver<PieceTypeID> UrSceneView::mObserveLaunchPieceInitiated |
ToyMaker::SignalObserver<MoveResultData> UrSceneView::mObserveMoveMade |
ToyMaker::SignalObserver UrSceneView::mObserveViewUpdateStarted |
ToyMaker::Signal<PieceTypeID, glm::u8vec2> UrSceneView::mSigLaunchPieceAttempted |
ToyMaker::Signal<PieceIdentity> UrSceneView::mSigMovePieceAttempted |
ToyMaker::Signal<std::string> UrSceneView::mSigViewUpdateCompleted |