-
-
Notifications
You must be signed in to change notification settings - Fork 463
Expand file tree
/
Copy pathSprite.hpp
More file actions
67 lines (54 loc) · 2.19 KB
/
Copy pathSprite.hpp
File metadata and controls
67 lines (54 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#include <Preset.hpp>
#include <Audio/FrameAudioData.hpp>
#include <Renderer/RenderContext.hpp>
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <vector>
namespace libprojectM {
namespace UserSprites {
class Sprite
{
public:
using Ptr = std::unique_ptr<Sprite>;
using PresetList = std::vector<std::reference_wrapper<const std::unique_ptr<Preset>>>;
virtual ~Sprite() = default;
/**
* @brief Initializes the sprite instance for rendering.
* @param spriteData The data for the sprite type.
* @param renderContext The current frame's rendering context.
*/
virtual void Init(const std::string& spriteData, const Renderer::RenderContext& renderContext) = 0;
/**
* @brief Draws the sprite onto the current framebuffer.
* @param audioData The frame audio data structure.
* @param renderContext The current frame's rendering context.
* @param outputFramebufferObject Framebuffer object the sprite will be rendered to.
* @param presets The active preset, plus eventually the transitioning one. Used for the burn-in effect.
*/
virtual void Draw(const Audio::FrameAudioData& audioData,
const Renderer::RenderContext& renderContext,
uint32_t outputFramebufferObject,
PresetList presets) = 0;
/**
* @brief Returns if the sprite has finished rendering and should be deleted.
* @return true if the sprite should be deleted, false if not.
*/
virtual auto Done() const -> bool = 0;
/**
* @brief Returns the current value of a variable in the sprite's expression code.
* @param variableName The variable to retrieve the value for.
* @return The value of the requested variable and sprite.
*/
virtual auto GetVariableValue(const std::string& variableName) const -> double = 0;
/**
* @brief Set the value of a variable in the sprite's expression code.
* @param variableName The variable to set the value for.
* @param value The new value.
*/
virtual void SetVariableValue(const std::string& variableName, double value) = 0;
};
} // namespace UserSprites
} // namespace libprojectM