ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
Loading...
Searching...
No Matches
render_debug_viewer.hpp
Go to the documentation of this file.
1
10
11#ifndef ZOAPPRENDERDEBUGVIEWER_H
12#define ZOAPPRENDERDEBUGVIEWER_H
13
16
17namespace ToyMaker {
18
23 class RenderDebugViewer: public ToyMaker::SimObjectAspect<RenderDebugViewer> {
24 public:
25 inline static std::string getSimObjectAspectTypeName() { return "RenderDebugViewer"; }
26 std::shared_ptr<BaseSimObjectAspect> clone() const override;
27 static std::shared_ptr<BaseSimObjectAspect> create(const nlohmann::json& jsonAspectProperties);
28 ToyMaker::SignalObserver<> mObserveWindowResized { *this, "WindowResizedObserved", [this]() { std::cout << "RenderDebugViewer: Window was resized\n"; this->printWindowProps(); } };
29 ToyMaker::SignalObserver<> mObserveWindowMinimized { *this, "WindowMinimizedObserved", [this]() { std::cout << "RenderDebugViewer: Window was minimized\n"; this->printWindowProps(); } };
30 ToyMaker::SignalObserver<> mObserveWindowMaximized { *this, "WindowMaximizedObserved", [this]() { std::cout << "RenderDebugViewer: Window was maximized\n"; this->printWindowProps(); } };
31 ToyMaker::SignalObserver<> mObserveWindowMoved { *this, "WindowMovedObserved", [this]() { std::cout << "RenderDebugViewer: Window was moved\n"; this->printWindowProps(); } };
32 ToyMaker::SignalObserver<> mObserveWindowMouseEntered { *this, "WindowMouseEnteredObserved", [this]() { std::cout << "RenderDebugViewer: Mouse entered window\n"; this->printWindowProps(); } };
33 ToyMaker::SignalObserver<> mObserveWindowMouseExited { *this, "WindowMouseExitedObserved", [this]() { std::cout << "RenderDebugViewer: Mouse left window\n"; this->printWindowProps(); } };
34 ToyMaker::SignalObserver<> mObserveWindowCloseRequested { *this, "WindowCloseRequestedObserved", [this]() { std::cout << "RenderDebugViewer: Window close requested\n"; this->printWindowProps(); } };
35 ToyMaker::SignalObserver<> mObserveWindowSizeChanged { *this, "WindowSizeChangedObserved", [this]() { std::cout << "RenderDebugViewer: Window's size was changed\n"; this->printWindowProps(); } };
36 ToyMaker::SignalObserver<> mObserveWindowRestored { *this, "WindowRestoredObserved", [this]() { std::cout << "RenderDebugViewer: Window was restored\n"; this->printWindowProps(); } };
37 ToyMaker::SignalObserver<> mObserveWindowShown { *this, "WindowShownObserved", [this]() { std::cout << "RenderDebugViewer: Window was shown\n"; this->printWindowProps(); } };
38 ToyMaker::SignalObserver<> mObserveWindowExposed { *this, "WindowExposedObserved", [this]() { std::cout << "RenderDebugViewer: Window was exposed\n"; this->printWindowProps(); } };
39 ToyMaker::SignalObserver<> mObserveWindowKeyFocusGained { *this, "WindowKeyFocusGainedObserved", [this]() { std::cout << "RenderDebugViewer: Window gained key focus\n"; this->printWindowProps(); } };
40 ToyMaker::SignalObserver<> mObserveWindowKeyFocusLost { *this, "WindowKeyFocusLostObserved", [this]() { std::cout << "RenderDebugViewer: Window lost key focus\n"; this->printWindowProps(); } };
41 ToyMaker::SignalObserver<> mObserveWindowKeyFocusOffered { *this, "WindowKeyFocusOffered", [this]() { std::cout << "RenderDebugViewer: Window was offered key focus\n"; this->printWindowProps(); } };
42 void printWindowProps();
43
44 protected:
45 bool onUpdateGamma(const ToyMaker::ActionData& actionData, const ToyMaker::ActionDefinition& actionDefinition);
46 bool onUpdateExposure(const ToyMaker::ActionData& actionData, const ToyMaker::ActionDefinition& actionDefinition);
47 bool onRenderNextTexture(const ToyMaker::ActionData& actionData, const ToyMaker::ActionDefinition& actionDefinition);
48
49 std::weak_ptr<ToyMaker::FixedActionBinding> handleUpdateGamma{ declareFixedActionBinding (
50 "Graphics", "UpdateGamma", [this](const ToyMaker::ActionData& actionData, const ToyMaker::ActionDefinition& actionDefinition) {
51 return this->onUpdateGamma(actionData, actionDefinition);
52 }
53 )};
54 std::weak_ptr<ToyMaker::FixedActionBinding> handleUpdateExposure { declareFixedActionBinding (
55 "Graphics", "UpdateExposure", [this](const ToyMaker::ActionData& actionData, const ToyMaker::ActionDefinition& actionDefinition) {
56 return this->onUpdateExposure(actionData, actionDefinition);
57 }
58 )};
59 std::weak_ptr<ToyMaker::FixedActionBinding> handleRenderNextTexture { declareFixedActionBinding(
60 "Graphics", "RenderNextTexture", [this](const ToyMaker::ActionData& actionData, const ToyMaker::ActionDefinition& actionDefinition) {
61 return this->onRenderNextTexture(actionData, actionDefinition);
62 }
63 )};
64
65 private:
66
67 RenderDebugViewer() : SimObjectAspect<RenderDebugViewer>{0} {
69 mObserveWindowMoved.connectTo(windowContextManager.mSigWindowMoved);
70 mObserveWindowResized.connectTo(windowContextManager.mSigWindowResized);
71 mObserveWindowMinimized.connectTo(windowContextManager.mSigWindowMinimized);
72 mObserveWindowMaximized.connectTo(windowContextManager.mSigWindowMaximized);
73 mObserveWindowMouseEntered.connectTo(windowContextManager.mSigWindowMouseEntered);
74 mObserveWindowMouseExited.connectTo(windowContextManager.mSigWindowMouseExited);
75 mObserveWindowShown.connectTo(windowContextManager.mSigWindowShown);
76 mObserveWindowSizeChanged.connectTo(windowContextManager.mSigWindowSizeChanged);
77 mObserveWindowCloseRequested.connectTo(windowContextManager.mSigWindowCloseRequested);
78 mObserveWindowRestored.connectTo(windowContextManager.mSigWindowRestored);
79 mObserveWindowExposed.connectTo(windowContextManager.mSigWindowExposed);
80 mObserveWindowKeyFocusGained.connectTo(windowContextManager.mSigWindowKeyFocusGained);
81 mObserveWindowKeyFocusLost.connectTo(windowContextManager.mSigWindowKeyFocusLost);
82 mObserveWindowKeyFocusOffered.connectTo(windowContextManager.mSigWindowKeyFocusOffered);
83 }
84
85 float mGammaStep { .1f };
86 float mExposureStep { .1f };
87 };
88
89}
90
91#endif
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
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 render_debug_viewer.cpp:34
A SignalObserver object, which can subscribe to Signals matching its data signature and receive signa...
Definition signals.hpp:412
An object containing closely related methods and data, and exposing object lifecycle and application ...
Definition sim_system.hpp:956
A class providing access to various window management methods and window event Signals.
Definition window_context_manager.hpp:36
static WindowContext & getInstance()
Gets this application's sole window instance.
Definition window_context_manager.cpp:168
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition application.hpp:24
Classes and structs relating to the SimSystem, the system responsible for providing some level of gen...
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
Contains classes and functions for managing the (at present, single) window of this application.