neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
color.hpp
Go to the documentation of this file.
1
// color.hpp
2
/*
3
neogfx C++ App/Game Engine
4
Copyright (c) 2018, 2020 Leigh Johnston. All Rights Reserved.
5
6
This program is free software: you can redistribute it and / or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include <
neogfx/neogfx.hpp
>
23
#include <
neolib/core/uuid.hpp
>
24
#include <
neolib/core/string.hpp
>
25
#include <
neogfx/game/i_component_data.hpp
>
26
27
namespace
neogfx::game
28
{
29
struct
color
30
{
31
vec4
rgba
;
32
33
struct
meta
:
i_component_data::meta
34
{
35
static
const
neolib::uuid
&
id
()
36
{
37
static
const
neolib::uuid
sId = { 0x8e422ae1, 0x7036, 0x4803, 0x8d61, { 0x71, 0xf8, 0xa2, 0xb9, 0x89, 0x6d } };
38
return
sId;
39
}
40
static
const
i_string
&
name
()
41
{
42
static
const
string
sName =
"Color"
;
43
return
sName;
44
}
45
static
uint32_t
field_count
()
46
{
47
return
1;
48
}
49
static
component_data_field_type
field_type
(uint32_t aFieldIndex)
50
{
51
switch
(aFieldIndex)
52
{
53
case
0:
54
return
component_data_field_type::Vec4;
55
default
:
56
throw
invalid_field_index
();
57
}
58
}
59
static
const
i_string
&
field_name
(uint32_t aFieldIndex)
60
{
61
static
const
string
sFieldNames[] =
62
{
63
"RGBA"
,
64
};
65
return
sFieldNames[aFieldIndex];
66
}
67
};
68
};
69
70
inline
bool
operator==
(
const
color
& lhs,
const
color
& rhs)
71
{
72
return
lhs.
rgba
== rhs.
rgba
;
73
}
74
}
neolib::i_string
Definition
i_string.hpp:49
neolib::math::basic_vector
Definition
numerical.hpp:112
neogfx::game
Definition
aabb_octree.hpp:31
neogfx::operator==
bool operator==(const basic_rect< CoordinateType, CoordinateSystem > &left, const basic_rect< CoordinateType, CoordinateSystem > &right)
Definition
geometrical.hpp:1131
neolib::ecs::component_data_field_type
component_data_field_type
Definition
i_component_data.hpp:52
i_component_data.hpp
neogfx.hpp
string.hpp
neogfx::game::color::meta
Definition
color.hpp:34
neogfx::game::color::meta::name
static const i_string & name()
Definition
color.hpp:40
neogfx::game::color::meta::field_name
static const i_string & field_name(uint32_t aFieldIndex)
Definition
color.hpp:59
neogfx::game::color::meta::field_type
static component_data_field_type field_type(uint32_t aFieldIndex)
Definition
color.hpp:49
neogfx::game::color::meta::id
static const neolib::uuid & id()
Definition
color.hpp:35
neogfx::game::color::meta::field_count
static uint32_t field_count()
Definition
color.hpp:45
neogfx::game::color
Definition
color.hpp:30
neogfx::game::color::rgba
vec4 rgba
Definition
color.hpp:31
neolib::ecs::i_component_data::meta::invalid_field_index
Definition
i_component_data.hpp:134
neolib::ecs::i_component_data::meta
Definition
i_component_data.hpp:133
neolib::uuid
Definition
uuid.hpp:51
uuid.hpp
include
neogfx
game
color.hpp
Generated by
1.9.8