diff options
Diffstat (limited to 'examples/particle_system/main.cpp')
-rw-r--r-- | examples/particle_system/main.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/particle_system/main.cpp b/examples/particle_system/main.cpp index 3fd96ce..1d4bd7c 100644 --- a/examples/particle_system/main.cpp +++ b/examples/particle_system/main.cpp @@ -16,9 +16,13 @@ using namespace JinEngine::Time; ParticleSystem* p; Timer timer; Timer::Handler* hnd; -Texture* tex; Shader* shader; +Texture* tex; Sprite* spr; +Texture* tex1; +Sprite* spr1; +Texture* tex2; +Sprite* spr2; const char* shader_code = R"( #VERTEX_SHADER Vertex vert(Vertex v) @@ -39,6 +43,10 @@ void onLoad() { tex = Texture::createTexture("particle.png"); spr = new Sprite(tex, Origin::MiddleCenter); + tex1 = Texture::createTexture("texture.png"); + spr1 = new Sprite(tex1, Origin::MiddleCenter); + tex2 = Texture::createTexture("splash.png"); + spr2 = new Sprite(tex2, Origin::MiddleCenter); shader = Shader::createShader(shader_code); ParticleSystemDef def; def.maxParticleCount = 30; @@ -59,7 +67,10 @@ void onLoad() def.particleDef.linearAccelarationDef.linearAccelaration = Vector2<float>(0, 10); + def.particleDef.spritesDef.mode = SpriteMode::RANDOM; def.particleDef.spritesDef.sprites.push_back(spr); + def.particleDef.spritesDef.sprites.push_back(spr1); + //def.particleDef.spritesDef.sprites.push_back(spr2); def.particleDef.colorDef.color = Color(255, 40, 40, 255); def.particleDef.colorDef.overTime.enable = true; |