what i want to do is make a class that contains the method “updateText” and that will draw text to the screen. now i have a method that does update text, but when i move it to its own class file. it just crashes when i make a new obj of that class. one problem comes from here
public class GameModule : ScriptContext
theres my class, im not sure if im suppose to be useing script context… so how would i make this work?
I would just make an empty class - not inherited from anything - and pass the Game instance to it, like so:
Class:
public class TextDrawer
{
public SiliconStudio.Paradox.Game MyGame;
public TextDrawer(SiliconStudio.Paradox.Game myGame)
{
MyGame = myGame;
}
public void DrawText(string Text)
{
// code to draw text here
}
}
Then in your main-loop (usually called UpdateScene).
while (IsRunning)
{
<SomeInstanceOfTextDrawer>.DrawText("SomeText");
}
You could also make a static class somewhere that holds the Game object, so you don’t have to pass it all the time.
Just a quick and dirty example, I’m not sure if this is the best way to do it, but this is how I’d do it.
If you could share more code I could give a more concrete example.