nngn
Loading...
Searching...
No Matches
map.h
Go to the documentation of this file.
1
#ifndef NNGN_MAP_H
2
#define NNGN_MAP_H
3
4
#include <vector>
5
6
#include "
lua/table.h
"
7
#include "
math/vec2.h
"
8
#include "
math/vec3.h
"
9
#include "
utils/def.h
"
10
#include "
utils/flags.h
"
11
12
namespace
nngn
{
13
14
struct
Graphics;
15
class
Textures;
16
17
class
Map
{
18
public
:
19
static
std::vector<uvec2>
load_tiles
(
20
std::size_t width, std::size_t height,
nngn::lua::table_view
tiles
);
21
void
init
(
Textures
*t) { this->
textures
= t; }
22
u32
vbo
()
const
{
return
this->
m_vbo
; }
23
u32
ebo
()
const
{
return
this->
m_ebo
; }
24
bool
set_max
(std::size_t
n
);
25
bool
set_graphics
(
Graphics
*
g
);
26
bool
load
(
27
unsigned
int
tex
,
float
sprite_scale
,
28
float
trans_x,
float
trans_y,
float
scale_x,
float
scale_y,
29
unsigned
int
width,
unsigned
int
height,
30
nngn::lua::table_view
tiles
);
31
bool
enabled
()
const
{
return
this->
m_flags
.
is_set
(Flag::ENABLED); }
32
bool
perspective
()
const
33
{
return
this->
m_flags
.
is_set
(Flag::PERSPECTIVE); }
34
bool
set_enabled
(
bool
e
);
35
private
:
36
enum
Flag
: uint8_t {
ENABLED
= 1u << 0,
PERSPECTIVE
= 1u << 1 };
37
Textures
*
textures
=
nullptr
;
38
Graphics
*
graphics
=
nullptr
;
39
Flags<Flag>
m_flags
= {Flag::ENABLED | Flag::PERSPECTIVE};
40
unsigned
int
tex
= 0;
41
uvec2
size
= {};
42
float
sprite_scale
= 1.0f;
43
vec2
trans
= {},
scale
= {};
44
std::vector<uvec2>
uv
= {};
45
std::size_t
max
= {};
46
u32
m_vbo
= {},
m_ebo
= {};
47
bool
gen
()
const
;
48
};
49
50
}
51
52
#endif
tiles
tiles
Definition
cathedral.lua:18
nngn::Map
Definition
map.h:17
nngn::Map::tex
unsigned int tex
Definition
map.h:40
nngn::Map::m_flags
Flags< Flag > m_flags
Definition
map.h:39
nngn::Map::uv
std::vector< uvec2 > uv
Definition
map.h:44
nngn::Map::ebo
u32 ebo() const
Definition
map.h:23
nngn::Map::gen
bool gen() const
Definition
map.cpp:85
nngn::Map::perspective
bool perspective() const
Definition
map.h:32
nngn::Map::set_max
bool set_max(std::size_t n)
Definition
map.cpp:38
nngn::Map::sprite_scale
float sprite_scale
Definition
map.h:42
nngn::Map::vbo
u32 vbo() const
Definition
map.h:22
nngn::Map::load_tiles
static std::vector< uvec2 > load_tiles(std::size_t width, std::size_t height, nngn::lua::table_view tiles)
Definition
map.cpp:73
nngn::Map::init
void init(Textures *t)
Definition
map.h:21
nngn::Map::m_vbo
u32 m_vbo
Definition
map.h:46
nngn::Map::size
uvec2 size
Definition
map.h:41
nngn::Map::set_graphics
bool set_graphics(Graphics *g)
Definition
map.cpp:32
nngn::Map::graphics
Graphics * graphics
Definition
map.h:38
nngn::Map::Flag
Flag
Definition
map.h:36
nngn::Map::PERSPECTIVE
@ PERSPECTIVE
Definition
map.h:36
nngn::Map::ENABLED
@ ENABLED
Definition
map.h:36
nngn::Map::m_ebo
u32 m_ebo
Definition
map.h:46
nngn::Map::set_enabled
bool set_enabled(bool e)
Definition
map.cpp:150
nngn::Map::max
std::size_t max
Definition
map.h:45
nngn::Map::enabled
bool enabled() const
Definition
map.h:31
nngn::Map::textures
Textures * textures
Definition
map.h:37
nngn::Map::trans
vec2 trans
Definition
map.h:43
nngn::Map::scale
vec2 scale
Definition
map.h:43
nngn::Textures
Texture manager, loads and caches image data from files/buffers.
Definition
texture.h:34
def.h
n
local n
Definition
dump_lights.lua:5
flags.h
g
local g
Definition
gamma.lua:7
nngn
Definition
audio.cpp:7
nngn::u32
std::uint32_t u32
Definition
def.h:14
load
load
Definition
entity.lua:7
nngn::Flags
Wrapper for a small unsigned integral representing flags.
Definition
flags.h:18
nngn::Flags::is_set
constexpr bool is_set(AT a) const
Definition
flags.h:45
nngn::Graphics
Definition
graphics.h:138
nngn::lua::table_view
Non-owning reference to a table on the stack.
Definition
table.h:166
nngn::vec2_base< std::uint32_t >
table.h
Operations on table values.
e
local e
Definition
math.lua:4
vec2.h
vec3.h
src
render
map.h
Generated by
1.11.0