From ed27508a566b6b8e0975c91af7f6e0810f43942e Mon Sep 17 00:00:00 2001
From: Rodrigo Oliveira
Date: Fri, 5 Apr 2024 14:58:21 -0300
Subject: [PATCH] Add Size to DrawInfo Component
---
.github/FUNDING.yml | 2 +-
.../Debug/net8.0/MonoDreams.Tests.AssemblyInfo.cs | 2 +-
.../MonoDreams.Tests.AssemblyInfoInputs.cache | 2 +-
.../obj/rider.project.model.nuget.info | 2 +-
MonoDreams.Tests/obj/rider.project.restore.info | 2 +-
MonoDreams/Component/DrawInfo.cs | 15 +++++----------
MonoDreams/MonoDreams.csproj | 2 +-
MonoDreams/README.md | 2 +-
MonoDreams/System/DrawSystem.cs | 3 ++-
README.md | 5 +++--
10 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index a191183..784faab 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,6 +1,6 @@
# These are supported funding model platforms
-github: allrod5
+github: roo-oliv
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
diff --git a/MonoDreams.Tests/obj/Debug/net8.0/MonoDreams.Tests.AssemblyInfo.cs b/MonoDreams.Tests/obj/Debug/net8.0/MonoDreams.Tests.AssemblyInfo.cs
index d4b64bd..67b2323 100644
--- a/MonoDreams.Tests/obj/Debug/net8.0/MonoDreams.Tests.AssemblyInfo.cs
+++ b/MonoDreams.Tests/obj/Debug/net8.0/MonoDreams.Tests.AssemblyInfo.cs
@@ -13,7 +13,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("MonoDreams.Tests")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4fc8b1926a91e241177675f4e1acd4b3df72cca6")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+fa134abf0db55e8ac084d652e9007c0c528d9f42")]
[assembly: System.Reflection.AssemblyProductAttribute("MonoDreams.Tests")]
[assembly: System.Reflection.AssemblyTitleAttribute("MonoDreams.Tests")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
diff --git a/MonoDreams.Tests/obj/Debug/net8.0/MonoDreams.Tests.AssemblyInfoInputs.cache b/MonoDreams.Tests/obj/Debug/net8.0/MonoDreams.Tests.AssemblyInfoInputs.cache
index 2550517..0ec3574 100644
--- a/MonoDreams.Tests/obj/Debug/net8.0/MonoDreams.Tests.AssemblyInfoInputs.cache
+++ b/MonoDreams.Tests/obj/Debug/net8.0/MonoDreams.Tests.AssemblyInfoInputs.cache
@@ -1 +1 @@
-e68c4eaa0fcc1c25d66de76d35646dde2725a12f686b32cd94543a38f3d9e0d7
+247bb53ef5ceecb041c4257fde7b901a44d7710457980b3a1fd2a5c3dcf69033
diff --git a/MonoDreams.Tests/obj/rider.project.model.nuget.info b/MonoDreams.Tests/obj/rider.project.model.nuget.info
index f7348f6..158c688 100644
--- a/MonoDreams.Tests/obj/rider.project.model.nuget.info
+++ b/MonoDreams.Tests/obj/rider.project.model.nuget.info
@@ -1 +1 @@
-17122612918497350
\ No newline at end of file
+17122646510223614
\ No newline at end of file
diff --git a/MonoDreams.Tests/obj/rider.project.restore.info b/MonoDreams.Tests/obj/rider.project.restore.info
index af64f4b..158c688 100644
--- a/MonoDreams.Tests/obj/rider.project.restore.info
+++ b/MonoDreams.Tests/obj/rider.project.restore.info
@@ -1 +1 @@
-17122612894097984
\ No newline at end of file
+17122646510223614
\ No newline at end of file
diff --git a/MonoDreams/Component/DrawInfo.cs b/MonoDreams/Component/DrawInfo.cs
index 9890e5e..9f66b90 100644
--- a/MonoDreams/Component/DrawInfo.cs
+++ b/MonoDreams/Component/DrawInfo.cs
@@ -6,20 +6,15 @@ namespace MonoDreams.Component;
public struct DrawInfo
{
public Texture2D SpriteSheet;
+ public Point Size;
public Rectangle Source;
public Color Color;
- public DrawInfo(Texture2D spriteSheet, Rectangle source, Color color)
+ public DrawInfo(Texture2D spriteSheet, Point? size = null, Rectangle? source = null, Color? color = null)
{
SpriteSheet = spriteSheet;
- Source = source;
- Color = color;
- }
-
- public DrawInfo(Texture2D texture, Color? color = null)
- {
- SpriteSheet = texture;
- Source = texture.Bounds;
- Color = color ?? Color.White;
+ Size = size ?? spriteSheet.Bounds.Size;
+ Source = source ?? spriteSheet.Bounds;
+ Color = color ?? Color.White;
}
}
\ No newline at end of file
diff --git a/MonoDreams/MonoDreams.csproj b/MonoDreams/MonoDreams.csproj
index c5852b4..1449ff3 100644
--- a/MonoDreams/MonoDreams.csproj
+++ b/MonoDreams/MonoDreams.csproj
@@ -13,7 +13,7 @@
Rodrigo Oliveira
- MonoDreams is a simple 2D game engine written in C# using the MonoGame framework. It is designed to be easy to use and to provide a simple way to create 2D games.
+ A code-first and data-driven opensource 2D game engine powered by MonoGame
https://github.com/roo-oliv/monodreams
game, engine, library, monogame, 2d, xna, monodreams
diff --git a/MonoDreams/README.md b/MonoDreams/README.md
index bc1490d..791b9c2 100644
--- a/MonoDreams/README.md
+++ b/MonoDreams/README.md
@@ -1,4 +1,4 @@
MonoDreams
==========
-MonoDreams is a simple 2D game engine written in C# using the MonoGame framework. It is designed to be easy to use and to provide a simple way to create 2D games.
\ No newline at end of file
+A code-first and data-driven opensource 2D game engine powered by MonoGame
\ No newline at end of file
diff --git a/MonoDreams/System/DrawSystem.cs b/MonoDreams/System/DrawSystem.cs
index 071ae8e..8690f61 100644
--- a/MonoDreams/System/DrawSystem.cs
+++ b/MonoDreams/System/DrawSystem.cs
@@ -57,7 +57,8 @@ protected override void Update(GameState state, in Entity entity)
drawInfo.Source = new Rectangle(frameWidth * animation.CurrentFrame, 0, frameWidth, drawInfo.SpriteSheet.Height);
}
- _batch.Draw(drawInfo.SpriteSheet, position.CurrentLocation, drawInfo.Source, drawInfo.Color);
+ var destination = new Rectangle(position.CurrentLocation.ToPoint(), drawInfo.Size);
+ _batch.Draw(drawInfo.SpriteSheet, destination, drawInfo.Source, drawInfo.Color);
}
protected override void PostUpdate(GameState state) => _batch.End();
diff --git a/README.md b/README.md
index 991ba5d..c128cbb 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ MonoDreams
-A powerful, flexible, and free 2D game engine powered by MonoGame
+A code-first and data-driven opensource 2D game engine powered by MonoGame
![NuGet Version](https://img.shields.io/nuget/vpre/MonoDreams?link=https%3A%2F%2Fwww.nuget.org%2Fpackages%2FMonoDreams%2F)
@@ -18,8 +18,9 @@ A powerful, flexible, and free 2D game engine powered by MonoGame
This is a hobby project of mine.
With no roadmap commitment, this project's goal is to create an opensource 2D game engine on top of Monogame and DefaultECS loaded with common systems for 2D games such as input handling, HUD, dialogue system, camera movement, sprite renderer, level importer, gravity and jumping logics, AABB collision detection and resolution, and more.
+MonoDreams is designed to be a code-first and data-driven engine, with a focus on ease of use and flexibility.
-[You can follow my tentative roadmap here.](https://github.com/users/allrod5/projects/1/views/1)
+[You can follow my tentative roadmap here.](https://github.com/users/roo-oliv/projects/1/views/1)
# Special Thanks
This project is intended to support and enable the gamedev community and I hope one day it will be a good starting point for many people to create their own games.