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>
29
30namespace neogfx::game
31{
32 struct image
33 {
35 std::string uri;
38
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}
texture_sampling
Definition i_texture.hpp:42
double scalar
Definition numerical.hpp:63
basic_cookie_ref_ptr< cookie > cookie_ref_ptr
Definition jar.hpp:732
static neolib::uuid field_type_id(uint32_t aFieldIndex)
Definition image.hpp:71
static uint32_t field_count()
Definition image.hpp:51
static const neolib::uuid & id()
Definition image.hpp:41
static const i_string & field_name(uint32_t aFieldIndex)
Definition image.hpp:84
static const i_string & name()
Definition image.hpp:46
static component_data_field_type field_type(uint32_t aFieldIndex)
Definition image.hpp:55
scalar dpiScaleFactor
Definition image.hpp:36
std::string uri
Definition image.hpp:35
texture_sampling textureSampling
Definition image.hpp:37
neolib::cookie_ref_ptr id
Definition image.hpp:34