Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
FrameListener.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_FRAME_LISTENER_H_
34#define DVD_FRAME_LISTENER_H_
35
40
41namespace Divide {
42
43enum class FrameEventType : U8 {
52};
53
54struct FrameEvent {
55 struct Time {
56 struct Impl {
61
63};
64
70class FrameListener : public GUIDWrapper {
71 public:
73 explicit FrameListener(const Str<64>& name, FrameListenerManager& parent, U32 callOrder);
74 virtual ~FrameListener() override;
75
76 bool operator<(FrameListener& that) const noexcept {
77 return this->_callOrder < that._callOrder;
78 }
79
80 protected:
82 void setCallOrder(const U32 order) noexcept { _callOrder = order; }
88 [[nodiscard]] virtual bool frameStarted([[maybe_unused]] const FrameEvent& evt) { return true; }
90 [[nodiscard]] virtual bool framePreRender([[maybe_unused]] const FrameEvent& evt) { return true; }
92 [[nodiscard]] virtual bool frameSceneRenderStarted([[maybe_unused]] const FrameEvent& evt) { return true; }
94 [[nodiscard]] virtual bool frameSceneRenderEnded([[maybe_unused]] const FrameEvent& evt) { return true; }
97 [[nodiscard]] virtual bool frameRenderingQueued([[maybe_unused]] const FrameEvent& evt) { return true; }
100 [[nodiscard]] virtual bool framePostRender([[maybe_unused]] const FrameEvent& evt) { return true; }
102 [[nodiscard]] virtual bool frameEnded([[maybe_unused]] const FrameEvent& evt) { return true; }
103
104 PROPERTY_R_IW(bool, enabled, false);
106
107 private:
111};
112
113} // namespace Divide
114#endif //DVD_FRAME_LISTENER_H_
virtual bool frameStarted(const FrameEvent &evt)
Definition: FrameListener.h:88
virtual ~FrameListener() override
bool operator<(FrameListener &that) const noexcept
Definition: FrameListener.h:76
PROPERTY_RW(Str< 64 >, name)
U32 _callOrder
If multiple frame listeners are handling the same event, this call ordervariable is used for sorting.
void setCallOrder(const U32 order) noexcept
Definition: FrameListener.h:82
virtual bool frameSceneRenderEnded(const FrameEvent &evt)
frameSceneRenderEnded is called immediately after scene rendering for the current player has ended bu...
Definition: FrameListener.h:94
PROPERTY_R_IW(bool, enabled, false)
virtual bool frameRenderingQueued(const FrameEvent &evt)
Definition: FrameListener.h:97
virtual bool frameEnded(const FrameEvent &evt)
frameEnded is called after the buffers have been swapped
virtual bool framePostRender(const FrameEvent &evt)
FrameListenerManager & _mgr
virtual bool framePreRender(const FrameEvent &evt)
framePreRenderStarted is called when we need to start processing the visual aspect of a scene
Definition: FrameListener.h:90
virtual bool frameSceneRenderStarted(const FrameEvent &evt)
frameSceneRenderStarted is called right before rendering the scene for the current player starts
Definition: FrameListener.h:92
Utility class that adds basic GUID management to objects.
Definition: GUIDWrapper.h:44
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint8_t U8
Project & parent
Definition: DefaultScene.h:41
uint32_t U32
uint64_t U64
struct Divide::FrameEvent::Time::Impl _game
struct Divide::FrameEvent::Time::Impl _app
struct Divide::FrameEvent::Time _time
FrameEventType _type
Definition: FrameListener.h:62