Bad menu display ( 2d Graphic )

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
WrathAngel
Posts: 4
Joined: Mon Jun 21, 2004 6:45 pm
Location: France ( Le Mans )

Bad menu display ( 2d Graphic )

Post by WrathAngel »

Hello all.
I'm noob and i'm trying to make a simple Menu.
My probleme is the following.
I'm using 2 BMP per button : a white one for unselected and a red one for selected.

Here is my source :

Code: Select all

int main()
{
	MyEventReceiver receiver;

	device = createDevice(video::EDT_DIRECTX8,
		core::dimension2d<s32>(800, 600), 16, false, false, &receiver);

	device->setWindowCaption(L"Irrlicht Engine - User Inferface Demo");

	driver = device->getVideoDriver();
	IGUIEnvironment* env = device->getGUIEnvironment();
	IGUIImage* ImageFond = env->addImage(rect<int>(0,0,800,600));
	ImageFond->setImage(driver->getTexture("TitreTest.bmp"));
	BoutonCommencer = env->addImage(rect<int>(300,400,500,450));
	BoutonCommencer->setImage(driver->getTexture("CommencerActif.bmp"));

	BoutonCharger = env->addImage(rect<int>(300,450,500,500));
	BoutonCharger->setImage(driver->getTexture("Charger.bmp"));
	while(device->run() && driver)
	if (device->isWindowActive())
	{
		driver->beginScene(true, true, SColor(0,122,65,171));
		env->drawAll();
	
		driver->endScene();
	}

	device->drop();

	return 0;
}

The result is not very good because my Buttons are not nice :
Image

But when i replace EDT_DIRECTX8 with EDT_SOFTWARE, here is the result :
Image

As you can see, Buttons are normal...

Is it a pb with my sources or not ??
How can I correct this ???

Thank a lot.
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

Size of your textures should be power of 2, like 64,128,256. Look how irrlichtlogoaligned.jpg from MeshViewer tutorial was made.
Tomasz Nowakowski
Openoko - www.openoko.pl
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Keeping below 256x256 is also a good idea.
WrathAngel
Posts: 4
Joined: Mon Jun 21, 2004 6:45 pm
Location: France ( Le Mans )

Post by WrathAngel »

Ok thanks for your help.
I'll try it tomorrow.
Good night all.
Post Reply