-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponents.hpp
More file actions
68 lines (59 loc) · 1.75 KB
/
Components.hpp
File metadata and controls
68 lines (59 loc) · 1.75 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
68
//
// Created by Fabien on 15/01/2016.
//
#ifndef SWRPG_COMPONENTS_HPP
#define SWRPG_COMPONENTS_HPP
#include "Imports.hpp"
struct Drawable
{
Drawable(sf::Vector2f vector):vectorPos(vector){}
sf::Vector2f vectorPos;
};
struct Movable
{
Movable(sf::Vector2f vector):vectorMov(vector){}
sf::Vector2f vectorMov;
sf::Vector2f lastVectorMov;
};
struct Playable
{
};
struct Animation{
Animation(float pduration, std::vector<sf::FloatRect> rects) : duration(pduration), animationRects(std::move(rects)){current = animationRects.begin();displayTime=0;frameTime = duration / animationRects.size();}
float duration;
double frameTime;
double displayTime;
std::vector<sf::FloatRect> animationRects;
std::vector<sf::FloatRect>::iterator current;
};
struct Animable
{
Animable(std::map< std::string, std::unique_ptr<Animation> > panimations, sf::RenderStates pstates,std::string pcurrent = ""):animations(std::move(panimations)),states(pstates),current(pcurrent){}
std::map< std::string, std::unique_ptr<Animation> > animations;
std::string current;
sf::RenderStates states;
};
struct EndCollision
{
};
struct Collision
{
enum CollisionType
{
DIRECT,FAR
};
Collision(CollisionType pType, tmx::MapObject* pObject, sf::FloatRect pA, sf::FloatRect pB, sf::FloatRect pIntersect, sf::Vector2f pFrom) : mType(pType),mObject(pObject),mA(pA), mB(pB), mIntersect(pIntersect), mFrom(pFrom)
{
}
CollisionType mType;
tmx::MapObject* mObject;
sf::FloatRect mA,mB,mIntersect;
sf::Vector2f mFrom;
};
struct DialogEvent
{
DialogEvent(const std::string& who, const std::string& something):mWho(who),mDialog(something){}
std::string mDialog;
std::string mWho;
};
#endif //SWRPG_COMPONENTS_HPP