neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
image.hpp
Go to the documentation of this file.
1
// image.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/gfx/i_texture.hpp
>
26
#include <
neogfx/game/ecs_ids.hpp
>
27
#include <
neogfx/game/component.hpp
>
28
#include <
neogfx/game/i_component_data.hpp
>
29
30
namespace
neogfx::game
31
{
32
struct
image
33
{
34
neolib::cookie_ref_ptr
id
;
35
std::string
uri
;
36
scalar
dpiScaleFactor
;
37
texture_sampling
textureSampling
;
38
39
struct
meta
:
i_component_data::meta
40
{
41
static
const
neolib::uuid
&
id
()
42
{
43
static
const
neolib::uuid
sId = { 0x10d54723, 0xbf6c, 0x4346, 0xbdb, { 0xf, 0x6d, 0x38, 0x91, 0x9b, 0xb7 } };
44
return
sId;
45
}
46
static
const
i_string
&
name
()
47
{
48
static
const
string
sName =
"Image"
;
49
return
sName;
50
}
51
static
uint32_t
field_count
()
52
{
53
return
4;
54
}
55
static
component_data_field_type
field_type
(uint32_t aFieldIndex)
56
{
57
switch
(aFieldIndex)
58
{
59
case
0:
60
return
component_data_field_type::Id;
61
case
1:
62
return
component_data_field_type::String;
63
case
2:
64
return
component_data_field_type::Scalar;
65
case
3:
66
return
component_data_field_type::Uint32 | component_data_field_type::Enum;
67
default
:
68
throw
invalid_field_index
();
69
}
70
}
71
static
neolib::uuid
field_type_id
(uint32_t aFieldIndex)
72
{
73
switch
(aFieldIndex)
74
{
75
case
0:
76
case
1:
77
case
2:
78
case
3:
79
return
neolib::uuid
{};
80
default
:
81
throw
invalid_field_index
();
82
}
83
}
84
static
const
i_string
&
field_name
(uint32_t aFieldIndex)
85
{
86
static
const
string
sFieldNames[] =
87
{
88
"Id"
89
"URI"
,
90
"DPI Scale Factor"
,
91
"Texture Sampling"
92
};
93
return
sFieldNames[aFieldIndex];
94
}
95
};
96
};
97
}
neolib::i_string
Definition
i_string.hpp:49
i_texture.hpp
neogfx::game
Definition
aabb_octree.hpp:31
neogfx::texture_sampling
texture_sampling
Definition
i_texture.hpp:42
neolib::ecs::component_data_field_type
component_data_field_type
Definition
i_component_data.hpp:52
neolib::math::scalar
double scalar
Definition
numerical.hpp:63
neolib::cookie_ref_ptr
basic_cookie_ref_ptr< cookie > cookie_ref_ptr
Definition
jar.hpp:732
component.hpp
ecs_ids.hpp
i_component_data.hpp
neogfx.hpp
string.hpp
neogfx::game::image::meta
Definition
image.hpp:40
neogfx::game::image::meta::field_type_id
static neolib::uuid field_type_id(uint32_t aFieldIndex)
Definition
image.hpp:71
neogfx::game::image::meta::field_count
static uint32_t field_count()
Definition
image.hpp:51
neogfx::game::image::meta::id
static const neolib::uuid & id()
Definition
image.hpp:41
neogfx::game::image::meta::field_name
static const i_string & field_name(uint32_t aFieldIndex)
Definition
image.hpp:84
neogfx::game::image::meta::name
static const i_string & name()
Definition
image.hpp:46
neogfx::game::image::meta::field_type
static component_data_field_type field_type(uint32_t aFieldIndex)
Definition
image.hpp:55
neogfx::game::image
Definition
image.hpp:33
neogfx::game::image::dpiScaleFactor
scalar dpiScaleFactor
Definition
image.hpp:36
neogfx::game::image::uri
std::string uri
Definition
image.hpp:35
neogfx::game::image::textureSampling
texture_sampling textureSampling
Definition
image.hpp:37
neogfx::game::image::id
neolib::cookie_ref_ptr id
Definition
image.hpp:34
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
image.hpp
Generated by
1.9.8