Skip to content

Commit c3ae693

Browse files
committed
Fix overlay frame selector using the entire sprite sheet as overlay textures
1 parent 9057eeb commit c3ae693

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/TSMapEditor/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace TSMapEditor
44
{
55
public static class Constants
66
{
7-
public const string ReleaseVersion = "1.6.2";
7+
public const string ReleaseVersion = "1.6.3";
88

99
public static int CellSizeX = 48;
1010
public static int CellSizeY = 24;

src/TSMapEditor/UI/OverlayFrameSelector.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace TSMapEditor.UI
1111
{
1212
class OverlayFrameSelectorFrame
1313
{
14-
public OverlayFrameSelectorFrame(Point location, Point offset, Point size, int overlayFrameIndex, Texture2D texture)
14+
public OverlayFrameSelectorFrame(Point location, Point offset, Point size, int overlayFrameIndex, PositionedTexture texture)
1515
{
1616
Location = location;
1717
Offset = offset;
@@ -24,7 +24,7 @@ public OverlayFrameSelectorFrame(Point location, Point offset, Point size, int o
2424
public Point Offset { get; set; }
2525
public Point Size { get; set; }
2626
public int OverlayFrameIndex { get; set; }
27-
public Texture2D Texture { get; set; }
27+
public PositionedTexture Texture { get; set; }
2828
}
2929

3030
public class OverlayFrameSelector : XNAPanel
@@ -241,8 +241,8 @@ private void RefreshGraphics()
241241
if (frame == null)
242242
continue;
243243

244-
int width = frame.Texture.Width;
245-
int height = frame.Texture.Height;
244+
int width = frame.SourceRectangle.Width;
245+
int height = frame.SourceRectangle.Height;
246246

247247
if (x + width > usableWidth)
248248
{
@@ -255,7 +255,7 @@ private void RefreshGraphics()
255255
tilesOnCurrentLine.Clear();
256256
}
257257

258-
var tileDisplayTile = new OverlayFrameSelectorFrame(new Point(x, y), new Point(0, 0), new Point(width, height), i, frame.Texture);
258+
var tileDisplayTile = new OverlayFrameSelectorFrame(new Point(x, y), new Point(0, 0), new Point(width, height), i, frame);
259259
framesInView.Add(tileDisplayTile);
260260

261261
if (height > currentLineHeight)
@@ -341,8 +341,8 @@ public override void Draw(GameTime gameTime)
341341
palettedDrawEffect.Parameters["PaletteTexture"].SetValue(currentOverlayShape.GetPaletteTexture());
342342
palettedDrawEffect.Parameters["Lighting"].SetValue(Vector4.One);
343343

344-
DrawTexture(frame.Texture, new Rectangle(frame.Location.X + frame.Offset.X,
345-
viewY + frame.Location.Y + frame.Offset.Y, frame.Texture.Width, frame.Texture.Height), Color.White);
344+
DrawTexture(frame.Texture.Texture, frame.Texture.SourceRectangle, new Rectangle(frame.Location.X + frame.Offset.X,
345+
viewY + frame.Location.Y + frame.Offset.Y, frame.Texture.SourceRectangle.Width, frame.Texture.SourceRectangle.Height), Color.White);
346346
}
347347

348348
Renderer.PopSettings();

0 commit comments

Comments
 (0)