Skip to content

Commit

Permalink
Bugfix: location not working in source rectangle.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezequias2d committed Nov 24, 2021
1 parent 1050d84 commit 04e186d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Peridot.Demo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

var size = new Vector2(texture.Width, texture.Height);
var pos = size * -0.5f;
var source = new System.Drawing.Rectangle(0, 0, (int)texture.Width / 2, (int)texture.Height / 2);
var source = new System.Drawing.Rectangle((int)texture.Width / 2, (int)texture.Height / 2, (int)texture.Width / 2, (int)texture.Height / 2);

sb.Draw(texture, default, source, Color.White, 0, new(-size.X / 6, 0), Vector2.One, 1f);
tr.DrawString(font, 32, "Hello World!", new Vector2(1, 1), Color.White, 0, new Vector2(0, 0), new Vector2(1), 0f);
Expand Down
2 changes: 1 addition & 1 deletion src/Peridot/BatchItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public BatchItem(Vector2 textureSize,
float layerDepth)
{
var sourceSize = new Vector2(sourceRectangle.Width, sourceRectangle.Height) / textureSize;
var pos = new Vector2(sourceRectangle.X, sourceRectangle.Y);
var pos = new Vector2(sourceRectangle.X, sourceRectangle.Y) / textureSize;

UV = Matrix4x4.CreateScale(new Vector3(sourceSize, 1)) * Matrix4x4.CreateTranslation(new(pos, 0));
Color = ToVector(color);
Expand Down
2 changes: 1 addition & 1 deletion src/build/common.props.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/ezequias2d/peridot</PackageProjectUrl>
<Copyright>ezequias2d and Peridot contributors.</Copyright>
<Version>0.2.1-alpha</Version>
<Version>0.2.2-alpha</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageOutputPath>..\build\nupkgs</PackageOutputPath>
<PackageIcon>peridot.png</PackageIcon>
Expand Down

0 comments on commit 04e186d

Please sign in to comment.