146 {
"position", n.position},
147 {
"velocity", n.velocity},
148 {
"velocityBegin", n.velocityBegin},
149 {
"velocityEnd", n.velocityEnd},
151 {
"scaleBegin", n.scaleBegin},
152 {
"scaleEnd", n.scaleEnd},
153 {
"rotation", n.rotation},
154 {
"rotationalVelocity", n.rotationalVelocity},
155 {
"rotationalAcceleration", n.rotationalAcceleration},
157 {
"colorBegin", n.colorBegin},
158 {
"colorEnd", n.colorEnd},
160 {
"frameCountdown", n.frameCountdown},
161 {
"lifetime", n.lifetime},
162 {
"timeLeft", n.timeLeft},
165 {
"velocityChanges", n.velocityChanges},
166 {
"velocityCurve", n.velocityCurve},
167 {
"colorChanges", n.colorChanges},
168 {
"colorCurve", n.colorCurve},
169 {
"scaleChanges", n.scaleChanges},
170 {
"scaleCurve", n.scaleCurve},
171 {
"loopingSprite", n.loopingSprite},
175 j[
"texture"] = n.texture->name();
179 j[
"mesh"] = n.mesh->name();
183 j[
"shader"] = n.shader->name();
189 j.at(
"position").get_to(n.position);
190 j.at(
"velocity").get_to(n.velocity);
191 j.at(
"velocityBegin").get_to(n.velocityBegin);
192 j.at(
"velocityEnd").get_to(n.velocityEnd);
193 j.at(
"scale").get_to(n.scale);
194 j.at(
"scaleBegin").get_to(n.scaleBegin);
195 j.at(
"scaleEnd").get_to(n.scaleEnd);
196 j.at(
"rotation").get_to(n.rotation);
197 j.at(
"rotationalVelocity").get_to(n.rotationalVelocity);
198 j.at(
"rotationalAcceleration").get_to(n.rotationalAcceleration);
199 j.at(
"color").get_to(n.color);
200 j.at(
"colorBegin").get_to(n.colorBegin);
201 j.at(
"colorEnd").get_to(n.colorEnd);
202 j.at(
"frame").get_to(n.frame);
203 j.at(
"frameCountdown").get_to(n.frameCountdown);
204 j.at(
"lifetime").get_to(n.lifetime);
205 j.at(
"timeLeft").get_to(n.timeLeft);
206 j.at(
"fps").get_to(n.fps);
207 j.at(
"velocityChanges").get_to(n.velocityChanges);
208 j.at(
"velocityCurve").get_to(n.velocityCurve);
209 j.at(
"colorChanges").get_to(n.colorChanges);
210 j.at(
"colorCurve").get_to(n.colorCurve);
211 j.at(
"scaleChanges").get_to(n.scaleChanges);
212 j.at(
"scaleCurve").get_to(n.scaleCurve);
213 j.at(
"loopingSprite").get_to(n.loopingSprite);
215 if (j.contains(
"mesh"))
219 if (j.contains(
"texture"))
223 if (j.contains(
"shader"))
Wrapper for cubic bezier curve class.
nlohmann::json json
Definition Json.cpp:19
holds and manages textures for use with meshes in sprites
holds and manages textures for use with meshes in sprites
Definition Texture.h:33
static auto get(const std::string &name) -> T *
get a pointer to an object in the library.
Definition Library.h:49
Struct for passing around all the data a particle has, before a particle is added to a Particle Block...
Definition Particle.h:50
gfx::Shader * shader
Shader for the particle.
Definition Particle.h:135
gfx::Mesh * mesh
Mesh for the particle.
Definition Particle.h:140
bool scaleChanges
whether the color should change for the particle.
Definition Particle.h:113
th::Bezier scaleCurve
if scaleChanges, then scaleCurve dictates how the particle should interpolate between the start and e...
Definition Particle.h:118
Vector4D velocityEnd
Definition Particle.h:54
friend auto to_json(json &j, const Particle &n) -> void
Definition Particle.h:143
Vector4D scale
Definition Particle.h:55
gfx::Texture * texture
Texture for the particle.
Definition Particle.h:130
float timeLeft
how long the particle has before death, if 0 or less, particle is inactive
Definition Particle.h:71
float frameCountdown
how many seconds until the next frame starts
Definition Particle.h:67
unsigned frame
the frame the particle is currently on
Definition Particle.h:65
float rotationalAcceleration
Definition Particle.h:60
Vector4D velocity
Definition Particle.h:52
bool colorChanges
whether the color should change for the particle.
Definition Particle.h:102
float fps
how many frames per second the animation on a particle should be.
Definition Particle.h:83
Vector4D position
Definition Particle.h:51
float lifetime
how long the particle will live for
Definition Particle.h:69
Vector4D color
Definition Particle.h:61
friend auto from_json(const json &j, Particle &n) -> void
Definition Particle.h:187
Vector4D colorBegin
Definition Particle.h:62
th::Bezier velocityCurve
if velocityChanges, then velocityCurve dictates how the particle should interpolate between the start...
Definition Particle.h:96
Vector4D scaleBegin
Definition Particle.h:56
bool loopingSprite
whether the sprite loops or not.
Definition Particle.h:125
th::Bezier colorCurve
if colorChanges, then colorCurve dictates how the particle should interpolate between the start and e...
Definition Particle.h:107
Vector4D scaleEnd
Definition Particle.h:57
bool velocityChanges
whether the velocity should change for the particle.
Definition Particle.h:89
Vector4D colorEnd
Definition Particle.h:63
float rotation
Definition Particle.h:58
Vector4D velocityBegin
Definition Particle.h:53
float rotationalVelocity
Definition Particle.h:59