Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
ParticleInitializer.h
Go to the documentation of this file.
1
2/*
3 ██╗ ██╗ █████╗ ████████╗ █████╗ ███╗ ██╗ █████╗
4 ██║ ██╔╝ ██╔══██╗ ╚══██╔══╝ ██╔══██╗ ████╗ ██║ ██╔══██╗
5 █████╔╝ ███████║ ██║ ███████║ ██╔██╗ ██║ ███████║
6 ██╔═██╗ ██╔══██║ ██║ ██╔══██║ ██║╚██╗██║ ██╔══██║
7 ██║ ██╗ ██║ ██║ ██║ ██║ ██║ ██║ ╚████║ ██║ ██║
8 ╚═╝ ╚═╝ ╚═╝ ╚═╝/\ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝
9 /vvvvvvvvvvvvvvvvvvv \=========================================,
10 `^^^^^^^^^^^^^^^^^^^ /---------------------------------------"
11 Katana Engine \/ © 2012 - Shuriken Studios LLC
12 http://www.shurikenstudios.com
13*/
14
15#pragma once
16
17#include "KatanaEngine.h"
18
19namespace KatanaEngine
20{
21
24 {
25
26 public:
27
28 ParticleInitializer(const Color color = Color::White, const float scale = 1)
29 {
30 m_color = color;
31 m_scale = scale;
32 }
33
35
36 virtual void Initialize(IParticle* pParticle, Vector2& position) const
37 {
38 Particle* pP = (Particle*)pParticle;
39 pP->SetLifeSpan(m_lifeSpan);
40 pP->SetVelocity(m_velocity);
41 pP->SetScale(m_scale);
42 pP->SetColor(m_color);
43 pP->Initialize(position);
44 }
45
46 virtual void SetScale(const float scale) { m_scale = scale; }
47
48 virtual void SetColor(const Color color) { m_color = color; }
49
50 private:
51
52 float m_lifeSpan = 0.5f;
53 Vector2 m_velocity = Vector2::UNIT_Y * 50;
54 float m_scale = 1;
55 Color m_color = Color::White;
56
57 };
58
59}
Represents a four-component color using red, green, blue, and alpha data.
Definition Color.h:21
static const Color White
White.
Definition Color.h:201
Interface for a particle.
Definition IParticle.h:24
Interface for a particle initializer.
Instantiate a basic particle.
Definition Particle.h:24
virtual void SetVelocity(const Vector2 velocity)
Sets the velocity of the particle.
Definition Particle.h:65
virtual void SetLifeSpan(const float lifeSpan)
Sets the life span of the particle.
Definition Particle.h:77
virtual void Initialize(Vector2 &position)
Definition Particle.h:83
virtual void SetScale(const float scale)
Sets the scale of the particle.
Definition Particle.h:73
virtual void SetColor(const Color color)
Sets the color of the particle.
Definition Particle.h:69
Basic particle initializer.
virtual void SetColor(const Color color)
ParticleInitializer(const Color color=Color::White, const float scale=1)
virtual void SetScale(const float scale)
virtual void Initialize(IParticle *pParticle, Vector2 &position) const
Initializes a particle.
Defines a vector with 2 components (x and y).
Definition Vector2.h:21
static const Vector2 UNIT_Y
A unit vector on the y-axis.
Definition Vector2.h:34
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition Animation.cpp:18