VOX
A little voxel engine
Loading...
Searching...
No Matches
Item.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
define.hpp
"
4
#include "
Block.hpp
"
5
6
#include <cstdint>
7
8
class
ItemInfo
9
{
10
11
public
:
12
13
enum class
Type
: uint16_t
14
{
15
GrassBlock
,
16
DirtBlock
,
17
StoneBlock
,
18
WaterBlock
,
19
GlassBlock
,
20
LightBlock
,
21
WoodBlock
,
22
LeavesBlock
,
23
SandBlock
,
24
None
25
26
}
const
type
=
Type::None
;
27
28
const
BlockInfo::Type
block_id
;
29
uint64_t
mesh_id
= 0;
30
31
private
:
32
33
};
34
35
class
ItemsInfo
36
{
37
38
public
:
39
40
static
ItemsInfo
&
getInstance
()
41
{
42
static
ItemsInfo
instance;
43
return
instance;
44
}
45
46
ItemInfo
&
get
(
const
ItemInfo::Type
type)
47
{
48
return
m_info[
static_cast<
size_t
>
(type)];
49
}
50
51
ItemInfo
&
get
(
const
size_t
index)
52
{
53
return
m_info[index];
54
}
55
56
size_t
count
()
const
57
{
58
return
m_info.size();
59
}
60
61
private
:
62
63
std::vector<ItemInfo> m_info;
64
65
ItemsInfo
();
66
};
67
68
extern
ItemsInfo
&
g_items_info
;
Block.hpp
g_items_info
ItemsInfo & g_items_info
Definition:
Item.cpp:3
BlockInfo::Type
Type
Definition:
Block.hpp:33
ItemInfo
Definition:
Item.hpp:9
ItemInfo::Type
Type
Definition:
Item.hpp:14
ItemInfo::Type::DirtBlock
@ DirtBlock
ItemInfo::Type::WaterBlock
@ WaterBlock
ItemInfo::Type::StoneBlock
@ StoneBlock
ItemInfo::Type::GrassBlock
@ GrassBlock
ItemInfo::Type::SandBlock
@ SandBlock
ItemInfo::Type::None
@ None
ItemInfo::Type::LeavesBlock
@ LeavesBlock
ItemInfo::Type::LightBlock
@ LightBlock
ItemInfo::Type::GlassBlock
@ GlassBlock
ItemInfo::Type::WoodBlock
@ WoodBlock
ItemInfo::block_id
const BlockInfo::Type block_id
Definition:
Item.hpp:28
ItemInfo::mesh_id
uint64_t mesh_id
Definition:
Item.hpp:29
ItemInfo::type
enum ItemInfo::Type type
ItemsInfo
Definition:
Item.hpp:36
ItemsInfo::getInstance
static ItemsInfo & getInstance()
Definition:
Item.hpp:40
ItemsInfo::get
ItemInfo & get(const size_t index)
Definition:
Item.hpp:51
ItemsInfo::count
size_t count() const
Definition:
Item.hpp:56
ItemsInfo::get
ItemInfo & get(const ItemInfo::Type type)
Definition:
Item.hpp:46
define.hpp
src
app
world
Item.hpp
Generated by
1.9.5