summaryrefslogtreecommitdiff
path: root/StardewModdingAPI
diff options
context:
space:
mode:
Diffstat (limited to 'StardewModdingAPI')
-rw-r--r--StardewModdingAPI/Events.cs19
-rw-r--r--StardewModdingAPI/Inheritance/SGame.cs12
-rw-r--r--StardewModdingAPI/Program.cs1
-rw-r--r--StardewModdingAPI/obj/x86/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt1
4 files changed, 30 insertions, 3 deletions
diff --git a/StardewModdingAPI/Events.cs b/StardewModdingAPI/Events.cs
index e0cfc9ce..05cabc4b 100644
--- a/StardewModdingAPI/Events.cs
+++ b/StardewModdingAPI/Events.cs
@@ -19,12 +19,15 @@ namespace StardewModdingAPI
public static event BlankEventHandler UpdateTick = delegate { };
public static event BlankEventHandler DrawTick = delegate { };
- public delegate void StateChanged(KeyboardState newState);
- public static event StateChanged KeyboardChanged = delegate { };
+ public delegate void KStateChanged(KeyboardState newState);
+ public static event KStateChanged KeyboardChanged = delegate { };
public delegate void KeyStateChanged(Keys key);
public static event KeyStateChanged KeyPressed = delegate { };
+ public delegate void MStateChanged(MouseState newState);
+ public static event MStateChanged MouseChanged = delegate { };
+
public delegate void ClickableMenuChanged(IClickableMenu newMenu);
public static event ClickableMenuChanged MenuChanged = delegate { };
@@ -34,6 +37,8 @@ namespace StardewModdingAPI
public delegate void CurrentLocationsChanged(GameLocation newLocation);
public static event CurrentLocationsChanged CurrentLocationChanged = delegate { };
+ public static event EventHandler Resize = delegate { };
+
public static void InvokeGameLoaded()
{
GameLoaded.Invoke();
@@ -92,6 +97,11 @@ namespace StardewModdingAPI
KeyboardChanged.Invoke(newState);
}
+ public static void InvokeMouseChanged(MouseState newState)
+ {
+ MouseChanged.Invoke(newState);
+ }
+
public static void InvokeKeyPressed(Keys key)
{
KeyPressed.Invoke(key);
@@ -111,5 +121,10 @@ namespace StardewModdingAPI
{
CurrentLocationChanged.Invoke(newLocation);
}
+
+ public static void InvokeResize(object sender, EventArgs e)
+ {
+ Resize.Invoke(sender, e);
+ }
}
}
diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs
index 9f30e05e..b28b8d7c 100644
--- a/StardewModdingAPI/Inheritance/SGame.cs
+++ b/StardewModdingAPI/Inheritance/SGame.cs
@@ -34,6 +34,9 @@ namespace StardewModdingAPI.Inheritance
public KeyboardState KStateNow { get; private set; }
public KeyboardState KStatePrior { get; private set; }
+ public MouseState MStateNow { get; private set; }
+ public MouseState MStatePrior { get; private set; }
+
public Keys[] CurrentlyPressedKeys { get; private set; }
public Keys[] PreviouslyPressedKeys { get; private set; }
@@ -66,7 +69,8 @@ namespace StardewModdingAPI.Inheritance
{
KStateNow = Keyboard.GetState();
CurrentlyPressedKeys = KStateNow.GetPressedKeys();
-
+ MStateNow = Mouse.GetState();
+
foreach (Keys k in FramePressedKeys)
Events.InvokeKeyPressed(k);
@@ -76,6 +80,12 @@ namespace StardewModdingAPI.Inheritance
KStatePrior = KStateNow;
}
+ if (MStateNow != MStatePrior)
+ {
+ Events.InvokeMouseChanged(MStateNow);
+ MStatePrior = MStateNow;
+ }
+
if (Game1.activeClickableMenu != null && Game1.activeClickableMenu != PreviousActiveMenu)
{
Events.InvokeMenuChanged(Game1.activeClickableMenu);
diff --git a/StardewModdingAPI/Program.cs b/StardewModdingAPI/Program.cs
index a38b607d..5c2f2b9c 100644
--- a/StardewModdingAPI/Program.cs
+++ b/StardewModdingAPI/Program.cs
@@ -118,6 +118,7 @@ namespace StardewModdingAPI
{
gamePtr.IsMouseVisible = false;
gamePtr.Window.Title = "Stardew Valley - Version " + Game1.version;
+ StardewForm.Resize += Events.InvokeResize;
});
LogInfo("Game Loaded");
diff --git a/StardewModdingAPI/obj/x86/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt b/StardewModdingAPI/obj/x86/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt
index aa41f20f..c86a6fc8 100644
--- a/StardewModdingAPI/obj/x86/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt
+++ b/StardewModdingAPI/obj/x86/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt
@@ -29,3 +29,4 @@ C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\
C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.pdb
C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.exe
C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.pdb
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.csprojResolveAssemblyReference.cache