From c236e6dfd5a01c0051e9728f16346d18ab603f90 Mon Sep 17 00:00:00 2001 From: Dylan Wilson Date: Tue, 7 Mar 2017 22:08:31 +1000 Subject: [PATCH] moved the particle system and the entity component system into their own nuget packages --- .../Demo.EntityComponentSystem.csproj | 8 ++ .../Demos/Demo.EntityComponentSystem/Game1.cs | 7 +- .../Demo.Particles/Demo.Particles.csproj | 4 + .../Demo.Platformer/Demo.Platformer.csproj | 8 ++ .../Entities/Components/BasicCollisionBody.cs | 2 +- .../Components/BasicCollisionHandler.cs | 4 +- .../Entities/Components/EnemyAi.cs | 9 +- .../Demo.Platformer/Entities/EntityFactory.cs | 7 +- .../Entities/Systems/BasicCollisionSystem.cs | 2 +- .../Entities/Systems/EnemyMovementSystem.cs | 4 +- .../Entities/Systems/PlayerMovementSystem.cs | 3 +- Source/MonoGame.Extended.Entities.nuspec | 34 +++++++ .../Components/EntityComponent.cs | 36 +++++-- .../Entity.cs | 0 .../EntityComponentSystem.cs | 2 +- .../MonoGame.Extended.Entities.csproj | 65 +++++++++++++ .../Properties/AssemblyInfo.cs | 30 ++++++ .../Systems/AnimatedSpriteSystem.cs | 8 +- .../Systems/ComponentSystem.cs | 2 +- .../Systems/ParticleEmitterSystem.cs | 7 +- .../Systems/SpriteBatchSystem.cs | 18 ++-- .../packages.config | 4 + .../MonoGame.Extended.NuclexGui.csproj | 1 + Source/MonoGame.Extended.Particles.nuspec | 33 +++++++ .../ColorExtensions.cs | 0 .../FastRandomExtensions.cs | 0 .../HslColor.cs | 0 .../LineSegment.cs | 0 .../Modifiers/AgeModifier.cs | 0 .../Containers/CircleContainerModifier.cs | 0 .../Containers/RectangleContainerModifier.cs | 0 .../RectangleLoopContainerModifier.cs | 0 .../Modifiers/DragModifier.cs | 0 .../Modifiers/IModifier.cs | 0 .../Interpolators/ColorInterpolator.cs | 0 .../Interpolators/HueInterpolator.cs | 0 .../Modifiers/Interpolators/IInterpolator.cs | 0 .../Interpolators/OpacityInterpolator.cs | 0 .../Interpolators/RotationInterpolator.cs | 0 .../Interpolators/ScaleInterpolator.cs | 0 .../Modifiers/LinearGravityModifier.cs | 0 .../Modifiers/OpacityFastFadeModifier.cs | 0 .../Modifiers/RotationModifier.cs | 0 .../Modifiers/VelocityColorModifier.cs | 0 .../Modifiers/VelocityModifier.cs | 0 .../Modifiers/VortexModifier.cs | 0 .../MonoGame.Extended.Particles.csproj | 94 +++++++++++++++++++ .../Particle.cs | 0 .../ParticleBuffer.cs | 0 .../ParticleEffect.cs | 0 .../ParticleEmitter.cs | 3 +- .../ParticleExtensions.cs | 0 .../ParticleModifierExecutionStrategy.cs | 0 .../ParticleReleaseParameters.cs | 0 .../Profiles/BoxFillProfile.cs | 0 .../Profiles/BoxProfile.cs | 0 .../Profiles/BoxUniformProfile.cs | 0 .../Profiles/CircleProfile.cs | 0 .../Profiles/LineProfile.cs | 0 .../Profiles/PointProfile.cs | 0 .../Profiles/Profile.cs | 0 .../Profiles/RingProfile.cs | 0 .../Profiles/SprayProfile.cs | 0 .../Properties/AssemblyInfo.cs | 30 ++++++ .../packages.config | 4 + Source/MonoGame.Extended.sln | 20 ++++ .../MonoGame.Extended.csproj | 45 --------- Source/MonoGame.Extended/Sprites/Sprite.cs | 3 +- Source/MonoGame.Extended/Transform.cs | 2 +- .../MonoGame.Extended.Tests.csproj | 4 + Source/readme.txt | 2 + 71 files changed, 422 insertions(+), 83 deletions(-) create mode 100644 Source/MonoGame.Extended.Entities.nuspec rename Source/{MonoGame.Extended/Entities => MonoGame.Extended.Entities}/Components/EntityComponent.cs (58%) rename Source/{MonoGame.Extended/Entities => MonoGame.Extended.Entities}/Entity.cs (100%) rename Source/{MonoGame.Extended/Entities => MonoGame.Extended.Entities}/EntityComponentSystem.cs (98%) create mode 100644 Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj create mode 100644 Source/MonoGame.Extended.Entities/Properties/AssemblyInfo.cs rename Source/{MonoGame.Extended/Entities => MonoGame.Extended.Entities}/Systems/AnimatedSpriteSystem.cs (55%) rename Source/{MonoGame.Extended/Entities => MonoGame.Extended.Entities}/Systems/ComponentSystem.cs (95%) rename Source/{MonoGame.Extended/Entities => MonoGame.Extended.Entities}/Systems/ParticleEmitterSystem.cs (57%) rename Source/{MonoGame.Extended/Entities => MonoGame.Extended.Entities}/Systems/SpriteBatchSystem.cs (66%) create mode 100644 Source/MonoGame.Extended.Entities/packages.config create mode 100644 Source/MonoGame.Extended.Particles.nuspec rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/ColorExtensions.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/FastRandomExtensions.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/HslColor.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/LineSegment.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/AgeModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/Containers/CircleContainerModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/Containers/RectangleContainerModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/Containers/RectangleLoopContainerModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/DragModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/IModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/Interpolators/ColorInterpolator.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/Interpolators/HueInterpolator.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/Interpolators/IInterpolator.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/Interpolators/OpacityInterpolator.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/Interpolators/RotationInterpolator.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/Interpolators/ScaleInterpolator.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/LinearGravityModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/OpacityFastFadeModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/RotationModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/VelocityColorModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/VelocityModifier.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Modifiers/VortexModifier.cs (100%) create mode 100644 Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Particle.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/ParticleBuffer.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/ParticleEffect.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/ParticleEmitter.cs (97%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/ParticleExtensions.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/ParticleModifierExecutionStrategy.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/ParticleReleaseParameters.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Profiles/BoxFillProfile.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Profiles/BoxProfile.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Profiles/BoxUniformProfile.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Profiles/CircleProfile.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Profiles/LineProfile.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Profiles/PointProfile.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Profiles/Profile.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Profiles/RingProfile.cs (100%) rename Source/{MonoGame.Extended/Particles => MonoGame.Extended.Particles}/Profiles/SprayProfile.cs (100%) create mode 100644 Source/MonoGame.Extended.Particles/Properties/AssemblyInfo.cs create mode 100644 Source/MonoGame.Extended.Particles/packages.config diff --git a/Source/Demos/Demo.EntityComponentSystem/Demo.EntityComponentSystem.csproj b/Source/Demos/Demo.EntityComponentSystem/Demo.EntityComponentSystem.csproj index 0b4ef7e1..2a414a6f 100644 --- a/Source/Demos/Demo.EntityComponentSystem/Demo.EntityComponentSystem.csproj +++ b/Source/Demos/Demo.EntityComponentSystem/Demo.EntityComponentSystem.csproj @@ -110,6 +110,14 @@ + + {35fd1f05-af04-469a-b37a-f9b36c34401c} + MonoGame.Extended.Entities + + + {6c8b9e29-d09b-4901-80fd-45aaa35882c6} + MonoGame.Extended.Particles + {41724c52-3d50-45bb-81eb-3c8a247eafd1} MonoGame.Extended diff --git a/Source/Demos/Demo.EntityComponentSystem/Game1.cs b/Source/Demos/Demo.EntityComponentSystem/Game1.cs index 8bbc14d4..a2c23a1e 100644 --- a/Source/Demos/Demo.EntityComponentSystem/Game1.cs +++ b/Source/Demos/Demo.EntityComponentSystem/Game1.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Input; using MonoGame.Extended; using MonoGame.Extended.Animations.SpriteSheets; using MonoGame.Extended.Entities; +using MonoGame.Extended.Entities.Components; using MonoGame.Extended.Entities.Systems; using MonoGame.Extended.Particles; using MonoGame.Extended.Particles.Modifiers; @@ -46,7 +47,7 @@ namespace Demo.EntityComponentSystem var logoTexture = Content.Load("logo-square-128"); _entity = _entityComponentSystem.CreateEntity("logo", new Vector2(400, 240)); - _entity.AttachComponent(new Sprite(logoTexture)); + _entity.AttachComponent(new TransformableComponent(new Sprite(logoTexture))); var motwTexture = Content.Load("motw"); var motwAtlas = TextureAtlas.Create("motw-atlas", motwTexture, 52, 72); @@ -58,7 +59,7 @@ namespace Demo.EntityComponentSystem motwAnimationFactory.Add("walkNorth", new SpriteSheetAnimationData(new[] { 36, 37, 38, 37 }, isLooping: false)); var animatedEntity = _entityComponentSystem.CreateEntity("animated", new Vector2(50, 50)); - animatedEntity.AttachComponent(new AnimatedSprite(motwAnimationFactory, "walkSouth")); + animatedEntity.AttachComponent(new TransformableComponent(new AnimatedSprite(motwAnimationFactory, "walkSouth"))); var particleEntity = _entityComponentSystem.CreateEntity("particles", new Vector2(500, 50)); var particleEmitter = new ParticleEmitter(new TextureRegion2D(logoTexture), 500, TimeSpan.FromSeconds(0.5f), @@ -89,7 +90,7 @@ namespace Demo.EntityComponentSystem new LinearGravityModifier {Direction = -Vector2.UnitY, Strength = 130f} } }; - particleEntity.AttachComponent(particleEmitter); + particleEntity.AttachComponent(new TransformableComponent(particleEmitter)); } protected override void UnloadContent() diff --git a/Source/Demos/Demo.Particles/Demo.Particles.csproj b/Source/Demos/Demo.Particles/Demo.Particles.csproj index 47fde1b5..e28b4f24 100644 --- a/Source/Demos/Demo.Particles/Demo.Particles.csproj +++ b/Source/Demos/Demo.Particles/Demo.Particles.csproj @@ -109,6 +109,10 @@ + + {6c8b9e29-d09b-4901-80fd-45aaa35882c6} + MonoGame.Extended.Particles + {41724c52-3d50-45bb-81eb-3c8a247eafd1} MonoGame.Extended diff --git a/Source/Demos/Demo.Platformer/Demo.Platformer.csproj b/Source/Demos/Demo.Platformer/Demo.Platformer.csproj index 7c9edea3..4bcc2a9d 100644 --- a/Source/Demos/Demo.Platformer/Demo.Platformer.csproj +++ b/Source/Demos/Demo.Platformer/Demo.Platformer.csproj @@ -126,10 +126,18 @@ + + {35fd1f05-af04-469a-b37a-f9b36c34401c} + MonoGame.Extended.Entities + {9b3ab8a1-78aa-471a-afd0-b10b932115bc} MonoGame.Extended.Graphics + + {6c8b9e29-d09b-4901-80fd-45aaa35882c6} + MonoGame.Extended.Particles + {07b2ade2-73e3-41c4-aea1-d5566a5ab902} MonoGame.Extended.Tiled diff --git a/Source/Demos/Demo.Platformer/Entities/Components/BasicCollisionBody.cs b/Source/Demos/Demo.Platformer/Entities/Components/BasicCollisionBody.cs index 1dd9fa0c..4bdcd351 100644 --- a/Source/Demos/Demo.Platformer/Entities/Components/BasicCollisionBody.cs +++ b/Source/Demos/Demo.Platformer/Entities/Components/BasicCollisionBody.cs @@ -10,7 +10,7 @@ namespace Demo.Platformer.Entities.Components public Vector2 Velocity { get; set; } public Size2 Size { get; set; } public Vector2 Origin { get; set; } - public RectangleF BoundingRectangle => new RectangleF(Position - Size * Origin, Size); + public RectangleF BoundingRectangle => new RectangleF(Entity.Position - Size * Origin, Size); public bool IsStatic { get; set; } public object Tag { get; set; } diff --git a/Source/Demos/Demo.Platformer/Entities/Components/BasicCollisionHandler.cs b/Source/Demos/Demo.Platformer/Entities/Components/BasicCollisionHandler.cs index b0d26f35..c97f5b36 100644 --- a/Source/Demos/Demo.Platformer/Entities/Components/BasicCollisionHandler.cs +++ b/Source/Demos/Demo.Platformer/Entities/Components/BasicCollisionHandler.cs @@ -14,7 +14,7 @@ namespace Demo.Platformer.Entities.Components if (absDepthY < absDepthX) { - bodyA.Position += new Vector2(0, depth.Y); // move the player out of the ground or roof + bodyA.Entity.Position += new Vector2(0, depth.Y); // move the player out of the ground or roof var isOnGround = bodyA.Velocity.Y > 0; if (isOnGround) @@ -25,7 +25,7 @@ namespace Demo.Platformer.Entities.Components } else { - bodyA.Position += new Vector2(depth.X, 0); // move the player out of the wall + bodyA.Entity.Position += new Vector2(depth.X, 0); // move the player out of the wall bodyA.Velocity = new Vector2(bodyA.Velocity.X, bodyA.Velocity.Y < 0 ? 0 : bodyA.Velocity.Y); // drop the player down if they hit a wall } } diff --git a/Source/Demos/Demo.Platformer/Entities/Components/EnemyAi.cs b/Source/Demos/Demo.Platformer/Entities/Components/EnemyAi.cs index 7598721c..cab04f36 100644 --- a/Source/Demos/Demo.Platformer/Entities/Components/EnemyAi.cs +++ b/Source/Demos/Demo.Platformer/Entities/Components/EnemyAi.cs @@ -1,9 +1,10 @@ using Microsoft.Xna.Framework; +using MonoGame.Extended; using MonoGame.Extended.Entities.Components; namespace Demo.Platformer.Entities.Components { - public class EnemyAi : EntityComponent + public class EnemyAi : EntityComponent, IMovable { public EnemyAi() { @@ -15,5 +16,11 @@ namespace Demo.Platformer.Entities.Components public Vector2 Direction { get; set; } public float WalkTime { get; set; } public float WalkTimeRemaining { get; set; } + + public Vector2 Position + { + get { return Entity.Position; } + set { Entity.Position = value; } + } } } \ No newline at end of file diff --git a/Source/Demos/Demo.Platformer/Entities/EntityFactory.cs b/Source/Demos/Demo.Platformer/Entities/EntityFactory.cs index 7da26943..a138515f 100644 --- a/Source/Demos/Demo.Platformer/Entities/EntityFactory.cs +++ b/Source/Demos/Demo.Platformer/Entities/EntityFactory.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using MonoGame.Extended; using MonoGame.Extended.Animations.SpriteSheets; using MonoGame.Extended.Entities; +using MonoGame.Extended.Entities.Components; using MonoGame.Extended.Particles; using MonoGame.Extended.Particles.Modifiers; using MonoGame.Extended.Particles.Profiles; @@ -47,7 +48,7 @@ namespace Demo.Platformer.Entities animationFactory.Add("walk", new SpriteSheetAnimationData(new[] { 0, 1, 2, 3 })); animationFactory.Add("jump", new SpriteSheetAnimationData(new[] { 8, 9 }, isLooping: false)); - entity.AttachComponent(new AnimatedSprite(animationFactory)); + entity.AttachComponent(new TransformableComponent(new AnimatedSprite(animationFactory))); entity.AttachComponent(new BasicCollisionBody(textureRegion.Size, Vector2.One * 0.5f)); entity.AttachComponent(new PlayerCollisionHandler()); entity.AttachComponent(new CharacterState()); @@ -92,7 +93,7 @@ namespace Demo.Platformer.Entities new RotationModifier { RotationRate = random.NextSingle(-MathHelper.TwoPi, MathHelper.TwoPi) } } }; - entity.AttachComponent(particleEmitter); + entity.AttachComponent(new TransformableComponent(particleEmitter)); entity.Destroy(delaySeconds: totalSeconds); return entity; } @@ -106,7 +107,7 @@ namespace Demo.Platformer.Entities animationFactory.Add("idle", new SpriteSheetAnimationData(new[] { 100 }, 1.0f)); animationFactory.Add("walk", new SpriteSheetAnimationData(new[] { 96, 97, 98, 99 }, isPingPong: true)); - entity.AttachComponent(new AnimatedSprite(animationFactory, "walk")); + entity.AttachComponent(new TransformableComponent(new AnimatedSprite(animationFactory, "walk"))); entity.AttachComponent(new BasicCollisionBody(textureRegion.Size, Vector2.One * 0.5f) {Tag = "Deadly"}); entity.AttachComponent(new EnemyCollisionHandler()); entity.AttachComponent(new CharacterState()); diff --git a/Source/Demos/Demo.Platformer/Entities/Systems/BasicCollisionSystem.cs b/Source/Demos/Demo.Platformer/Entities/Systems/BasicCollisionSystem.cs index fecbd5ff..c3ad26d4 100644 --- a/Source/Demos/Demo.Platformer/Entities/Systems/BasicCollisionSystem.cs +++ b/Source/Demos/Demo.Platformer/Entities/Systems/BasicCollisionSystem.cs @@ -56,7 +56,7 @@ namespace Demo.Platformer.Entities.Systems foreach (var bodyA in _movingBodies) { bodyA.Velocity += _gravity * deltaTime; - bodyA.Position += bodyA.Velocity * deltaTime; + bodyA.Entity.Position += bodyA.Velocity * deltaTime; foreach (var bodyB in _staticBodies.Concat(_movingBodies)) { diff --git a/Source/Demos/Demo.Platformer/Entities/Systems/EnemyMovementSystem.cs b/Source/Demos/Demo.Platformer/Entities/Systems/EnemyMovementSystem.cs index 73ee6b35..997bca4a 100644 --- a/Source/Demos/Demo.Platformer/Entities/Systems/EnemyMovementSystem.cs +++ b/Source/Demos/Demo.Platformer/Entities/Systems/EnemyMovementSystem.cs @@ -2,6 +2,7 @@ using Demo.Platformer.Entities.Components; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoGame.Extended; +using MonoGame.Extended.Entities.Components; using MonoGame.Extended.Entities.Systems; using MonoGame.Extended.Sprites; @@ -20,7 +21,8 @@ namespace Demo.Platformer.Entities.Systems if (component.WalkTimeRemaining <= 0) { - var sprite = component.Entity.GetComponent(); + var transformableComponent = component.Entity.GetComponent>(); + var sprite = transformableComponent.Target; sprite.Effect = sprite.Effect == SpriteEffects.None ? SpriteEffects.FlipHorizontally : SpriteEffects.None; component.Direction = -component.Direction; component.WalkTimeRemaining = component.WalkTime; diff --git a/Source/Demos/Demo.Platformer/Entities/Systems/PlayerMovementSystem.cs b/Source/Demos/Demo.Platformer/Entities/Systems/PlayerMovementSystem.cs index ba401822..39afb720 100644 --- a/Source/Demos/Demo.Platformer/Entities/Systems/PlayerMovementSystem.cs +++ b/Source/Demos/Demo.Platformer/Entities/Systems/PlayerMovementSystem.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using MonoGame.Extended; using MonoGame.Extended.Entities; +using MonoGame.Extended.Entities.Components; using MonoGame.Extended.Entities.Systems; using MonoGame.Extended.Sprites; @@ -43,7 +44,7 @@ namespace Demo.Platformer.Entities.Systems var keyboardState = Keyboard.GetState(); var body = _playerEntity.GetComponent(); var playerState = _playerEntity.GetComponent(); - var sprite = _playerEntity.GetComponent(); + var sprite = _playerEntity.GetComponent>().Target as AnimatedSprite; var velocity = new Vector2(0, body.Velocity.Y); if (keyboardState.IsKeyDown(Keys.Left) || keyboardState.IsKeyDown(Keys.A)) diff --git a/Source/MonoGame.Extended.Entities.nuspec b/Source/MonoGame.Extended.Entities.nuspec new file mode 100644 index 00000000..b83f2530 --- /dev/null +++ b/Source/MonoGame.Extended.Entities.nuspec @@ -0,0 +1,34 @@ + + + + + MonoGame.Extended.Entities + $version$ + + An Entity Component System for MonoGame to make MonoGame more awesome. + + Dylan Wilson + MonoGame.Extended.Entities + Craftwork Games + https://github.com/craftworkgames/MonoGame.Extended + https://github.com/craftworkgames/MonoGame.Extended/blob/master/LICENSE + https://raw.githubusercontent.com/craftworkgames/MonoGame.Extended/master/Logos/logo-nuget-128.png + false + + Copyright 2017 - Craftwork Games + monogame extended entity component system ecs + + + + + + + + + + + + + + + diff --git a/Source/MonoGame.Extended/Entities/Components/EntityComponent.cs b/Source/MonoGame.Extended.Entities/Components/EntityComponent.cs similarity index 58% rename from Source/MonoGame.Extended/Entities/Components/EntityComponent.cs rename to Source/MonoGame.Extended.Entities/Components/EntityComponent.cs index 84895dfa..e32d45ea 100644 --- a/Source/MonoGame.Extended/Entities/Components/EntityComponent.cs +++ b/Source/MonoGame.Extended.Entities/Components/EntityComponent.cs @@ -2,12 +2,10 @@ using Microsoft.Xna.Framework; namespace MonoGame.Extended.Entities.Components { - public abstract class EntityComponent : IMovable, IRotatable, IScalable + public abstract class EntityComponent : IMovable, IRotatable, IScalable { private Vector2 _position; - private float _rotation; - private Vector2 _scale; protected EntityComponent() @@ -16,7 +14,7 @@ namespace MonoGame.Extended.Entities.Components public Entity Entity { get; internal set; } - public Vector2 Position + public virtual Vector2 Position { get { return Entity?.Position ?? _position; } set @@ -28,7 +26,7 @@ namespace MonoGame.Extended.Entities.Components } } - public float Rotation + public virtual float Rotation { get { return Entity?.Rotation ?? _rotation; } set @@ -40,7 +38,7 @@ namespace MonoGame.Extended.Entities.Components } } - public Vector2 Scale + public virtual Vector2 Scale { get { return Entity?.Scale ?? _scale; } set @@ -52,4 +50,30 @@ namespace MonoGame.Extended.Entities.Components } } } + + + public class TransformableComponent : EntityComponent, IMovable, IRotatable, IScalable + where T : Transform2D + { + public TransformableComponent(T transformable) + { + _target = transformable; + } + + private readonly T _target; + public T Target + { + get + { + if (Entity != null) + { + _target.Position = Entity.Position; + _target.Rotation = Entity.Rotation; + _target.Scale = Entity.Scale; + } + + return _target; + } + } + } } \ No newline at end of file diff --git a/Source/MonoGame.Extended/Entities/Entity.cs b/Source/MonoGame.Extended.Entities/Entity.cs similarity index 100% rename from Source/MonoGame.Extended/Entities/Entity.cs rename to Source/MonoGame.Extended.Entities/Entity.cs diff --git a/Source/MonoGame.Extended/Entities/EntityComponentSystem.cs b/Source/MonoGame.Extended.Entities/EntityComponentSystem.cs similarity index 98% rename from Source/MonoGame.Extended/Entities/EntityComponentSystem.cs rename to Source/MonoGame.Extended.Entities/EntityComponentSystem.cs index df44d450..274b14b4 100644 --- a/Source/MonoGame.Extended/Entities/EntityComponentSystem.cs +++ b/Source/MonoGame.Extended.Entities/EntityComponentSystem.cs @@ -112,7 +112,7 @@ namespace MonoGame.Extended.Entities ComponentDetached?.Invoke(this, component); } - internal IEnumerable GetComponents() + internal IEnumerable GetComponents() where T : EntityComponent { return _components.OfType(); } diff --git a/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj b/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj new file mode 100644 index 00000000..4f4b79dd --- /dev/null +++ b/Source/MonoGame.Extended.Entities/MonoGame.Extended.Entities.csproj @@ -0,0 +1,65 @@ + + + + + 10.0 + Debug + AnyCPU + {35FD1F05-AF04-469A-B37A-F9B36C34401C} + Library + MonoGame.Extended.Entities + MonoGame.Extended.Entities + en-US + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Profile111 + v4.5 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + {6c8b9e29-d09b-4901-80fd-45aaa35882c6} + MonoGame.Extended.Particles + + + {41724c52-3d50-45bb-81eb-3c8a247eafd1} + MonoGame.Extended + + + + + + + + + + + + + + + ..\packages\MonoGame.Framework.Portable.3.6.0.1625\lib\portable-net45+win8+wpa81\MonoGame.Framework.dll + + + + + + + \ No newline at end of file diff --git a/Source/MonoGame.Extended.Entities/Properties/AssemblyInfo.cs b/Source/MonoGame.Extended.Entities/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..381ec233 --- /dev/null +++ b/Source/MonoGame.Extended.Entities/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Resources; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MonoGame.Extended.Entities")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MonoGame.Extended.Entities")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Source/MonoGame.Extended/Entities/Systems/AnimatedSpriteSystem.cs b/Source/MonoGame.Extended.Entities/Systems/AnimatedSpriteSystem.cs similarity index 55% rename from Source/MonoGame.Extended/Entities/Systems/AnimatedSpriteSystem.cs rename to Source/MonoGame.Extended.Entities/Systems/AnimatedSpriteSystem.cs index 244f733e..d0d7d7c3 100644 --- a/Source/MonoGame.Extended/Entities/Systems/AnimatedSpriteSystem.cs +++ b/Source/MonoGame.Extended.Entities/Systems/AnimatedSpriteSystem.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using System.Linq; +using Microsoft.Xna.Framework; +using MonoGame.Extended.Entities.Components; using MonoGame.Extended.Sprites; namespace MonoGame.Extended.Entities.Systems @@ -8,9 +10,9 @@ namespace MonoGame.Extended.Entities.Systems public override void Update(GameTime gameTime) { var deltaTime = gameTime.GetElapsedSeconds(); - var sprites = GetComponents(); + var sprites = GetComponents>(); - foreach (var animatedSprite in sprites) + foreach (var animatedSprite in sprites.Select(c => c.Target).OfType()) animatedSprite.Update(deltaTime); } } diff --git a/Source/MonoGame.Extended/Entities/Systems/ComponentSystem.cs b/Source/MonoGame.Extended.Entities/Systems/ComponentSystem.cs similarity index 95% rename from Source/MonoGame.Extended/Entities/Systems/ComponentSystem.cs rename to Source/MonoGame.Extended.Entities/Systems/ComponentSystem.cs index cb6c9e5e..fb3c83c2 100644 --- a/Source/MonoGame.Extended/Entities/Systems/ComponentSystem.cs +++ b/Source/MonoGame.Extended.Entities/Systems/ComponentSystem.cs @@ -33,7 +33,7 @@ namespace MonoGame.Extended.Entities.Systems } } - protected IEnumerable GetComponents() + protected IEnumerable GetComponents() where T : EntityComponent { return Parent.GetComponents(); } diff --git a/Source/MonoGame.Extended/Entities/Systems/ParticleEmitterSystem.cs b/Source/MonoGame.Extended.Entities/Systems/ParticleEmitterSystem.cs similarity index 57% rename from Source/MonoGame.Extended/Entities/Systems/ParticleEmitterSystem.cs rename to Source/MonoGame.Extended.Entities/Systems/ParticleEmitterSystem.cs index 11e8f947..c5b3314c 100644 --- a/Source/MonoGame.Extended/Entities/Systems/ParticleEmitterSystem.cs +++ b/Source/MonoGame.Extended.Entities/Systems/ParticleEmitterSystem.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using MonoGame.Extended.Entities.Components; using MonoGame.Extended.Particles; namespace MonoGame.Extended.Entities.Systems @@ -8,10 +9,10 @@ namespace MonoGame.Extended.Entities.Systems public override void Update(GameTime gameTime) { var deltaTime = gameTime.GetElapsedSeconds(); - var emitters = GetComponents(); + var components = GetComponents>(); - foreach (var particleEmitter in emitters) - particleEmitter.Update(deltaTime); + foreach (var component in components) + component.Target.Update(deltaTime); } } } \ No newline at end of file diff --git a/Source/MonoGame.Extended/Entities/Systems/SpriteBatchSystem.cs b/Source/MonoGame.Extended.Entities/Systems/SpriteBatchSystem.cs similarity index 66% rename from Source/MonoGame.Extended/Entities/Systems/SpriteBatchSystem.cs rename to Source/MonoGame.Extended.Entities/Systems/SpriteBatchSystem.cs index d038a466..0ccc8538 100644 --- a/Source/MonoGame.Extended/Entities/Systems/SpriteBatchSystem.cs +++ b/Source/MonoGame.Extended.Entities/Systems/SpriteBatchSystem.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using MonoGame.Extended.Entities.Components; using MonoGame.Extended.Particles; using MonoGame.Extended.Sprites; @@ -25,18 +26,23 @@ namespace MonoGame.Extended.Entities.Systems public override void Draw(GameTime gameTime) { - var sprites = GetComponents(); - var emitters = GetComponents(); + var spriteComponents = GetComponents>(); + var particleEmitterComponents = GetComponents>(); var transformMatrix = _camera.GetViewMatrix(); - _spriteBatch.Begin(SortMode, BlendState, SamplerState, DepthStencilState, RasterizerState, Effect, - transformMatrix); + _spriteBatch.Begin(SortMode, BlendState, SamplerState, DepthStencilState, RasterizerState, Effect, transformMatrix); - foreach (var sprite in sprites) + foreach (var spriteComponent in spriteComponents) + { + var sprite = spriteComponent.Target; _spriteBatch.Draw(sprite); + } - foreach (var particleEmitter in emitters) + foreach (var particleEmitterComponent in particleEmitterComponents) + { + var particleEmitter = particleEmitterComponent.Target; _spriteBatch.Draw(particleEmitter); + } _spriteBatch.End(); } diff --git a/Source/MonoGame.Extended.Entities/packages.config b/Source/MonoGame.Extended.Entities/packages.config new file mode 100644 index 00000000..28c01444 --- /dev/null +++ b/Source/MonoGame.Extended.Entities/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj b/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj index b8ab4fc4..0d03da55 100644 --- a/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj +++ b/Source/MonoGame.Extended.NuclexGui/MonoGame.Extended.NuclexGui.csproj @@ -23,6 +23,7 @@ DEBUG;TRACE prompt 4 + 6 pdbonly diff --git a/Source/MonoGame.Extended.Particles.nuspec b/Source/MonoGame.Extended.Particles.nuspec new file mode 100644 index 00000000..36aebfe9 --- /dev/null +++ b/Source/MonoGame.Extended.Particles.nuspec @@ -0,0 +1,33 @@ + + + + + MonoGame.Extended.Particles + $version$ + + A high performance particle system to make MonoGame more awesome. + + Dylan Wilson + MonoGame.Extended.Particles + Craftwork Games + https://github.com/craftworkgames/MonoGame.Extended + https://github.com/craftworkgames/MonoGame.Extended/blob/master/LICENSE + https://raw.githubusercontent.com/craftworkgames/MonoGame.Extended/master/Logos/logo-nuget-128.png + false + + Copyright 2017 - Craftwork Games + monogame extended particle system + + + + + + + + + + + + + + diff --git a/Source/MonoGame.Extended/Particles/ColorExtensions.cs b/Source/MonoGame.Extended.Particles/ColorExtensions.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/ColorExtensions.cs rename to Source/MonoGame.Extended.Particles/ColorExtensions.cs diff --git a/Source/MonoGame.Extended/Particles/FastRandomExtensions.cs b/Source/MonoGame.Extended.Particles/FastRandomExtensions.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/FastRandomExtensions.cs rename to Source/MonoGame.Extended.Particles/FastRandomExtensions.cs diff --git a/Source/MonoGame.Extended/Particles/HslColor.cs b/Source/MonoGame.Extended.Particles/HslColor.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/HslColor.cs rename to Source/MonoGame.Extended.Particles/HslColor.cs diff --git a/Source/MonoGame.Extended/Particles/LineSegment.cs b/Source/MonoGame.Extended.Particles/LineSegment.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/LineSegment.cs rename to Source/MonoGame.Extended.Particles/LineSegment.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/AgeModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/AgeModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/AgeModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/AgeModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/Containers/CircleContainerModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/Containers/CircleContainerModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/Containers/CircleContainerModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/Containers/CircleContainerModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/Containers/RectangleContainerModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/Containers/RectangleContainerModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/Containers/RectangleContainerModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/Containers/RectangleContainerModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/Containers/RectangleLoopContainerModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/Containers/RectangleLoopContainerModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/Containers/RectangleLoopContainerModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/Containers/RectangleLoopContainerModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/DragModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/DragModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/DragModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/DragModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/IModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/IModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/IModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/IModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/Interpolators/ColorInterpolator.cs b/Source/MonoGame.Extended.Particles/Modifiers/Interpolators/ColorInterpolator.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/Interpolators/ColorInterpolator.cs rename to Source/MonoGame.Extended.Particles/Modifiers/Interpolators/ColorInterpolator.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/Interpolators/HueInterpolator.cs b/Source/MonoGame.Extended.Particles/Modifiers/Interpolators/HueInterpolator.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/Interpolators/HueInterpolator.cs rename to Source/MonoGame.Extended.Particles/Modifiers/Interpolators/HueInterpolator.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/Interpolators/IInterpolator.cs b/Source/MonoGame.Extended.Particles/Modifiers/Interpolators/IInterpolator.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/Interpolators/IInterpolator.cs rename to Source/MonoGame.Extended.Particles/Modifiers/Interpolators/IInterpolator.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/Interpolators/OpacityInterpolator.cs b/Source/MonoGame.Extended.Particles/Modifiers/Interpolators/OpacityInterpolator.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/Interpolators/OpacityInterpolator.cs rename to Source/MonoGame.Extended.Particles/Modifiers/Interpolators/OpacityInterpolator.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/Interpolators/RotationInterpolator.cs b/Source/MonoGame.Extended.Particles/Modifiers/Interpolators/RotationInterpolator.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/Interpolators/RotationInterpolator.cs rename to Source/MonoGame.Extended.Particles/Modifiers/Interpolators/RotationInterpolator.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/Interpolators/ScaleInterpolator.cs b/Source/MonoGame.Extended.Particles/Modifiers/Interpolators/ScaleInterpolator.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/Interpolators/ScaleInterpolator.cs rename to Source/MonoGame.Extended.Particles/Modifiers/Interpolators/ScaleInterpolator.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/LinearGravityModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/LinearGravityModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/LinearGravityModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/LinearGravityModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/OpacityFastFadeModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/OpacityFastFadeModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/OpacityFastFadeModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/OpacityFastFadeModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/RotationModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/RotationModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/RotationModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/RotationModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/VelocityColorModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/VelocityColorModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/VelocityColorModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/VelocityColorModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/VelocityModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/VelocityModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/VelocityModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/VelocityModifier.cs diff --git a/Source/MonoGame.Extended/Particles/Modifiers/VortexModifier.cs b/Source/MonoGame.Extended.Particles/Modifiers/VortexModifier.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Modifiers/VortexModifier.cs rename to Source/MonoGame.Extended.Particles/Modifiers/VortexModifier.cs diff --git a/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj b/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj new file mode 100644 index 00000000..500d12a5 --- /dev/null +++ b/Source/MonoGame.Extended.Particles/MonoGame.Extended.Particles.csproj @@ -0,0 +1,94 @@ + + + + + 10.0 + Debug + AnyCPU + {6C8B9E29-D09B-4901-80FD-45AAA35882C6} + Library + MonoGame.Extended.Particles + MonoGame.Extended.Particles + en-US + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Profile111 + v4.5 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + 6 + true + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + {41724c52-3d50-45bb-81eb-3c8a247eafd1} + MonoGame.Extended + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ..\packages\MonoGame.Framework.Portable.3.6.0.1625\lib\portable-net45+win8+wpa81\MonoGame.Framework.dll + + + + + + + \ No newline at end of file diff --git a/Source/MonoGame.Extended/Particles/Particle.cs b/Source/MonoGame.Extended.Particles/Particle.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Particle.cs rename to Source/MonoGame.Extended.Particles/Particle.cs diff --git a/Source/MonoGame.Extended/Particles/ParticleBuffer.cs b/Source/MonoGame.Extended.Particles/ParticleBuffer.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/ParticleBuffer.cs rename to Source/MonoGame.Extended.Particles/ParticleBuffer.cs diff --git a/Source/MonoGame.Extended/Particles/ParticleEffect.cs b/Source/MonoGame.Extended.Particles/ParticleEffect.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/ParticleEffect.cs rename to Source/MonoGame.Extended.Particles/ParticleEffect.cs diff --git a/Source/MonoGame.Extended/Particles/ParticleEmitter.cs b/Source/MonoGame.Extended.Particles/ParticleEmitter.cs similarity index 97% rename from Source/MonoGame.Extended/Particles/ParticleEmitter.cs rename to Source/MonoGame.Extended.Particles/ParticleEmitter.cs index 26f0b984..52929da0 100644 --- a/Source/MonoGame.Extended/Particles/ParticleEmitter.cs +++ b/Source/MonoGame.Extended.Particles/ParticleEmitter.cs @@ -1,13 +1,12 @@ using System; using Microsoft.Xna.Framework; -using MonoGame.Extended.Entities.Components; using MonoGame.Extended.Particles.Modifiers; using MonoGame.Extended.Particles.Profiles; using MonoGame.Extended.TextureAtlases; namespace MonoGame.Extended.Particles { - public unsafe class ParticleEmitter : EntityComponent, IDisposable + public unsafe class ParticleEmitter : Transform2D, IDisposable { private readonly FastRandom _random = new FastRandom(); private readonly float _term; diff --git a/Source/MonoGame.Extended/Particles/ParticleExtensions.cs b/Source/MonoGame.Extended.Particles/ParticleExtensions.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/ParticleExtensions.cs rename to Source/MonoGame.Extended.Particles/ParticleExtensions.cs diff --git a/Source/MonoGame.Extended/Particles/ParticleModifierExecutionStrategy.cs b/Source/MonoGame.Extended.Particles/ParticleModifierExecutionStrategy.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/ParticleModifierExecutionStrategy.cs rename to Source/MonoGame.Extended.Particles/ParticleModifierExecutionStrategy.cs diff --git a/Source/MonoGame.Extended/Particles/ParticleReleaseParameters.cs b/Source/MonoGame.Extended.Particles/ParticleReleaseParameters.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/ParticleReleaseParameters.cs rename to Source/MonoGame.Extended.Particles/ParticleReleaseParameters.cs diff --git a/Source/MonoGame.Extended/Particles/Profiles/BoxFillProfile.cs b/Source/MonoGame.Extended.Particles/Profiles/BoxFillProfile.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Profiles/BoxFillProfile.cs rename to Source/MonoGame.Extended.Particles/Profiles/BoxFillProfile.cs diff --git a/Source/MonoGame.Extended/Particles/Profiles/BoxProfile.cs b/Source/MonoGame.Extended.Particles/Profiles/BoxProfile.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Profiles/BoxProfile.cs rename to Source/MonoGame.Extended.Particles/Profiles/BoxProfile.cs diff --git a/Source/MonoGame.Extended/Particles/Profiles/BoxUniformProfile.cs b/Source/MonoGame.Extended.Particles/Profiles/BoxUniformProfile.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Profiles/BoxUniformProfile.cs rename to Source/MonoGame.Extended.Particles/Profiles/BoxUniformProfile.cs diff --git a/Source/MonoGame.Extended/Particles/Profiles/CircleProfile.cs b/Source/MonoGame.Extended.Particles/Profiles/CircleProfile.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Profiles/CircleProfile.cs rename to Source/MonoGame.Extended.Particles/Profiles/CircleProfile.cs diff --git a/Source/MonoGame.Extended/Particles/Profiles/LineProfile.cs b/Source/MonoGame.Extended.Particles/Profiles/LineProfile.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Profiles/LineProfile.cs rename to Source/MonoGame.Extended.Particles/Profiles/LineProfile.cs diff --git a/Source/MonoGame.Extended/Particles/Profiles/PointProfile.cs b/Source/MonoGame.Extended.Particles/Profiles/PointProfile.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Profiles/PointProfile.cs rename to Source/MonoGame.Extended.Particles/Profiles/PointProfile.cs diff --git a/Source/MonoGame.Extended/Particles/Profiles/Profile.cs b/Source/MonoGame.Extended.Particles/Profiles/Profile.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Profiles/Profile.cs rename to Source/MonoGame.Extended.Particles/Profiles/Profile.cs diff --git a/Source/MonoGame.Extended/Particles/Profiles/RingProfile.cs b/Source/MonoGame.Extended.Particles/Profiles/RingProfile.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Profiles/RingProfile.cs rename to Source/MonoGame.Extended.Particles/Profiles/RingProfile.cs diff --git a/Source/MonoGame.Extended/Particles/Profiles/SprayProfile.cs b/Source/MonoGame.Extended.Particles/Profiles/SprayProfile.cs similarity index 100% rename from Source/MonoGame.Extended/Particles/Profiles/SprayProfile.cs rename to Source/MonoGame.Extended.Particles/Profiles/SprayProfile.cs diff --git a/Source/MonoGame.Extended.Particles/Properties/AssemblyInfo.cs b/Source/MonoGame.Extended.Particles/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..1940879e --- /dev/null +++ b/Source/MonoGame.Extended.Particles/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Resources; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MonoGame.Extended.Particles")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MonoGame.Extended.Particles")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Source/MonoGame.Extended.Particles/packages.config b/Source/MonoGame.Extended.Particles/packages.config new file mode 100644 index 00000000..28c01444 --- /dev/null +++ b/Source/MonoGame.Extended.Particles/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Source/MonoGame.Extended.sln b/Source/MonoGame.Extended.sln index bcd66df2..2403baa8 100644 --- a/Source/MonoGame.Extended.sln +++ b/Source/MonoGame.Extended.sln @@ -156,6 +156,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Extended.Tiled.Tes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Extended.NuclexGui", "MonoGame.Extended.NuclexGui\MonoGame.Extended.NuclexGui.csproj", "{D8BC4F21-E71D-46CE-B6D3-259F1E0DFABA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Extended.Particles", "MonoGame.Extended.Particles\MonoGame.Extended.Particles.csproj", "{6C8B9E29-D09B-4901-80FD-45AAA35882C6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Extended.Entities", "MonoGame.Extended.Entities\MonoGame.Extended.Entities.csproj", "{35FD1F05-AF04-469A-B37A-F9B36C34401C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -404,6 +408,22 @@ Global {D8BC4F21-E71D-46CE-B6D3-259F1E0DFABA}.Release|Any CPU.Build.0 = Release|Any CPU {D8BC4F21-E71D-46CE-B6D3-259F1E0DFABA}.Release|x86.ActiveCfg = Release|Any CPU {D8BC4F21-E71D-46CE-B6D3-259F1E0DFABA}.Release|x86.Build.0 = Release|Any CPU + {6C8B9E29-D09B-4901-80FD-45AAA35882C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C8B9E29-D09B-4901-80FD-45AAA35882C6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C8B9E29-D09B-4901-80FD-45AAA35882C6}.Debug|x86.ActiveCfg = Debug|Any CPU + {6C8B9E29-D09B-4901-80FD-45AAA35882C6}.Debug|x86.Build.0 = Debug|Any CPU + {6C8B9E29-D09B-4901-80FD-45AAA35882C6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C8B9E29-D09B-4901-80FD-45AAA35882C6}.Release|Any CPU.Build.0 = Release|Any CPU + {6C8B9E29-D09B-4901-80FD-45AAA35882C6}.Release|x86.ActiveCfg = Release|Any CPU + {6C8B9E29-D09B-4901-80FD-45AAA35882C6}.Release|x86.Build.0 = Release|Any CPU + {35FD1F05-AF04-469A-B37A-F9B36C34401C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {35FD1F05-AF04-469A-B37A-F9B36C34401C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {35FD1F05-AF04-469A-B37A-F9B36C34401C}.Debug|x86.ActiveCfg = Debug|Any CPU + {35FD1F05-AF04-469A-B37A-F9B36C34401C}.Debug|x86.Build.0 = Debug|Any CPU + {35FD1F05-AF04-469A-B37A-F9B36C34401C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {35FD1F05-AF04-469A-B37A-F9B36C34401C}.Release|Any CPU.Build.0 = Release|Any CPU + {35FD1F05-AF04-469A-B37A-F9B36C34401C}.Release|x86.ActiveCfg = Release|Any CPU + {35FD1F05-AF04-469A-B37A-F9B36C34401C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Source/MonoGame.Extended/MonoGame.Extended.csproj b/Source/MonoGame.Extended/MonoGame.Extended.csproj index 957d6103..395c7311 100644 --- a/Source/MonoGame.Extended/MonoGame.Extended.csproj +++ b/Source/MonoGame.Extended/MonoGame.Extended.csproj @@ -78,13 +78,6 @@ - - - - - - - @@ -127,45 +120,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/MonoGame.Extended/Sprites/Sprite.cs b/Source/MonoGame.Extended/Sprites/Sprite.cs index 07dd1e89..89bcc6b6 100644 --- a/Source/MonoGame.Extended/Sprites/Sprite.cs +++ b/Source/MonoGame.Extended/Sprites/Sprite.cs @@ -2,14 +2,13 @@ using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using MonoGame.Extended.Entities.Components; using MonoGame.Extended.SceneGraphs; using MonoGame.Extended.Shapes; using MonoGame.Extended.TextureAtlases; namespace MonoGame.Extended.Sprites { - public class Sprite : EntityComponent, IColorable, ISceneEntity, ISpriteBatchDrawable + public class Sprite : Transform2D, IColorable, ISceneEntity, ISpriteBatchDrawable { private TextureRegion2D _textureRegion; diff --git a/Source/MonoGame.Extended/Transform.cs b/Source/MonoGame.Extended/Transform.cs index cc4bee71..3db7f377 100644 --- a/Source/MonoGame.Extended/Transform.cs +++ b/Source/MonoGame.Extended/Transform.cs @@ -27,7 +27,7 @@ namespace MonoGame.Extended /// objects hierarchically. /// /// - /// This class shouldn't be used directly. Instead use either of the derived classes; or + /// This class shouldn't be used directly. Instead use either of the derived classes; or /// Transform3D. /// /// diff --git a/Source/Tests/MonoGame.Extended.Tests/MonoGame.Extended.Tests.csproj b/Source/Tests/MonoGame.Extended.Tests/MonoGame.Extended.Tests.csproj index ff1ecdc2..baf31c27 100644 --- a/Source/Tests/MonoGame.Extended.Tests/MonoGame.Extended.Tests.csproj +++ b/Source/Tests/MonoGame.Extended.Tests/MonoGame.Extended.Tests.csproj @@ -95,6 +95,10 @@ {9B3AB8A1-78AA-471A-AFD0-B10B932115BC} MonoGame.Extended.Graphics + + {6c8b9e29-d09b-4901-80fd-45aaa35882c6} + MonoGame.Extended.Particles + {07B2ADE2-73E3-41C4-AEA1-D5566A5AB902} MonoGame.Extended.Tiled diff --git a/Source/readme.txt b/Source/readme.txt index f9bf09d8..a3f23845 100644 --- a/Source/readme.txt +++ b/Source/readme.txt @@ -18,4 +18,6 @@ There's also a few other NuGet packages available including: - MonoGame.Extended.Graphics - MonoGame.Extended.Gui - MonoGame.Extended.NuclexGui + - MonoGame.Particles + - MonoGame.Entities - and more to come...