FuncDoodle
Loading...
Searching...
No Matches
Player.h
Go to the documentation of this file.
1
21
22#pragma once
23
24#include "Project/Project.h"
25#include "Util/Ptr.h"
26
27namespace FuncDoodle {
40 public:
53 void Play();
58 void Rewind();
63 void End();
70 constexpr void SetPlaying(bool playing) { m_Playing = playing; }
77 [[nodiscard]] constexpr bool Playing() const { return m_Playing; }
78
85 void SetProj(SharedPtr<ProjectFile> proj) { m_Proj = proj; }
92 [[nodiscard]] SharedPtr<ProjectFile> Proj() const { return m_Proj; }
93
100 [[nodiscard]] constexpr unsigned long CurFrame() const {
101 return m_CurFrame;
102 }
103
109 constexpr void SetCurFrame(unsigned long frame) { m_CurFrame = frame; }
110
111 private:
114 unsigned long m_CurFrame = 0L;
115 float m_TimeElapsed = 0.0f;
116 };
117} // namespace FuncDoodle
Defines the ProjectFile class, which manages animation project data.
Convenience type aliases for standard smart pointers.
std::shared_ptr< T > SharedPtr
Alias for a reference-counted shared smart pointer.
Definition Ptr.h:31
SharedPtr< ProjectFile > Proj() const
Returns the project used for playback.
Definition Player.h:92
void Play()
Advances playback based on elapsed time.
Definition Player.cc:14
unsigned long m_CurFrame
Definition Player.h:114
constexpr unsigned long CurFrame() const
Returns the current playback frame index.
Definition Player.h:100
constexpr void SetCurFrame(unsigned long frame)
Sets the current playback frame index.
Definition Player.h:109
void Rewind()
Resets playback to the first frame.
Definition Player.cc:23
AnimationPlayer(const SharedPtr< ProjectFile > &proj)
Creates a player for a project.
Definition Player.cc:8
SharedPtr< ProjectFile > m_Proj
Definition Player.h:113
void SetProj(SharedPtr< ProjectFile > proj)
Replaces the project used for playback.
Definition Player.h:85
float m_TimeElapsed
Definition Player.h:115
constexpr bool Playing() const
Returns whether playback is currently active.
Definition Player.h:77
void End()
Jumps playback to the final frame.
Definition Player.cc:27
bool m_Playing
Definition Player.h:112
constexpr void SetPlaying(bool playing)
Sets whether playback is active.
Definition Player.h:70
The FuncDoodle C++ namespace.
Definition Common.h:12