Difference between revisions of "Ruminate Example"
(Created page with "==Installation== The nuget repository for Ruminate is broken and won't install, so download this zip file which contains the RuminateGUI.dll file. Copy the DLL file into your...") |
(→Setup) |
||
Line 25: | Line 25: | ||
Remember to use the original namespace from when you created the class. | Remember to use the original namespace from when you created the class. | ||
+ | |||
+ | ==Create a new screen== | ||
+ | Create a new class from the project menu and name the class screen1. Edit the class declaration to make it a class of Screen: | ||
+ | |||
+ | <syntaxhighlight lang=csharp> | ||
+ | class screen1: Screen{ | ||
+ | |||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | ==Displaying a screen== | ||
+ | Add the following variables into your Game1.cs: | ||
+ | |||
+ | <syntaxhighlight lang=csharp> | ||
+ | Screen _currentScreen; | ||
+ | Screen[] _currentScreens; | ||
+ | |||
+ | public SpriteFont GreySpriteFont; | ||
+ | public Texture2D GreyImageMap; | ||
+ | public string GreyMap; | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | In the LoadContent method of Game1.cs add the following to load the textures and imagemap: | ||
+ | |||
+ | <syntaxhighlight lang=csharp> | ||
+ | GreyImageMap = Content.Load<Texture2D>(@"GreySkin\ImageMap"); | ||
+ | GreyMap = File.OpenText(@"GuiExampleContent\GreySkin\Map.txt").ReadToEnd(); | ||
+ | GreySpriteFont = Content.Load<SpriteFont>(@"GreySkin\Texture"); | ||
+ | </syntaxhighlight> |
Revision as of 12:55, 9 October 2017
Installation
The nuget repository for Ruminate is broken and won't install, so download this zip file which contains the RuminateGUI.dll file. Copy the DLL file into your project folder.
Then under project, click add reference and browse for the DLL file.
Setup
Click on project and create a new class, call it Screen.cs. Copy the following code:
using Microsoft.Xna.Framework;
namespace YourNameSpace {
public abstract class Screen {
public Color Color { get; set; }
public abstract void Init(Game1 game);
public abstract void OnResize();
public abstract void Update();
public abstract void Draw();
}
}
Remember to use the original namespace from when you created the class.
Create a new screen
Create a new class from the project menu and name the class screen1. Edit the class declaration to make it a class of Screen:
class screen1: Screen{
}
Displaying a screen
Add the following variables into your Game1.cs:
Screen _currentScreen;
Screen[] _currentScreens;
public SpriteFont GreySpriteFont;
public Texture2D GreyImageMap;
public string GreyMap;
In the LoadContent method of Game1.cs add the following to load the textures and imagemap:
GreyImageMap = Content.Load<Texture2D>(@"GreySkin\ImageMap");
GreyMap = File.OpenText(@"GuiExampleContent\GreySkin\Map.txt").ReadToEnd();
GreySpriteFont = Content.Load<SpriteFont>(@"GreySkin\Texture");