Skip to content

Commit

Permalink
Did that resize bug again teehee
Browse files Browse the repository at this point in the history
  • Loading branch information
hunter2actual committed Apr 3, 2024
1 parent 6c4b722 commit d75688f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions DalamudMinesweeper.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Author": "hunter2_",
"Name": "Minesweeper",
"InternalName": "DalamudMinesweeper",
"AssemblyVersion": "0.0.0.11",
"AssemblyVersion": "0.0.0.12",
"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.",
"ApplicableVersion": "any",
"Tags": [
Expand All @@ -18,8 +18,8 @@
"LoadPriority": 0,
"Punchline": "Classic puzzle game.",
"AcceptsFeedback": true,
"DownloadLinkInstall": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/0.0.0.11/latest.zip",
"DownloadLinkUpdate": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/0.0.0.11/latest.zip",
"DownloadLinkInstall": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/0.0.0.12/latest.zip",
"DownloadLinkUpdate": "https://github.com/hunter2actual/DalamudMinesweeper/releases/download/0.0.0.12/latest.zip",
"IconUrl": "https://raw.githubusercontent.com/hunter2actual/DalamudMinesweeper/master/images/icon.png",
"Changelog": "Draw background and border, add OpenMainUi button from Dalamud"
}
Expand Down
9 changes: 4 additions & 5 deletions DalamudMinesweeper/Components/Background.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ namespace DalamudMinesweeper.Components;

public class Background
{
private MinesweeperGame _game;
public MinesweeperGame Game;
private Configuration _configuration;
private int _borderWidthPx;
private readonly Vector2 _borderWidthPxVec2;
private readonly Vector2 _boardDimensions;

private readonly uint[,] _aliasSwatch = new uint[3,3]
{
Expand All @@ -21,21 +20,21 @@ public class Background

public Background(MinesweeperGame game, Configuration configuration, int borderWidthPx)
{
_game = game;
Game = game;
_configuration = configuration;
_borderWidthPx = borderWidthPx;
_borderWidthPxVec2 = new Vector2(_borderWidthPx, _borderWidthPx);
_boardDimensions = new Vector2(_game.Width, _game.Height);
}

public void Draw(Vector2 cursorPos, Vector2 headerHeightPx, int gridSquareSizePx)
{
var drawList = ImGui.GetWindowDrawList();

var edgeBorderWidthPx = 3 * _configuration.Zoom;
var boardDimensions = new Vector2(Game.Width, Game.Height);

var bgTopLeft = cursorPos;
var bgBottomRight = cursorPos + gridSquareSizePx*_boardDimensions + 2*_borderWidthPxVec2*_configuration.Zoom + headerHeightPx;
var bgBottomRight = cursorPos + gridSquareSizePx*boardDimensions + 2*_borderWidthPxVec2*_configuration.Zoom + headerHeightPx;
var bgTopRight = new Vector2(bgBottomRight.X, bgTopLeft.Y);
var bgBottomLeft = new Vector2(bgTopLeft.X, bgBottomRight.Y);

Expand Down
2 changes: 1 addition & 1 deletion DalamudMinesweeper/DalamudMinesweeper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PropertyGroup>
<Authors></Authors>
<Company></Company>
<Version>0.0.0.11</Version>
<Version>0.0.0.12</Version>
<Description>A logic puzzle featuring hidden mines.</Description>
<Copyright></Copyright>
<PackageProjectUrl>https://github.com/hunter2actual/DalamudMinesweeper</PackageProjectUrl>
Expand Down
4 changes: 4 additions & 0 deletions DalamudMinesweeper/Windows/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ private MinesweeperGame InitialiseGame()
{
_gameBoard.Game = _game;
}
if (_background is not null)
{
_background.Game = _game;
}

return _game;
}
Expand Down

0 comments on commit d75688f

Please sign in to comment.