Inventory GUI design

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
Preedak

Inventory GUI design

Post by Preedak »

I'm designing a GUI for inventory system in my game. Right now, I'm using listbox as the way to select the item, but I've seen a work on Irrlicht that create GUI that look like a table that you can select the item by clicking,so

How can I create a GUI for selecting item that look like a table with the pictures of items to select from?
Morrog
Posts: 58
Joined: Mon Dec 13, 2004 5:13 am

Post by Morrog »

You could always do a 3D approach.
Get mouse position
irr::scene::ISceneCollisionManager::getRayFromScreenCoordinates
to get a ray
irr::scene::ISceneCollisionManager::getSceneNodeFromRayBB
to get the node with which the ray collides (and hence the mouse is hovering over.)

And I guess you could put that on a 3D table with all the items on the table, or in a bag, or floating in space, or in a boat, or in a tree, or with green eggs and ham.
preedak

Post by preedak »

How about if I want to create new window IGUIWindow and put all the 3D objects on the created window? Is it possible?
Morrog
Posts: 58
Joined: Mon Dec 13, 2004 5:13 am

Post by Morrog »

Hmmm....I don't know how to do that one, sorry :(
It's doable, but I don't know if Irrlicht can, and if so, how.
preedak

Post by preedak »

Doing it in 3D is a good idea, thank you. I may try that, but my mate have prepared some 2D images for the items already, so is there a 2D approach to the same thing?
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

u can just arrange the images in a grid
The Robomaniac
Project Head / Lead Programmer
Centaur Force
Preedak

Post by Preedak »

So I can just use "driver->draw2DRectangle(..)" to draw grids and then arrange the image file into each rectangle right. Then:

1> How can I select those images and let the game know that I'm selecting it?
2> I don't know why but my game crash it I load the same texture twice?
(getTexture then drop it, and later get it again)
Morrog
Posts: 58
Joined: Mon Dec 13, 2004 5:13 am

Post by Morrog »

You're not supposed to drop a texture :roll:

And to see which image you've selected is pretty simple.
There's two ways. GUI items have a function to see if they are selected. Name doesn't come to mind, check the docs.

Second method is to take the mouse position and do some simple math.
Preedak

Post by Preedak »

OK. :lol:
Post Reply