How to draw "Hello World"?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Rakkar
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Tue Aug 15, 2006 02:49

How to draw "Hello World"?

Postby Rakkar » Thu Aug 24, 2006 15:32

All I want to do is draw "Hello World" on the screen purely from code. No layouts or XML files. There shouldn't be a background or scroll bars. I just want "Hello World" by itself. Using the default font, color, etc. Use any coordinates you wish.

Can CEGUI do this? If so, can someone please post the code?

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Thu Aug 24, 2006 16:33

Have a look at Sample_FirstWindow; it creates a frame window.

Line 128 of Sample_FirstWindow.cpp contains:

Code: Select all

FrameWindow* wnd = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "Demo Window");


Remove that line and those until the end of that function. You can then use this (slightly modified) snippet from Sample_Demo7.cpp to create the text:

Code: Select all

    // create a static text with some information in.
    StaticText* stxt = static_cast<StaticText*>(winMgr.createWindow("TaharezLook/StaticText", "Demo7/Window1/Text1"));
    root->addChildWindow(stxt);
    stxt->setMaximumSize(Size(1.0f, 1.0f));
    stxt->setPosition(Point(0.5f, 0.1f));
    stxt->setSize(Size(0.45f, 0.5f));
    stxt->setText("Hello world.");
    stxt->setFrameEnabled(false);
    stxt->setBackgroundEnabled(false);
    stxt->setHorizontalFormatting(StaticText::WordWrapCentred);


I'm assuming you are still using Cegui v0.4. If not then have a look at Widget Galore to convert the StaticText of v0.4 to that of v0.5.

Percy Camilo
Just popping in
Just popping in
Posts: 9
Joined: Fri Jul 28, 2006 22:00
Location: Perú

Postby Percy Camilo » Sat Aug 26, 2006 16:59

In this post you will find some code:

[url]
http://www.cegui.org.uk/phpBB2/viewtopic.php?t=1408
[/url]


Return to “Help”

Who is online

Users browsing this forum: No registered users and 23 guests