Skip to content

Commit d681ce9

Browse files
committed
spritesheets to cover up to 5x zoom
1 parent db3300f commit d681ce9

File tree

10 files changed

+42
-14
lines changed

10 files changed

+42
-14
lines changed

DalamudMinesweeper.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Author": "hunter2_",
44
"Name": "Minesweeper",
55
"InternalName": "DalamudMinesweeper",
6-
"AssemblyVersion": "0.0.0.13",
6+
"AssemblyVersion": "0.0.0.14",
77
"Description": "Logic puzzle in which you find and flag hidden mines. \nLeft click to uncover a square, right click to place a flag. \nClick a number that has the right amount of adjacent flags to reveal adjacent tiles. \nThe game ends when all mines are flagged and all safe squares have been uncovered. \nClick the smiley face to start a new game.",
88
"ApplicableVersion": "any",
99
"Tags": [
@@ -18,9 +18,9 @@
1818
"LoadPriority": 0,
1919
"Punchline": "Classic puzzle game.",
2020
"AcceptsFeedback": true,
21-
"DownloadLinkInstall": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/0.0.0.13/latest.zip",
22-
"DownloadLinkUpdate": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/0.0.0.13/latest.zip",
21+
"DownloadLinkInstall": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/0.0.0.14/latest.zip",
22+
"DownloadLinkUpdate": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/0.0.0.14/latest.zip",
2323
"IconUrl": "https://raw.githubusercontent.com/hunter2actual/DalamudMinesweeper/master/images/icon.png",
24-
"Changelog": "Spritesheet rendering to prevent image bleed"
24+
"Changelog": "Improved tile rendering"
2525
}
2626
]

DalamudMinesweeper/ClassicSpritesSheet.cs renamed to DalamudMinesweeper/ClassicSprites.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,22 @@ namespace DalamudMinesweeper;
1111

1212
public class ClassicSprites : IDisposable {
1313
private DalamudPluginInterface _pluginInterface { get; set; }
14-
private IDalamudTextureWrap Sheet { get; init; }
14+
private IDalamudTextureWrap[] Sheets { get; init; }
1515
private record SpriteData(Vector2 topLeftCoord, Vector2 sizePx);
1616
private readonly Dictionary<string, SpriteData> _spriteDict;
1717

1818
public ClassicSprites(DalamudPluginInterface pluginInterface)
1919
{
2020
_pluginInterface = pluginInterface;
21-
Sheet = LoadImage("spritesheet.png");
21+
22+
Sheets =
23+
[
24+
LoadImage("spritesheet_1x.png"),
25+
LoadImage("spritesheet_2x.png"),
26+
LoadImage("spritesheet_3x.png"),
27+
LoadImage("spritesheet_4x.png"),
28+
LoadImage("spritesheet_5x.png"),
29+
];
2230

2331
_spriteDict = new Dictionary<string, SpriteData>
2432
{
@@ -54,11 +62,13 @@ public void DrawSmiley(ImDrawListPtr drawList, string smileyName, Vector2 cursor
5462

5563
private void Draw(ImDrawListPtr drawList, SpriteData sprite, Vector2 cursorPos, int zoom)
5664
{
57-
var uvMin = sprite.topLeftCoord / Sheet.Size;
58-
var uvMax = (sprite.topLeftCoord + sprite.sizePx) / Sheet.Size;
65+
var sheet = Sheets[zoom - 1];
66+
67+
var uvMin = sprite.topLeftCoord * zoom / sheet.Size;
68+
var uvMax = (sprite.topLeftCoord + sprite.sizePx) * zoom / sheet.Size;
5969

6070
drawList.AddImage(
61-
Sheet.ImGuiHandle,
71+
sheet.ImGuiHandle,
6272
cursorPos,
6373
cursorPos + sprite.sizePx * zoom,
6474
uvMin,
@@ -90,7 +100,10 @@ private static string CellToSpriteName(Cell cell)
90100

91101
public void Dispose()
92102
{
93-
Sheet.Dispose();
103+
foreach (var sheet in Sheets)
104+
{
105+
sheet.Dispose();
106+
}
94107
}
95108

96109
private IDalamudTextureWrap LoadImage(string path)

DalamudMinesweeper/Components/Footer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void Draw(Vector2 start)
2828
_drawConfigAction();
2929
}
3030
ImGui.SameLine();
31-
if (ImGuiComponents.IconButton(FontAwesomeIcon.Plus))
31+
if (ImGuiComponents.IconButton(FontAwesomeIcon.Plus) && _configuration.Zoom <= 5)
3232
{
3333
_configuration.Zoom++;
3434
}

DalamudMinesweeper/DalamudMinesweeper.csproj

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<PropertyGroup>
66
<Authors></Authors>
77
<Company></Company>
8-
<Version>0.0.0.13</Version>
8+
<Version>0.0.0.14</Version>
99
<Description>A logic puzzle featuring hidden mines.</Description>
1010
<Copyright></Copyright>
1111
<PackageProjectUrl>https://github.com/hunter2actual/DalamudMinesweeper</PackageProjectUrl>
@@ -14,7 +14,23 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<Content Include="..\Data\Classic\spritesheet.png">
17+
<Content Include="..\Data\Classic\spritesheet_1x.png">
18+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
19+
<Visible>false</Visible>
20+
</Content>
21+
<Content Include="..\Data\Classic\spritesheet_2x.png">
22+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
23+
<Visible>false</Visible>
24+
</Content>
25+
<Content Include="..\Data\Classic\spritesheet_3x.png">
26+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
27+
<Visible>false</Visible>
28+
</Content>
29+
<Content Include="..\Data\Classic\spritesheet_4x.png">
30+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
31+
<Visible>false</Visible>
32+
</Content>
33+
<Content Include="..\Data\Classic\spritesheet_5x.png">
1834
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1935
<Visible>false</Visible>
2036
</Content>
File renamed without changes.

Data/Classic/spritesheet_2x.png

22 KB
Loading

Data/Classic/spritesheet_3x.png

22.7 KB
Loading

Data/Classic/spritesheet_4x.png

23.5 KB
Loading

Data/Classic/spritesheet_5x.png

23.3 KB
Loading

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ Dalamud plugin for FFXIV
1010
- UI borders
1111
- Active click logic
1212
- High scores screen
13-
- Spritesheet zoom levels
1413
- [Stretch] Implement solver to reduce guessing
1514
- [Stretch] Skins

0 commit comments

Comments
 (0)