Hey Guys, I started work on the container GUI recently. made a few bits of progress amidst no knowledge of the codebase, no experience with C++ (i have been spoilt with C#, I must admit)
here is a screeny
You can activate containers and a window pops up with its name.
(I'll see if I can get sounds working too)
I also have the function that can add new items(test items, same functionality as the console command additem) into the container.
I haven't yet gotten that visualised other than showing weight in the container. (I added 200 Fur Cuirass' into it)
One thing I will need to find out how to do (help would be cool) is working with the container store iterator. Its a bit gnarly and my current attempts to do so make it that I have to change the scope of some var's from private to public to get it to work. (I'm most definitely doing it wrong).
Inventory/Container GUI
Inventory/Container GUI
Last edited by hircine on 29 Mar 2012, 10:15, edited 1 time in total.
Reason: HOLY SCREENSHOTS MAN DRESSED LIKE A BAT.
Reason: HOLY SCREENSHOTS MAN DRESSED LIKE A BAT.
Re: Inventory/Container GUI
That is actually of limited use (maybe as a private helper function). Each frame while a container GUI is open, you should check if the content of the container has changed. If that has happened, you need to iterate over the content of the iterator and update the GUI accordingly.I also have the function that can add new items(test items, same functionality as the console command additem) into the container.
Yes, you are. But I can't tell from your problem description what the problem is. You need to iterate over the container and change what is displayed in the GUI accordingly (wiping the GUI completely and then filling it back should be sufficient for a start). The container iterator is more or less a standard iterator like you find it in the STL. If you can use these, you should also be able to use the container iterators.One thing I will need to find out how to do (help would be cool) is working with the container store iterator. Its a bit gnarly and my current attempts to do so make it that I have to change the scope of some var's from private to public to get it to work. (I'm most definitely doing it wrong).
Re: Inventory/Container GUI
I'm helping hircine with this task. For now, i mostly took his code and corrected it.
Right now, you can open an container and see what's inside with nice icons and item stacking.
I'm working on the player inventory, and hircine is working on xml files/good look stuff.
Right now, you can open an container and see what's inside with nice icons and item stacking.
I'm working on the player inventory, and hircine is working on xml files/good look stuff.
Re: Inventory/Container GUI
Is there a proper way to remove an object from a containerStore?
Re: Inventory/Container GUI
One more question: (related to the previous one)
How to move a Ptr from one container to another?
How to move a Ptr from one container to another?
Re: Inventory/Container GUI
You can't. Copy and delete instead. Use the add function of the destination container and then set the count of the original item to 0.
Re: Inventory/Container GUI
I was trying t do that but i must do something wrong.
Here is what i'm doing:
But that seems a little stupid, as *iter and Item are still pointing toward the same object... Also, this lead to an instant crash.
So how do i do a real copy of a ptr?
Here is what i'm doing:
Code: Select all
Container1Iterator iter = blabla;
iter->getRefData().setCount(0);
Ptr item = *iter;// the object we want to copy. But this does not create a new ptr...
Container2->add(item);
So how do i do a real copy of a ptr?
Re: Inventory/Container GUI
What you should do: copy and delete.
What you have done: delete and copy. Not very surprising that it doesn't work.
What you want is to create a copy of the object that the pointer is pointing to. The add function takes care of that.
What you have done: delete and copy. Not very surprising that it doesn't work.
That is not what you want. Copying a Ptr does not create a new object. It just creates a new pointer to the old object.So how do i do a real copy of a ptr?
What you want is to create a copy of the object that the pointer is pointing to. The add function takes care of that.