Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: shuin on December 28, 2005, 10:15:37 PM

Title: displaying text function and effects
Post by: shuin on December 28, 2005, 10:15:37 PM
Hello!

Happy holidays to everyone!

I have a question about scripting in WM. It's very very easy, but since i'm not very good at it i have to ask :D
How can i display text on-screen? I don't mean mesages windows. Simple text. Is tehre a function for this? I'm really not very good at programming, so please help. I know a method: making an entity with an invisible sprite, and having it talk for the scenes in wich i want text displayed on-screen. But is there a function that can display it directly?

Also i want to know if it is possible to make a transition effect, for screen changes. I want when the screen changes, first the current screen will have a sepia effect, and then the next screen (wich also has the sepia effect) appears and after 1 second the sepia effect disappears and the screen is coloured. Is there a function for sepia effect over screens? Or can anyone tell me how to write such a function?

Thanx in advance,
Ciao!
Title: Re: displaying text function and effects
Post by: Nihil on December 28, 2005, 11:42:04 PM
You can make transition-effects with the scene.FadeOut and Scene.FadeIn-commands, you'll only have to find out the right RGB-values for the sepia-tone.

For talking the invisible entity is a good method, I don't know if there is a direct talk-command?
Title: Re: displaying text function and effects
Post by: metamorphium on December 29, 2005, 09:49:31 AM
AFAIK Talk must be always linked to something so hidden entity is really the best way to do this while talking but the drawback is that
your text stays on only for the time until the line is talked. Otherwise you can use the window approach.

First you have to create some minimalistic window like this:

Code: [Select]
WINDOW
{
  STATIC
  {
    TEXT = ""
    NAME = "test"
    FONT = "some_desired.font"
    X = 0
    Y = 0
    WIDTH = 400
    HEIGHT = 200
  }
}

Then you can operate it like this:

Code: [Select]
  global TextWindow = Game.LoadWindow("your_new.window");
  var TextTest = creditwin.GetWidget("test"); //This is the name as defined in the Window above
 
//Now we will display some centered text
  TextTest.Y = 378; //Vertical Position of the window
  TextTest.Text = "Hello world";
  TextTest.SizeToFit(); //Resize the window so it will be as big as the text.
  TextTest.X = ScreenWidth / 2 - (TextTest.Width / 2); //Substitute your own resolution ScreenWidth here

Almost identical code is AFAIK in the WME demo so you can see it there in action. Also note that it's untested but should work
without any problems.