Meteor2D  dev internal
Meteor is a lightweight 2D game engine.
All Classes Functions Variables Pages
animation.h
1#pragma once
2#include <string>
3#include <entities/spatial.h>
4#include <2d/animationmap.h>
5#include <2d/spritesheet.h>
6#include <2d/texrendercmd.h>
7
8namespace meteor {
12 class MAnimation : public MSpatialEntity {
13 public:
21 MAnimation(std::string mapFile, int fps, ERenderLayer layer, uint8_t sortingOrder);
22 void onUpdate(float deltaTime) override;
23
28 void setFPS(int fps);
34 void play(std::string name, bool looped);
38 void resume();
42 void stop();
43 private:
44 std::string currAnim;
45 int index = 0;
46 bool isPlaying = false;
47 bool isLooping = false;
48 bool renderOnce = true;
49 bool changeRequested=false;
50 int fps=30;
51 float animTime;
52 MAnimationMap* animationMap;
53 MSpriteSheet* currAnimSheet;
54 MTexRenderCmd* cmd;
55 SVector2 pivot;
56 SRect spriteSrcRect;
57 void tryChangeAnimParams();
58 void updateAnimation(float deltaTime);
59 void submitFrameRenderRequest();
60 void updateRect();
61 };
62}
Animation entity provides sprite - sheet based animation system to meteor.
Definition animation.h:12
void play(std::string name, bool looped)
Plays a specific animation.
void resume()
Resumes a stopped animation.
void setFPS(int fps)
set the frame-rate of the fps playback
MAnimation(std::string mapFile, int fps, ERenderLayer layer, uint8_t sortingOrder)
Constructor for Animation.
void stop()
Stops animation playback.
This class holds the relationship between SpriteSheets and Animation name. Needs to be created using ...
Definition animationmap.h:10
Spatial Entity is the base entity for all types present in scene. This entity keeps track of spatial ...
Definition spatial.h:15
This class holds the Rects within a texture that form an Animation.
Definition spritesheet.h:9
This a RenderCommand that draws an image on to the screen.
Definition texrendercmd.h:11
A struct representing rectangle.
Definition rect.h:8
A structure representing a 2D Vector.
Definition vector2d.h:11