IGUIStaticText coordinates problem.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
[ds] Swift
Posts: 20
Joined: Sun Nov 14, 2004 1:57 am
Location: Rochester, New York, USA

IGUIStaticText coordinates problem.

Post by [ds] Swift »

i seem to have a problem with my IGUIStaticText.
This works:
gui::IGUIStaticText *text = guienv -> addStaticText( L"blagh!", rect<s32>( 10, 10, 200, 22 ), false );

These does not:
gui::IGUIStaticText *text = guienv -> addStaticText( L"blagh!", rect<s32>( 10, 20, 200, 22 ), false );
gui::IGUIStaticText *text = guienv -> addStaticText( L"blagh!", rect<s32>( 200, 10, 200, 22 ), false );

... i have the width set to 200 because i want to be able to change its text later

my window is 1024x768 windowed

is there a problem with it, or is there a limit to where you can display it?
Ronin
Posts: 116
Joined: Wed Mar 03, 2004 6:23 pm
Location: Germany

Post by Ronin »

I don't know, if this is related to your problem, because you did not really specify what exactly is wrong with your static text, but in the code example above you declare the pointer text twice. You can remove the gui::IGUIStaticText * before the second pointer.

If this isn't your problem, maybe you can specify it a bit more, for example is it visible at all, is it at a wrong position, is it not compiling, or whatever...
[ds] Swift
Posts: 20
Joined: Sun Nov 14, 2004 1:57 am
Location: Rochester, New York, USA

Post by [ds] Swift »

see next post.
Last edited by [ds] Swift on Tue Nov 16, 2004 4:44 pm, edited 1 time in total.
[ds] Swift
Posts: 20
Joined: Sun Nov 14, 2004 1:57 am
Location: Rochester, New York, USA

Post by [ds] Swift »

sorry it didn't make any sense.
i have the pointer declared once in my application.
i was just showing that my first declaration worked, and upon changing it to new values it didn't.
Maybe this will help more:

Code: Select all

int main() {
	IrrlichtDevice *device = createDevice( EDT_SOFTWARE, dimension2d<s32>( 1024, 768), 128, false, false, false, 0 );

	device->setWindowCaption( L"NaNoCrON software - Irrlicht Test" );

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IGUIEnvironment* guienv = device->getGUIEnvironment();

	guienv->addStaticText( L"Hi", rect<int>( 10, 10, 200, 22 ), false );


	while( device->run() ) {
		driver->beginScene( true, true, SColor( 0, 200, 200, 200 ) );

		smgr->drawAll();
		guienv->drawAll();

		driver->endScene();
	}

	device->drop();

	return 0;
}
if i change the static text line to:

Code: Select all

guienv->addStaticText( L"Hi", rect<int>( 400, 400, 200, 22 ), false );
it wont display at all. im really confused. my window is large enough to display it but it won't :x
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Code: Select all

guienv->addStaticText( L"Hi", rect<int>( 200, 22, 400, 400 ), false ); 
Maybe this. Just guessing, because now it kinda draws the rectangle wrong, doesn't it? I think this matters. The syntax is x1, y1, x2, y2 so:

Code: Select all

x1/y1                           x2





y2                              
That's how I see it :).
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
[ds] Swift
Posts: 20
Joined: Sun Nov 14, 2004 1:57 am
Location: Rochester, New York, USA

Post by [ds] Swift »

O-M-G! am i a total moron :oops: . lol. thanx, that helped me..
i just came off of this engine that my buddies and i had written. its pretty outdated now, thats y i moved to irrlicht. and in that engine we made our rectangle function:

Code: Select all

rectangle( float xPos, float yPos, float length, float height );
and thats what i was doing instead of ( x1, y1, x2, y2 );

moron!
Post Reply