Skip to content

Commit 04e186d

Browse files
committed
Bugfix: location not working in source rectangle.
1 parent 1050d84 commit 04e186d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Peridot.Demo/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

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

6868
sb.Draw(texture, default, source, Color.White, 0, new(-size.X / 6, 0), Vector2.One, 1f);
6969
tr.DrawString(font, 32, "Hello World!", new Vector2(1, 1), Color.White, 0, new Vector2(0, 0), new Vector2(1), 0f);

src/Peridot/BatchItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public BatchItem(Vector2 textureSize,
4343
float layerDepth)
4444
{
4545
var sourceSize = new Vector2(sourceRectangle.Width, sourceRectangle.Height) / textureSize;
46-
var pos = new Vector2(sourceRectangle.X, sourceRectangle.Y);
46+
var pos = new Vector2(sourceRectangle.X, sourceRectangle.Y) / textureSize;
4747

4848
UV = Matrix4x4.CreateScale(new Vector3(sourceSize, 1)) * Matrix4x4.CreateTranslation(new(pos, 0));
4949
Color = ToVector(color);

src/build/common.props.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PackageLicenseFile>LICENSE</PackageLicenseFile>
55
<PackageProjectUrl>https://github.com/ezequias2d/peridot</PackageProjectUrl>
66
<Copyright>ezequias2d and Peridot contributors.</Copyright>
7-
<Version>0.2.1-alpha</Version>
7+
<Version>0.2.2-alpha</Version>
88
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
99
<PackageOutputPath>..\build\nupkgs</PackageOutputPath>
1010
<PackageIcon>peridot.png</PackageIcon>

0 commit comments

Comments
 (0)