Add tests and squish last bugs

This commit is contained in:
KäseToatz
2024-11-07 02:34:49 +01:00
parent 0121584708
commit 98ffdbcc25
4 changed files with 144 additions and 18 deletions

View File

@ -18,7 +18,7 @@
<Button Content="←" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="30px" Margin="470,300,0,0" Click="Decrease"></Button>
<Label Content="5" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="535,300,0,0" FontSize="30px" Name="DeckSize"></Label>
<Button Content="→" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="30px" Margin="600,300,0,0" Click="Increase"></Button>
<Label Content="Name must be between 2 and 32 characters." HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,320,0,0" FontSize="20" Foreground="Red" Name="ErrorLabel" Visibility="Hidden"></Label>
<Label Content="Name must be between 2 and 32 characters." HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,335,0,0" FontSize="16" Foreground="Red" Name="ErrorLabel" Visibility="Hidden"></Label>
<Button Content="Start" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="50px" Margin="0,360,0,0" Width="240" Height="80" Click="StartGame"></Button>
</Grid>
<Grid Name="GameScreen" Visibility="Visible">

View File

@ -12,6 +12,8 @@ namespace Memory.Gui
{
public const int SCOREPADDING = 160;
public const int SCOREMARGIN = 30;
public const int GRIDWIDTH = 700;
public const int GRIDHEIGHT = 500;
private Game? game;
private int deckSize = 5;
@ -104,11 +106,11 @@ namespace Memory.Gui
}
if (rows > columns)
{
Cards.Width /= (double)rows / columns;
Cards.Width = GRIDWIDTH * (double)columns / rows;
}
else if (columns > rows)
{
Cards.Height /= (double)columns / rows;
Cards.Height = GRIDHEIGHT * (double)rows / columns;
}
}