Difference between revisions of "User:Dem1se"

From Stardew Valley Wiki
Jump to navigation Jump to search
(Created page with "= 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 b...")
 
(Add How does adding UI work section)
Line 8: Line 8:
  
 
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.
 
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 <code>IClickableMenu</code> abstract class. So making your own UI is a matter of making your own class that derives from <code>IClickableMenu</code>, 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 <code>Game1.activeClickableMenu</code>. We'll look at how to do both in detail below.

Revision as of 06:47, 12 November 2021

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.