alfredma
12-12-2006 07:49:39
So I was trying to display a string using Overlay. But I couldn't get it to display. I couldn't see what is wrong with my code. Please help me >.<
Overlay panel;
OverlayContainer healthbar;
OverlayElement textBox;
public override void CreateViewports()
{
panel = OverlayManager.Singleton.Create("GUI/panel");
healthbar = (OverlayContainer) OverlayManager.Singleton.CreateOverlayElement("Panel", "healthbar1");
panel.Add2D(healthbar);
healthbar.SetDimensions(100, 100);
healthbar.SetPosition(100, 100);
textBox = OverlayManager.Singleton.CreateOverlayElement("TextArea", "textarea1");
textBox.SetDimensions(100, 100);
textBox.SetPosition(0, 0);
textBox.SetParameter("metric_mode", "pixels");
textBox.SetParameter("font_name", "MyFont");
textBox.SetParameter("char_height", "40");
textBox.SetParameter("colour", "1.0, 1.0, 1.0");
textBox.SetParameter("caption", "Show it to me!");
healthbar.AddChild(textBox);
panel.Show();
...
}
Overlay panel;
OverlayContainer healthbar;
OverlayElement textBox;
public override void CreateViewports()
{
panel = OverlayManager.Singleton.Create("GUI/panel");
healthbar = (OverlayContainer) OverlayManager.Singleton.CreateOverlayElement("Panel", "healthbar1");
panel.Add2D(healthbar);
healthbar.SetDimensions(100, 100);
healthbar.SetPosition(100, 100);
textBox = OverlayManager.Singleton.CreateOverlayElement("TextArea", "textarea1");
textBox.SetDimensions(100, 100);
textBox.SetPosition(0, 0);
textBox.SetParameter("metric_mode", "pixels");
textBox.SetParameter("font_name", "MyFont");
textBox.SetParameter("char_height", "40");
textBox.SetParameter("colour", "1.0, 1.0, 1.0");
textBox.SetParameter("caption", "Show it to me!");
healthbar.AddChild(textBox);
panel.Show();
...
}