NasNas
An intuitive and beginner friendly 2D game framework for C++
include
NasNas
tilemapping
tilemapping/Layer.hpp
1
6
#pragma once
7
8
#include <string>
9
10
#include <SFML/Graphics/Color.hpp>
11
#include <SFML/Graphics/Drawable.hpp>
12
#include <SFML/Graphics/RenderTarget.hpp>
13
#include <SFML/Graphics/Transformable.hpp>
14
#include <SFML/System/Vector2.hpp>
15
16
#include <NasNas/core/data/Rect.hpp>
17
#include <NasNas/tilemapping/PropertiesContainer.hpp>
18
19
namespace
ns::tm
{
20
class
TiledMap;
21
class
GroupLayer;
22
23
class
Layer
:
public
PropertiesContainer
,
public
sf::Drawable,
public
sf::Transformable {
24
friend
class
LayersContainer
;
25
public
:
26
Layer
(
const
pugi::xml_node& xml_node,
TiledMap
* tiledmap);
27
auto
getId()
const
->
unsigned
int;
28
auto
getName()
const
->
const
std::string&;
29
30
auto
isVisible()
const
-> bool;
31
void
setVisible(
bool
value);
32
33
auto
getOffset()
const
->
const
sf::Vector2f&;
34
auto
getTotalOffset()
const
-> sf::Vector2f;
35
36
auto
getParallaxFactor()
const
->
const
sf::Vector2f&;
37
auto
getTotalParallaxFactor()
const
-> sf::Vector2f;
38
39
auto
getTintColor()
const
->
const
sf::Color&;
40
41
virtual
auto
getGlobalBounds()
const
->
ns::FloatRect
;
42
43
protected
:
44
const
TiledMap
* m_tiledmap =
nullptr
;
45
const
GroupLayer
* m_parent_group =
nullptr
;
46
47
private
:
48
unsigned
int
m_id;
49
std::string m_name;
50
bool
m_visible =
true
;
51
float
m_opacity = 1.f;
52
sf::Color m_tintcolor = sf::Color::White;
53
sf::Vector2f m_offset;
54
sf::Vector2f m_parallax_factor = {1.f, 1.f};
55
};
56
57
}
ns::tm::Layer
Definition:
tilemapping/Layer.hpp:23
ns::Rect< float >
ns::tm::TiledMap
Definition:
TiledMap.hpp:23
ns::tm::GroupLayer
Definition:
GroupLayer.hpp:11
ns::tm::PropertiesContainer
Definition:
PropertiesContainer.hpp:26
ns::tm::LayersContainer
Definition:
LayersContainer.hpp:25
ns::tm
Definition:
GroupLayer.hpp:9
Generated by
1.8.13