Dynamic max window size

This commit is contained in:
BOTLester 2020-06-15 02:51:44 +02:00
parent 72a7a8aab3
commit 412a0969f0
3 changed files with 8 additions and 5 deletions

View File

@ -136,6 +136,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Numerics" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>

View File

@ -2,6 +2,8 @@
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Drawing;
using WinForm = System.Windows.Forms;
class Controller
{
@ -17,7 +19,7 @@ class Controller
public Vector2 updateWindow(int tileSize, int Spacing, Vector2 Size)
{
KeyboardState state = Keyboard.GetState();
if (state.IsKeyDown(Keys.D) && Size.X < 90)
if (state.IsKeyDown(Keys.D) && Size.X < Math.Floor(WinForm.Screen.PrimaryScreen.Bounds.Width / (float)tileSize))
{
Size.X++;
graphics.PreferredBackBufferWidth = (tileSize + Spacing) * (int)Size.X - Spacing;
@ -29,7 +31,7 @@ class Controller
graphics.PreferredBackBufferWidth = (tileSize + Spacing) * (int)Size.X - Spacing;
}
if (state.IsKeyDown(Keys.W) && Size.Y < 20)
if (state.IsKeyDown(Keys.W) && Size.Y < Math.Floor(WinForm.Screen.PrimaryScreen.Bounds.Height / (float)tileSize) - 7)
{
Size.Y++;
graphics.PreferredBackBufferHeight = (tileSize + Spacing) * (int)Size.Y - Spacing + 380;

View File

@ -19,9 +19,9 @@ class SoilProperties
public float Phosphorous;
public float Rainfall;
public float prevRainfall;
public float NitrogenDegradeRate = 0.8f;
public float PotassiumDegradeRate = 0.3f;
public float PhosphorousDegradeRate = 0.6f;
public float NitrogenDegradeRate = 0.8f / 1.5f;
public float PotassiumDegradeRate = 0.3f / 1.5f;
public float PhosphorousDegradeRate = 0.6f / 1.5f;
public int Capacity = 80;
public int Area;