forked from dgcor/DGEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleLevelObjectClass.h
More file actions
executable file
·77 lines (60 loc) · 2.54 KB
/
Copy pathSimpleLevelObjectClass.h
File metadata and controls
executable file
·77 lines (60 loc) · 2.54 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
69
70
71
72
73
74
75
76
77
#pragma once
#include "AnimationType.h"
#include "Classifiers.h"
#include "LevelObjectClassDefaults.h"
#include <string>
#include <SFML/System/Time.hpp>
#include "TexturePacks/TexturePack.h"
class SimpleLevelObjectClass : public LevelObjectClassDefaults<LevelObjValue>
{
private:
const sf::Texture* texture{ nullptr };
sf::IntRect textureRect;
std::shared_ptr<TexturePack> texturePack;
std::pair<uint32_t, uint32_t> textureIndexRange;
sf::Time frameTime;
AnimationType animType{ AnimationType::PlayOnce };
std::string name;
std::string text1;
std::string text2;
Classifiers<3> classifiers;
PairInt8 cellSize;
public:
SimpleLevelObjectClass(const sf::Texture& texture_) : texture(&texture_) {}
SimpleLevelObjectClass(const std::shared_ptr<TexturePack>& texturePack_,
const std::pair<uint32_t, uint32_t>& textureIndexRange_,
const sf::Time& frameTime_, AnimationType animType_)
: texturePack(texturePack_), textureIndexRange(textureIndexRange_),
frameTime(frameTime_), animType(animType_) {}
const sf::Texture* getTexture() const noexcept { return texture; }
const sf::IntRect& getTextureRect() const noexcept { return textureRect; }
void setTextureRect(const sf::IntRect& textureRect_) { textureRect = textureRect_; }
const std::shared_ptr<TexturePack>& getTexturePack() const noexcept { return texturePack; }
const std::pair<uint32_t, uint32_t>& getTextureIndexRange() const noexcept
{
return textureIndexRange;
}
const sf::Time& getFrameTime() const noexcept { return frameTime; }
AnimationType getAnimationType() const noexcept { return animType; }
const std::string& Name() const noexcept { return name; }
const std::string& Text1() const noexcept { return text1; }
const std::string& Text2() const noexcept { return text2; }
void Name(const std::string_view name_) { name = name_; }
void Text1(const std::string_view text1_) { text1 = text1_; }
void Text2(const std::string_view text2_) { text2 = text2_; }
bool getFullName(const Queryable& obj, std::string& fullName) const
{
return classifiers.getText(0, obj, fullName);
}
void setNameClassifier(Classifier* classifier) { classifiers.set(0, classifier, 0); }
bool getDescription(size_t idx, const Queryable& obj, std::string& description) const
{
return classifiers.getText(idx + 1, obj, description);
}
void setDescription(size_t idx, Classifier* classifier, uint16_t skipFirst)
{
classifiers.set(idx + 1, classifier, skipFirst);
}
PairInt8 getCellSize() const noexcept { return cellSize; }
void setCellSize(PairInt8 cellSize_) noexcept { cellSize = cellSize_; }
};