From 280c39c65f47b4d1395d0dfe583a67a058804a27 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 24 Oct 2018 08:20:13 +0800 Subject: =?UTF-8?q?*=E7=B2=92=E5=AD=90=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/jin.exe | Bin 510464 -> 0 bytes build/vc++/libjin/libjin.vcxproj | 8 ++- build/vc++/libjin/libjin.vcxproj.filters | 30 ++++---- build/vc++/libs/LuaJIT-2.0.5/src/buildvm.lib | Bin 33996 -> 33996 bytes build/vc++/libs/LuaJIT-2.0.5/src/lua51.dll | Bin 364544 -> 364544 bytes build/vc++/libs/LuaJIT-2.0.5/src/lua51.lib | Bin 59514 -> 59514 bytes build/vc++/libs/LuaJIT-2.0.5/src/luajit.lib | Bin 33810 -> 33810 bytes build/vc++/libs/LuaJIT-2.0.5/src/minilua.lib | Bin 33996 -> 33996 bytes src/libjin/Game/je_entity.cpp | 11 --- src/libjin/Game/je_entity.h | 79 +++------------------ src/libjin/Graphics/animation/je_clip.h | 2 + src/libjin/Graphics/je_graphic.h | 1 + src/libjin/Graphics/je_sprite_batch.cpp | 0 src/libjin/Graphics/je_sprite_batch.h | 20 ------ src/libjin/Graphics/particle/je_particle.h | 71 ++++++++++++++++++ src/libjin/Graphics/particle/je_particle_emitter.h | 64 ++++++++++++++--- src/libjin/Graphics/particle/je_particle_system.h | 7 +- 17 files changed, 166 insertions(+), 127 deletions(-) delete mode 100644 bin/jin.exe delete mode 100644 src/libjin/Graphics/je_sprite_batch.cpp delete mode 100644 src/libjin/Graphics/je_sprite_batch.h diff --git a/bin/jin.exe b/bin/jin.exe deleted file mode 100644 index 4d13637..0000000 Binary files a/bin/jin.exe and /dev/null differ diff --git a/build/vc++/libjin/libjin.vcxproj b/build/vc++/libjin/libjin.vcxproj index e7efdd7..4305471 100644 --- a/build/vc++/libjin/libjin.vcxproj +++ b/build/vc++/libjin/libjin.vcxproj @@ -161,8 +161,9 @@ + - + @@ -177,10 +178,10 @@ + - @@ -239,6 +240,7 @@ + @@ -251,10 +253,10 @@ + - diff --git a/build/vc++/libjin/libjin.vcxproj.filters b/build/vc++/libjin/libjin.vcxproj.filters index 9c35e9d..72fe0f3 100644 --- a/build/vc++/libjin/libjin.vcxproj.filters +++ b/build/vc++/libjin/libjin.vcxproj.filters @@ -300,12 +300,6 @@ source\game - - source\game - - - source\graphics - source\graphics\particle @@ -345,6 +339,15 @@ source\graphics\particle + + source\graphics + + + source\game + + + source\game + @@ -478,9 +481,6 @@ source\graphics\shader - - source\graphics - source\graphics\particle @@ -496,9 +496,6 @@ source\graphics\animation - - source\game - source\game @@ -514,5 +511,14 @@ source\graphics\particle + + source\graphics + + + source\game + + + source\game + \ No newline at end of file diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/buildvm.lib b/build/vc++/libs/LuaJIT-2.0.5/src/buildvm.lib index c7be727..be22bd4 100644 Binary files a/build/vc++/libs/LuaJIT-2.0.5/src/buildvm.lib and b/build/vc++/libs/LuaJIT-2.0.5/src/buildvm.lib differ diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lua51.dll b/build/vc++/libs/LuaJIT-2.0.5/src/lua51.dll index f05c2ba..8e366c2 100644 Binary files a/build/vc++/libs/LuaJIT-2.0.5/src/lua51.dll and b/build/vc++/libs/LuaJIT-2.0.5/src/lua51.dll differ diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/lua51.lib b/build/vc++/libs/LuaJIT-2.0.5/src/lua51.lib index 36f6e7c..cdcb9a2 100644 Binary files a/build/vc++/libs/LuaJIT-2.0.5/src/lua51.lib and b/build/vc++/libs/LuaJIT-2.0.5/src/lua51.lib differ diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/luajit.lib b/build/vc++/libs/LuaJIT-2.0.5/src/luajit.lib index b52fe49..8a4ef15 100644 Binary files a/build/vc++/libs/LuaJIT-2.0.5/src/luajit.lib and b/build/vc++/libs/LuaJIT-2.0.5/src/luajit.lib differ diff --git a/build/vc++/libs/LuaJIT-2.0.5/src/minilua.lib b/build/vc++/libs/LuaJIT-2.0.5/src/minilua.lib index e2b3ac3..1a4ed3f 100644 Binary files a/build/vc++/libs/LuaJIT-2.0.5/src/minilua.lib and b/build/vc++/libs/LuaJIT-2.0.5/src/minilua.lib differ diff --git a/src/libjin/Game/je_entity.cpp b/src/libjin/Game/je_entity.cpp index 1396518..e69de29 100644 --- a/src/libjin/Game/je_entity.cpp +++ b/src/libjin/Game/je_entity.cpp @@ -1,11 +0,0 @@ -#include "je_entity.h" - -namespace JinEngine -{ - namespace Game - { - - - - } // namespace Game -} // namespace JinEngine \ No newline at end of file diff --git a/src/libjin/Game/je_entity.h b/src/libjin/Game/je_entity.h index 781bdc3..cf4eeb0 100644 --- a/src/libjin/Game/je_entity.h +++ b/src/libjin/Game/je_entity.h @@ -1,16 +1,7 @@ -#ifndef __JE_GAME_OBJECT_H -#define __JE_GAME_OBJECT_H +#ifndef __JE_ENTITY_H +#define __JE_ENTITY_H -#include "../core/je_configuration.h" -#if defined(jin_game) - -#include -#include -#include - -#include "../common/je_object.h" -#include "../common/je_types.h" -#include "../graphics/je_sprite.h" +#include "je_game_object.h" namespace JinEngine { @@ -18,69 +9,17 @@ namespace JinEngine { /// - /// Game object base class. + /// /// - class Entity : public Object + class Entity : public GameObject { public: - /// - /// - /// - virtual ~Entity(); - - /// - /// - /// - void lifecycle(); - - /// - /// - /// - void setVisible(bool isVisible); - - /// - /// - /// - void setActive(bool isActive); - - /// - /// - /// - void setOrder(uint32 order); - - protected: - virtual void onAlive(); - virtual void onUpdate(float dt); - virtual void onDraw(); - virtual void onDestroy(); - - uint32 mLayer; // layer where entity belongs - uint32 mOrder; // render index in layer - uint32 mTag; // tag of entity, support 32 tags now - bool mIsVisible; // if the entity is visible or not - bool mIsActive; // if the entity is joined into the logic - - /// - /// Position of entity. - /// - Math::Vector2 mPosition; + private: }; - /// - /// Entity list. For quickly adding and removing entities. - /// - typedef std::list EntityList; - - /// - /// Entity set. For searching and keeps entities unique and sorted. - /// - typedef std::set EntitySet; - - } // namespace Game -} // namespace JinEngine - -#endif // jin_game + } +} -#endif \ No newline at end of file +#endif \ No newline at end of file diff --git a/src/libjin/Graphics/animation/je_clip.h b/src/libjin/Graphics/animation/je_clip.h index eedffc0..6b6b0df 100644 --- a/src/libjin/Graphics/animation/je_clip.h +++ b/src/libjin/Graphics/animation/je_clip.h @@ -17,6 +17,8 @@ namespace JinEngine class Clip { public: + void onUpdate(float dt); + void start(); void pause(); void stop(); diff --git a/src/libjin/Graphics/je_graphic.h b/src/libjin/Graphics/je_graphic.h index d18575e..3410d61 100644 --- a/src/libjin/Graphics/je_graphic.h +++ b/src/libjin/Graphics/je_graphic.h @@ -18,6 +18,7 @@ namespace JinEngine // Graphic // |-Texture // |-Canvas + // |-TextureFont // /// diff --git a/src/libjin/Graphics/je_sprite_batch.cpp b/src/libjin/Graphics/je_sprite_batch.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/src/libjin/Graphics/je_sprite_batch.h b/src/libjin/Graphics/je_sprite_batch.h deleted file mode 100644 index 359ce24..0000000 --- a/src/libjin/Graphics/je_sprite_batch.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __JE_SPRITE_BATCH_H -#define __JE_SPRITE_BATCH_H - -namespace JinEngine -{ - namespace Graphics - { - - /// - /// For reducing draw call. - /// - class SpriteBatch - { - - }; - - } // namespace Graphics -} // namespace JinEngine - -#endif \ No newline at end of file diff --git a/src/libjin/Graphics/particle/je_particle.h b/src/libjin/Graphics/particle/je_particle.h index 474e15b..cb176bb 100644 --- a/src/libjin/Graphics/particle/je_particle.h +++ b/src/libjin/Graphics/particle/je_particle.h @@ -10,6 +10,77 @@ namespace JinEngine class ParticleSystem; + struct LifeTimeDef + { + bool enableRandom = false; + union + { + struct + { + float min, max; + } random; + float life; + } life; + }; + + struct SpeedOverTimeDef + { + bool enable = false; + bool enableRandom = false; + union + { + struct + { + Math::Vector2 startFloor; + Math::Vector2 startCeil; + Math::Vector2 endFloor; + Math::Vector2 endCeil; + } random; + struct + { + Math::Vector2 start; + Math::Vector2 end; + } speed; + } speed; + }; + + struct SizeOverTimeDef + { + bool enable = false; + bool enableRandom = false; + union { + struct { + float startFloor = 1; + float startCeil = 1; + float endFloor = 1; + float endCeil = 1; + } random; + struct { + float start = 1; + float end = 1; + } size; + } size; + }; + + struct ColorOverTime + { + bool enable = false; + Color colorStart = Color::WHITE; + Color colorEnd = Color::WHITE; + }; + + /// + /// + /// + struct ParticleDef + { + LifeTimeDef lifeTimeDef; ///< + // Optional definitions. + SpeedOverTimeDef speedOverTimeDef; ///< + SizeOverTimeDef sizeOverTimeDef; ///< + ColorOverTime colorOverTimeDef; ///< + }; + /// /// A single particle contains various properties of particle, such as position, accelaration, color and /// other attributes changed over time. diff --git a/src/libjin/Graphics/particle/je_particle_emitter.h b/src/libjin/Graphics/particle/je_particle_emitter.h index 95b7875..e700f16 100644 --- a/src/libjin/Graphics/particle/je_particle_emitter.h +++ b/src/libjin/Graphics/particle/je_particle_emitter.h @@ -11,29 +11,75 @@ namespace JinEngine namespace Graphics { + struct PositionDef + { + bool enableRandom = false; + union + { + struct + { + Math::Vector2 min; + Math::Vector2 max; + } random; + Math::Vector2 position; + } position; + }; + + struct DirectionDef + { + bool enableRandom = false; + union + { + struct + { + float min = 0; + float max = 0; + } random; + float direction = 0; + } direction; + }; + + struct EmitRateDef + { + bool enableRandom = false; + union + { + struct + { + float min = 1; + float max = 1; + } random; + float rate = 1; + } rate; + }; + /// /// Definition of particle emitter. /// struct ParticleEmitterDef : public Temporary { - Math::Vector2 position; - + PositionDef positionDef; ///< Emit position(relativily to the particle system center). + DirectionDef directionDef; ///< Emit direction. + EmitRateDef emitRateDef; ///< Emit rate. + /// + /// Particle definition. + /// + ParticleDef particleDef; ///< Particle definition. }; + /// + /// Emit a single particle. + /// class ParticleEmitter { public: ParticleEmitter(const ParticleEmitterDef& def); /// - /// Create new particle. - /// - Particle* emit(); - - /// - /// Emitter position. + /// Emit a particle, particle system should assign particle value to the particle in particle pool, + /// but not use this return particle. /// - Math::Vector2 mPosition; + Particle emit(); /// /// diff --git a/src/libjin/Graphics/particle/je_particle_system.h b/src/libjin/Graphics/particle/je_particle_system.h index c5db938..9ccb8df 100644 --- a/src/libjin/Graphics/particle/je_particle_system.h +++ b/src/libjin/Graphics/particle/je_particle_system.h @@ -4,6 +4,7 @@ #include #include "../../common/je_temporary.h" +#include "../../game/je_game_object.h" #include "../je_sprite.h" @@ -21,14 +22,16 @@ namespace JinEngine /// struct ParticleSystemDef : public Temporary { - uint maxParticleCount = 1; ///< Max count of particles. 1 by default. + uint maxParticleCount = 1; ///< Max count of particles in pool. 1 by default. + + ParticleEmitter emitterDef; }; /// /// Particle emitter, handle all particles it emitts. /// - class ParticleSystem + class ParticleSystem : public Game::GameObject { public: /// -- cgit v1.1-26-g67d0