Getting Started
If you've made a Stardew mod before, then setting up StardewUI should be a snap; it's the same as any other SMAPI integration.
Installing the Framework
Install StardewUI as you would install any other mod. For manual installation:
- Download the latest release on GitHub or Nexus Mods. When downloading from GitHub, make sure you download the
StardewUI x.y.z.zip
file, not the source code. - Open the .zip file and extract the
StardewUI
folder into yourStardew Valley\Mods
folder.
The framework is now ready to use from your own mods.
Adding the API
If this is your first time working with a framework mod, have a look at SMAPI's guide to using an API. The abridged version is:
- Download the entire
IViewEngine.cs
to somewhere in your mod's source directory. (You can right-click, "Save link as..." from this page.) - From wherever you want to invoke the API—typically
ModEntry.cs
—add to the top of the file: - Declare a field for the API:
- Obtain the API in a
GameLaunched
handler:
Next Steps
At this point, you don't have any views or other assets; in order to get an actual UI up and running, you'll need to:
- Decide on a directory where your views and other assets will live inside your mod. (1)
- Register your asset path(s) so that the framework can find them.
- Create a new view file using the
.sml
extension. See editor setup for recommended editors/configurations. - Ensure that the asset will be copied to your mod output. In Visual Studio, the file properties should look as follows:
- Author the view. See the StarML guide, or checkout the examples if you're feeling impatient.
- Use the
IViewEngine
API you added earlier to display the view.
- We recommend
assets/views
for views andassets/sprites
for sprites to be consistent with the examples and reference guides, but you can use any location(s) you prefer.
Note that steps 1-2 only need to be done one time. As long as you keep all your assets in one place (directory), then any new ones you add will be automatically picked up by the framework; no need to register every asset individually.
That's it! Have fun creating great UIs.