aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AnimatorSystem.h
blob: 553b4567f78369d96f7f3939ca637e19e265f90f (plain)
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
#pragma once

#include "System.h"

namespace crepe {

/**
 * \brief The AnimatorSystem is responsible for managing and updating all Animator components.
 *
 * This system is responsible for controlling the behavior of the animations for all entities
 * that have the Animator component attached. It updates the animations by controlling their
 * frame changes, looping behavior, and overall animation state.
 */
class AnimatorSystem : public System {

public:
	/**
	 * \brief Retrieves the singleton instance of the AnimatorSystem.
	 *
	 * \return A reference to the single instance of the AnimatorSystem.
	 *
	 * This method ensures that there is only one instance of the AnimatorSystem, following the
	 * singleton design pattern. It can be used to access the system globally.
	 */
	static AnimatorSystem & get_instance();

	/**
	 * \brief Updates the Animator components.
	 *
	 * This method is called periodically (likely every frame) to update the state of all
	 * Animator components, moving the animations forward and managing their behavior (e.g., looping).
	 */
	void update() override;

private:
	/**
	 * \brief Private constructor for the AnimatorSystem.
	 *
	 * The constructor is private to enforce the singleton pattern, ensuring that only
	 * one instance of this system can exist.
	 */
	AnimatorSystem();

	/**
	 * \brief Private destructor for the AnimatorSystem.
	 *
	 * The destructor cleans up any resources used by the AnimatorSystem. It is private
	 * to maintain the singleton pattern and prevent direct deletion.
	 */
	~AnimatorSystem();
};

} // namespace crepe