Playing Games
Games menu can be accessed via a new play button in the bottom right corner of the Title Menu, above existing buttons (see screenshots above).
The mod comes with Junimo Cart and Journey of the Prairie King pre-installed so you can play them without loading into a save.
An example of a game that works with this menu is Jigsaw Puzzle.
536010ba-9e8c-4ff0-9792-9c96dddabe29
Making Games
Modders can add games to the menu by accessing the mod's API, setting custom methods for clicking and drawing, e.g.:
The API passes the rectangle bounds on the screen of the game's slot to both methods, and relative click position x and y coordinates to the click action (allowing for multiple buttons, etc.).
Technical
Code is at https://github.com/aedenthorn/StardewValleyMods/
Games menu can be accessed via a new play button in the bottom right corner of the Title Menu, above existing buttons (see screenshots above).
The mod comes with Junimo Cart and Journey of the Prairie King pre-installed so you can play them without loading into a save.
An example of a game that works with this menu is Jigsaw Puzzle.
536010ba-9e8c-4ff0-9792-9c96dddabe29
Making Games
Modders can add games to the menu by accessing the mod's API, setting custom methods for clicking and drawing, e.g.:
public interface IStardewGamesAPI
{
public void AddGame(string name, Action<Rectangle, int, int> clickAction, Action<SpriteBatch, Rectangle> drawAction);
public void ReturnToMenu();
}
public void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
{
var sgapi = Helper.ModRegistry.GetApi<IStardewGamesAPI>("aedenthorn.StardewGames");
if (sgapi != null)
{
sgapi.AddGame(context.ModManifest.UniqueID, ClickAction, DrawAction);
}
}
private void DrawAction(SpriteBatch b, Rectangle area)
{
...
}
private void ClickAction(Rectangle area, int x, int y)
{
...
}
The API passes the rectangle bounds on the screen of the game's slot to both methods, and relative click position x and y coordinates to the click action (allowing for multiple buttons, etc.).
Technical
Code is at https://github.com/aedenthorn/StardewValleyMods/

