neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
outline.hpp
Go to the documentation of this file.
1// outline.hpp
2/*
3neogfx C++ App/Game Engine
4Copyright (c) 2018, 2020 Leigh Johnston. All Rights Reserved.
5
6This program is free software: you can redistribute it and / or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along 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>
25#include <neogfx/gfx/color.hpp>
28#include <neogfx/game/color.hpp>
31
32namespace neogfx::game
33{
34 struct outline
35 {
38 std::optional<color> color;
39 std::optional<gradient> gradient;
40
42 {
43 static const neolib::uuid& id()
44 {
45 static const neolib::uuid sId = { 0xcf2bbde0, 0xc7be, 0x48a1, 0xb9dd, { 0x1, 0xc7, 0x6, 0xfb, 0x7b, 0x8d } };
46 return sId;
47 }
48 static const i_string& name()
49 {
50 static const string sName = "Outline";
51 return sName;
52 }
53 static uint32_t field_count()
54 {
55 return 4;
56 }
57 static component_data_field_type field_type(uint32_t aFieldIndex)
58 {
59 switch (aFieldIndex)
60 {
61 case 0:
62 return component_data_field_type::Scalar;
63 case 1:
64 return component_data_field_type::Bool;
65 case 2:
66 case 3:
67 return component_data_field_type::ComponentData | component_data_field_type::Optional;
68 default:
69 throw invalid_field_index();
70 }
71 }
72 static neolib::uuid field_type_id(uint32_t aFieldIndex)
73 {
74 switch (aFieldIndex)
75 {
76 case 2:
77 return color::meta::id();
78 case 3:
79 return gradient::meta::id();
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 "Width",
89 "Antialiased"
90 "Color",
91 "Gradient"
92 };
93 return sFieldNames[aFieldIndex];
94 }
95 };
96 };
97}
gradient_id id() const override
double scalar
Definition numerical.hpp:63
static uint32_t field_count()
Definition outline.hpp:53
static component_data_field_type field_type(uint32_t aFieldIndex)
Definition outline.hpp:57
static const i_string & name()
Definition outline.hpp:48
static const neolib::uuid & id()
Definition outline.hpp:43
static neolib::uuid field_type_id(uint32_t aFieldIndex)
Definition outline.hpp:72
static const i_string & field_name(uint32_t aFieldIndex)
Definition outline.hpp:84
std::optional< gradient > gradient
Definition outline.hpp:39
std::optional< color > color
Definition outline.hpp:38