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
RenderDebugViewer Class Reference

A utility aspect class used to log window events and change the debug texture rendered to the viewport it manages. More...

#include <render_debug_viewer.hpp>

Inheritance diagram for RenderDebugViewer:
ToyMaker::SimObjectAspect< RenderDebugViewer > ToyMaker::BaseSimObjectAspect ToyMaker::SignalTracker ToyMaker::IActionHandler

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.
 
void printWindowProps ()
 
- Public Member Functions inherited from ToyMaker::BaseSimObjectAspect
virtual ~BaseSimObjectAspect ()=default
 Destroys this object.
 
virtual void simulationUpdate (uint32_t simStepMillis)
 Overriding this allows an aspect to respond to simulation updates.
 
virtual void variableUpdate (uint32_t variableStepMillis)
 Overriding this allows an aspect to respond to variable 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.
 
ViewportNodegetLocalViewport ()
 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).
 
- Public Member Functions inherited from ToyMaker::SignalTracker
 SignalTracker ()
 Constructs a new SignalTracker object.
 
 SignalTracker (const SignalTracker &other)
 Constructs a new SignalTracker.
 
SignalTrackeroperator= (const SignalTracker &other)
 Copy assignment operator.
 
 SignalTracker (SignalTracker &&other)
 Moves resources from another SignalTracker into this one, invalidating them from the other.
 
SignalTrackeroperator= (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 mObserveWindowResized { *this, "WindowResizedObserved", [this]() { std::cout << "RenderDebugViewer: Window was resized\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowMinimized { *this, "WindowMinimizedObserved", [this]() { std::cout << "RenderDebugViewer: Window was minimized\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowMaximized { *this, "WindowMaximizedObserved", [this]() { std::cout << "RenderDebugViewer: Window was maximized\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowMoved { *this, "WindowMovedObserved", [this]() { std::cout << "RenderDebugViewer: Window was moved\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowMouseEntered { *this, "WindowMouseEnteredObserved", [this]() { std::cout << "RenderDebugViewer: Mouse entered window\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowMouseExited { *this, "WindowMouseExitedObserved", [this]() { std::cout << "RenderDebugViewer: Mouse left window\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowCloseRequested { *this, "WindowCloseRequestedObserved", [this]() { std::cout << "RenderDebugViewer: Window close requested\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowSizeChanged { *this, "WindowSizeChangedObserved", [this]() { std::cout << "RenderDebugViewer: Window's size was changed\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowRestored { *this, "WindowRestoredObserved", [this]() { std::cout << "RenderDebugViewer: Window was restored\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowShown { *this, "WindowShownObserved", [this]() { std::cout << "RenderDebugViewer: Window was shown\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowExposed { *this, "WindowExposedObserved", [this]() { std::cout << "RenderDebugViewer: Window was exposed\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowKeyFocusGained { *this, "WindowKeyFocusGainedObserved", [this]() { std::cout << "RenderDebugViewer: Window gained key focus\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowKeyFocusLost { *this, "WindowKeyFocusLostObserved", [this]() { std::cout << "RenderDebugViewer: Window lost key focus\n"; this->printWindowProps(); } }
 
ToyMaker::SignalObserver mObserveWindowKeyFocusOffered { *this, "WindowKeyFocusOffered", [this]() { std::cout << "RenderDebugViewer: Window was offered key focus\n"; this->printWindowProps(); } }
 

Protected Member Functions

bool onUpdateGamma (const ToyMaker::ActionData &actionData, const ToyMaker::ActionDefinition &actionDefinition)
 
bool onUpdateExposure (const ToyMaker::ActionData &actionData, const ToyMaker::ActionDefinition &actionDefinition)
 
bool onRenderNextTexture (const ToyMaker::ActionData &actionData, const ToyMaker::ActionDefinition &actionDefinition)
 
- Protected Member Functions inherited from ToyMaker::SimObjectAspect< RenderDebugViewer >
 SimObjectAspect (int explicitlyInitializeMe)
 
- Protected Member Functions inherited from ToyMaker::BaseSimObjectAspect
 BaseSimObjectAspect (const BaseSimObjectAspect &other)=delete
 
 BaseSimObjectAspect (BaseSimObjectAspect &&other)=delete
 
SimObjectgetSimObject ()
 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.
 
BaseSimObjectAspectgetAspect (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< FixedActionBindingdeclareFixedActionBinding (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< ECSWorldgetWorld () const
 Gets a weak reference to the ECSWorld to which our SimObject's entity belongs.
 

Protected Attributes

std::weak_ptr< ToyMaker::FixedActionBindinghandleUpdateGamma
 
std::weak_ptr< ToyMaker::FixedActionBindinghandleUpdateExposure
 
std::weak_ptr< ToyMaker::FixedActionBindinghandleRenderNextTexture
 

Private Attributes

float mGammaStep { .1f }
 
float mExposureStep { .1f }
 

Additional Inherited Members

- Static Protected Member Functions inherited from ToyMaker::BaseSimObjectAspect
template<typename TSimObjectAspectDerived>
static void registerAspect ()
 Registers an implementation of an aspect with the SimSystem.
 

Detailed Description

A utility aspect class used to log window events and change the debug texture rendered to the viewport it manages.

Member Function Documentation

◆ clone()

std::shared_ptr< ToyMaker::BaseSimObjectAspect > RenderDebugViewer::clone ( ) const
overridevirtual

A method which must be overridden to specify how a new aspect should be constructed as a copy of this one.

Returns
std::shared_ptr<BaseSimObjectAspect> The newly constructed aspect.

Implements ToyMaker::BaseSimObjectAspect.

Member Data Documentation

◆ handleRenderNextTexture

std::weak_ptr<ToyMaker::FixedActionBinding> RenderDebugViewer::handleRenderNextTexture
protected
Initial value:
"Graphics", "RenderNextTexture", [this](const ToyMaker::ActionData& actionData, const ToyMaker::ActionDefinition& actionDefinition) {
return this->onRenderNextTexture(actionData, actionDefinition);
}
)}
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...
Definition sim_system.cpp:219
The definition of a single action, including whether it represents state or change,...
Definition input_data.hpp:511
A union that may contain any one of SimpleActionData, OneAxisActionData, TwoAxisActionData,...
Definition input_data.hpp:721

◆ handleUpdateExposure

std::weak_ptr<ToyMaker::FixedActionBinding> RenderDebugViewer::handleUpdateExposure
protected
Initial value:
"Graphics", "UpdateExposure", [this](const ToyMaker::ActionData& actionData, const ToyMaker::ActionDefinition& actionDefinition) {
return this->onUpdateExposure(actionData, actionDefinition);
}
)}

◆ handleUpdateGamma

std::weak_ptr<ToyMaker::FixedActionBinding> RenderDebugViewer::handleUpdateGamma
protected
Initial value:
"Graphics", "UpdateGamma", [this](const ToyMaker::ActionData& actionData, const ToyMaker::ActionDefinition& actionDefinition) {
return this->onUpdateGamma(actionData, actionDefinition);
}
)}

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