From ric_eng on Ogre's Message Board
Hi guy,
How can I do one inventory, similar to War Craft, when have one inventory in down?
I tried with CEGUI, but i dont know.how to make to press in the image, the inventory it must inside be an image or a button with the image?
thanks
Inventory with CEGUI
Moderators: CEGUI MVP, CEGUI Team
This topic has come up a few times without any real solution offered. I'll need this feature also so I decided to create this post, which may result in a higher level widget being created, or at least a Wiki example. So, what features are needed and how would we go about doing that with Cegui?
I think the most common display is a grid of images (icon view), possibly with a name below the image and a count (how many of that item are stacked). The count is often displayed over the image, in one of the four corners. The interface should make it possible to add items to a stack, split items from the stack, and move stacks around. It might be desirable to sort the items on one of their data (name) or simply let the user specify where the items are to be positioned. When automatically adding an item the program would search for the first available slot and put the item there.
A second type of display is a list, where each of those characteristics being displayed in columns. In this display mode the "position" within the icon grid is not useful since items are usually sorted according to the data in one of the columns.
So far we need a DragItem to support drag and drop, to move items around. These are moved from one DropTarget (inventory slot when in icon view) to another. They would be composed of a StaticImage to display the image of the object, a StaticText to display the name below, and possibly another StaticText to display the stack count (I would not display this count when there is only 1 item in the stack.
The DropTarget could simply be a Static object with a visible border; the border would be used as a visual cue to the user, to display a valid drop position. This is needed when the grid is uneven, such as an inventory that could contain 10 items and currently displays 4 slots in the first and second row but only 2 in the third row. The border can also be used to "highlight" a selected item, for example when a user wants to select the item to sell to a merchant.
The inventory window itself could be a FrameWindow with a ScrollablePane. Resizing the FrameWindow needs to be monitored, such as preventing the FrameWindow to become smaller than a single cell; maybe the resizing should be limited to force at least one row to always be visible and at least one column.
The http://www.cegui.org.uk/phpBB2/viewtopic.php?t=1040 (if it ever gets completed) will go a long way toward making this inventory thing much simpler. However it's a complex task (I'm referring to the rules that allow one DragItem to be dropped into a DropTarget). I've gone through a few revisions and have not found the absolute best solution.[/list]
I think the most common display is a grid of images (icon view), possibly with a name below the image and a count (how many of that item are stacked). The count is often displayed over the image, in one of the four corners. The interface should make it possible to add items to a stack, split items from the stack, and move stacks around. It might be desirable to sort the items on one of their data (name) or simply let the user specify where the items are to be positioned. When automatically adding an item the program would search for the first available slot and put the item there.
A second type of display is a list, where each of those characteristics being displayed in columns. In this display mode the "position" within the icon grid is not useful since items are usually sorted according to the data in one of the columns.
So far we need a DragItem to support drag and drop, to move items around. These are moved from one DropTarget (inventory slot when in icon view) to another. They would be composed of a StaticImage to display the image of the object, a StaticText to display the name below, and possibly another StaticText to display the stack count (I would not display this count when there is only 1 item in the stack.
The DropTarget could simply be a Static object with a visible border; the border would be used as a visual cue to the user, to display a valid drop position. This is needed when the grid is uneven, such as an inventory that could contain 10 items and currently displays 4 slots in the first and second row but only 2 in the third row. The border can also be used to "highlight" a selected item, for example when a user wants to select the item to sell to a merchant.
The inventory window itself could be a FrameWindow with a ScrollablePane. Resizing the FrameWindow needs to be monitored, such as preventing the FrameWindow to become smaller than a single cell; maybe the resizing should be limited to force at least one row to always be visible and at least one column.
The http://www.cegui.org.uk/phpBB2/viewtopic.php?t=1040 (if it ever gets completed) will go a long way toward making this inventory thing much simpler. However it's a complex task (I'm referring to the rules that allow one DragItem to be dropped into a DropTarget). I've gone through a few revisions and have not found the absolute best solution.[/list]
Who is online
Users browsing this forum: No registered users and 22 guests