GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Animation.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-2016 Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 
7 #pragma once
8 
9 #include <vector>
10 #include "GDCore/String.h"
11 #include "GDCore/Extensions/Builtin/SpriteExtension/Direction.h"
12 
13 namespace gd {
14 
22 class GD_CORE_API Animation {
23  public:
24  Animation();
25  virtual ~Animation();
26 
30  const gd::String& GetName() const { return name; }
31 
35  void SetName(const gd::String& name_) { name = name_; }
36 
40  const Direction& GetDirection(std::size_t n) const;
41 
45  Direction& GetDirection(std::size_t n);
46 
50  void SetDirection(const Direction& direction, std::size_t nb);
51 
55  void SetDirectionsCount(std::size_t nb);
56 
60  std::size_t GetDirectionsCount() const;
61 
65  bool HasNoDirections() const;
66 
73  bool UseMultipleDirections() const { return useMultipleDirections; }
74 
81  void SetUseMultipleDirections(bool enable) { useMultipleDirections = enable; }
82 
85 
86  private:
87  std::vector<Direction> directions;
88  gd::String name;
89 
90  static Direction badDirection;
91 };
92 
93 } // namespace gd
Class representing an animation of a SpriteObject.
Definition: Animation.h:22
void SetName(const gd::String &name_)
Change the name of the animation.
Definition: Animation.h:35
const gd::String & GetName() const
Set the name of the animation.
Definition: Animation.h:30
void SetUseMultipleDirections(bool enable)
Set if the animation is using more than one direction.
Definition: Animation.h:81
bool useMultipleDirections
Definition: Animation.h:83
bool UseMultipleDirections() const
Return true if the animation is composed of more than one direction.
Definition: Animation.h:73
Class defining a direction (set of frames) of an Animation.
Definition: Direction.h:28
String represents an UTF8 encoded string.
Definition: String.h:31
Definition: CommonTools.h:24