From 412a0969f0f208570ef53dafad7d98f9988a3aab Mon Sep 17 00:00:00 2001
From: BOTLester <58360400+BOTLester@users.noreply.github.com>
Date: Mon, 15 Jun 2020 02:51:44 +0200
Subject: [PATCH] Dynamic max window size
---
Game1/Game1.csproj | 1 +
Game1/Sources/Controlls/Controller.cs | 6 ++++--
Game1/Sources/Crops/SoilProperties.cs | 6 +++---
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/Game1/Game1.csproj b/Game1/Game1.csproj
index 65313e6..33d665d 100644
--- a/Game1/Game1.csproj
+++ b/Game1/Game1.csproj
@@ -136,6 +136,7 @@
+
diff --git a/Game1/Sources/Controlls/Controller.cs b/Game1/Sources/Controlls/Controller.cs
index ad2b38a..5d2ac97 100644
--- a/Game1/Sources/Controlls/Controller.cs
+++ b/Game1/Sources/Controlls/Controller.cs
@@ -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;
diff --git a/Game1/Sources/Crops/SoilProperties.cs b/Game1/Sources/Crops/SoilProperties.cs
index 1b61eb8..3377d82 100644
--- a/Game1/Sources/Crops/SoilProperties.cs
+++ b/Game1/Sources/Crops/SoilProperties.cs
@@ -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;