How could I print some text?

alberts

15-12-2005 22:48:46

I think it is not a complicated question, but I can't do it!! :?

I’ve been using the Core/DebugText overlay element, but it is too short. I’ve tried to create a new overlay element, but I get an invalid cast exception at this line:
TextAreaOverlayElement positionInfo = (TextAreaOverlayElement)OverlayManager.getSingleton().CreateOverlayElement("TextArea","textAreaName");

I have tried to use a statictext CEGUI control, but when I use a SceneType.ExteriorClose scene manager type the CEGUI controls disappear. If I use a generic scene manager type the CEGUI controls works fine, but I need to use the ExteriorClose type.

I don’t know any other alternative to print text. Any ideas?

Thanks and I apologize for my english (my native language is spanish)

rastaman

16-12-2005 01:41:08

check out DemoFireworks it creates overlays and stuff.

You need to call OverlayManager.Instance.CreateTextAreaElement.
OverlayManager.CreateOverlayElement does not know what specific type of object is being created, so it just returns an OverlayElement. In c# this can not be up cast to a TextAreaOverlayElement.

alberts

16-12-2005 10:01:54

Thanks a lot!!

The overlays works now :D

Bahamut

09-03-2006 14:16:21

got a problem with that too.
the code:

this.mViewport.BackgroundColor = Color.Black;
mSceneManager.AmbientLight = Color.FromArgb(255, 255, 255, 255);

OverlayElement el = OverlayManager.Instance.CreatePanelElement("TextArea", false);
thePanel = new OverlayContainer(OverlayElement.getCPtr(el).Handle , false);

thePanel.setMetricsMode(GuiMetricsMode.GMM_PIXELS);
thePanel.setPosition(100, 100);
thePanel.setDimensions(500, 100);

text = OverlayManager.Instance.CreateTextAreaElement("BLA");
thePanel.addChild(text);
text.setMetricsMode(GuiMetricsMode.GMM_PIXELS);
text.setPosition(100, 100);
text.setDimensions(100, 100);
text.setCaption("Hello World!");
text.setCharHeight(16);
text.setFontName("TrebuchetMSBold");
text.setMaterialName("Examples/OgreLogo");
text.setColourBottom( Converter.GetColor(0.3f, 0.5f, 0.3f) );
text.setColourTop( Converter.GetColor(0.5f, 0.7f, 0.5f));
text.setColour(System.Drawing.Color.White);
text.setAlignment(TextAreaOverlayElement.Alignment.Center);

mOverlay = OverlayManager.Instance.create("Test");
mOverlay.add2D(thePanel);
thePanel.show();
text.show();

the problem is that there is no text. because of that i inserted the line with text.setcolour and .show() method calls but it doesn't work and i don't know why. and i'm trying it for about 5 hours.
hope somebody can help me

rastaman

09-03-2006 17:15:10

Bahamut:
you need mOverlay.show();

Is you class derived from ExampleApplication? You know ExampleApplication uses mOverlay in functions create4LineDebugOverLay, and Show4LineDebugOverLay.

Bahamut

10-03-2006 08:05:20

Bahamut:
you need mOverlay.show();

Is you class derived from ExampleApplication? You know ExampleApplication uses mOverlay in functions create4LineDebugOverLay, and Show4LineDebugOverLay.


yes it does. and now it works. i only had to add base.Show4LineDebugOverLay();
at the end of the method and remove the setmaterial

thanks