neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
animation.hpp
Go to the documentation of this file.
1// animation.hpp
2/*
3neogfx C++ App/Game Engine
4Copyright (c) 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>
30
31namespace neogfx::game
32{
34 {
37
39 {
40 static const neolib::uuid& id()
41 {
42 static const neolib::uuid sId = { 0x31bf1ad4, 0x9d06, 0x409d, 0xbc4f, { 0x4f, 0x80, 0x86, 0x38, 0xfd, 0x4f } };
43 return sId;
44 }
45 static const i_string& name()
46 {
47 static const string sName = "Animation Frame";
48 return sName;
49 }
50 static uint32_t field_count()
51 {
52 return 2;
53 }
54 static component_data_field_type field_type(uint32_t aFieldIndex)
55 {
56 switch (aFieldIndex)
57 {
58 case 0:
59 return component_data_field_type::Scalar;
60 case 1:
61 return component_data_field_type::ComponentData;
62 default:
63 throw invalid_field_index();
64 }
65 }
66 static neolib::uuid field_type_id(uint32_t aFieldIndex)
67 {
68 switch (aFieldIndex)
69 {
70 case 0:
71 return neolib::uuid{};
72 case 1:
73 return mesh_filter::meta::id();
74 default:
75 throw invalid_field_index();
76 }
77 }
78 static const i_string& field_name(uint32_t aFieldIndex)
79 {
80 static const string sFieldNames[] =
81 {
82 "Duration",
83 "Filter"
84 };
85 return sFieldNames[aFieldIndex];
86 }
87 };
88 };
89
90 typedef std::vector<animation_frame> animation_frames;
91
92 struct animation
93 {
95
97 {
98 static const neolib::uuid& id()
99 {
100 static const neolib::uuid sId = { 0x164a76c6, 0x7081, 0x4b38, 0xb3ec, { 0x5b, 0xf9, 0xe0, 0x2, 0xe5, 0xbf } };
101 return sId;
102 }
103 static const i_string& name()
104 {
105 static const string sName = "Animation";
106 return sName;
107 }
108 static uint32_t field_count()
109 {
110 return 1;
111 }
112 static component_data_field_type field_type(uint32_t aFieldIndex)
113 {
114 switch (aFieldIndex)
115 {
116 case 0:
117 return component_data_field_type::ComponentData | component_data_field_type::Array;
118 default:
119 throw invalid_field_index();
120 }
121 }
122 static neolib::uuid field_type_id(uint32_t aFieldIndex)
123 {
124 switch (aFieldIndex)
125 {
126 case 0:
128 default:
129 throw invalid_field_index();
130 }
131 }
132 static const i_string& field_name(uint32_t aFieldIndex)
133 {
134 static const string sFieldNames[] =
135 {
136 "Animation"
137 };
138 return sFieldNames[aFieldIndex];
139 }
140 };
141 };
142}
std::vector< animation_frame > animation_frames
Definition animation.hpp:90
double scalar
Definition numerical.hpp:63
static const i_string & field_name(uint32_t aFieldIndex)
static uint32_t field_count()
static component_data_field_type field_type(uint32_t aFieldIndex)
static const i_string & name()
static neolib::uuid field_type_id(uint32_t aFieldIndex)
static const neolib::uuid & id()
Definition animation.hpp:98
static const i_string & field_name(uint32_t aFieldIndex)
Definition animation.hpp:78
static const neolib::uuid & id()
Definition animation.hpp:40
static neolib::uuid field_type_id(uint32_t aFieldIndex)
Definition animation.hpp:66
static component_data_field_type field_type(uint32_t aFieldIndex)
Definition animation.hpp:54
static const i_string & name()
Definition animation.hpp:45
animation_frames frames
Definition animation.hpp:94
static const neolib::uuid & id()