User:Dem1se

From Stardew Valley Wiki
Revision as of 06:47, 12 November 2021 by Dem1se (talk | contribs) (Add How does adding UI work section)
Jump to navigation Jump to search

Getting Started with Making UIs

Intro

What is this article?

This is a compilation of things that I've learnt making UI for my mods. This is just to help beginners to understand how making UIs works in Stardew Valley, since not everyone can read through codebases or find relatively simple ones to read in the first place.

This is about adding a new menu that the user can interact with in game, similar to the inventory menu, as opposed to modifying existing ones, but the basic ideas are the same.

How does adding UI work?

All the UIs in Stardew Valley are classes that derive from the IClickableMenu abstract class. So making your own UI is a matter of making your own class that derives from IClickableMenu, overriding the required methods and doing some other layout stuff.

After defining the UI, it is a matter of assigning an instance of that class to Game1.activeClickableMenu. We'll look at how to do both in detail below.