Game Development Community

dev|Pro Game Development Curriculum

DragDropGui Control

by Stefan Beffy Moises · 04/07/2004 (12:47 pm) · 60 comments

This gui was originally written by Jarred Schnelle (Jafa Rykos) in 2003 and I have updated it to work with the current HEAD and to show the functionality in a little demo gui...
The demo gui artwork was kindly provided by Timothy Aste, www.gremlinstudios.com - thanks dude!

Please note: this is not a working inventory system, it's only the fancy gui/frontend part of it...
any inventory or whatever logic has to be implemented by the user... :-)

The zip contains a readme file, the source files, images as well as a patch file so that you don't have to make the necessary changes manually if you don't want to...

Here is what it looks like:
tork.beffy.de/images/remository_pics/dragdrop.jpg
and here is a little video showing it in action:
tork.beffy.de/downloads/videos/dragdrop1.avi (~1 MB, DivX 5.05)

Since the file is too large for the resource, you can grab it
here.

Have a lot of fun! :-)
#21
07/31/2005 (6:40 pm)
I don't know if anyone still looks at this resource, which is sad because it is quite nice, but... I have a problem.

I'm using it with my Inventory system but if I go into a game, move some objects around in the inventory, leave the game, and rejoin... my Inventory will stay in the same spot I moved it to previously. Has anyone had this problem? Is it somewhere in my script or is that just how the C++ end of the resource was programmed?

Edit: Same with dying and respawning, your starting inventory will be where you had it before dying.
#22
02/26/2006 (6:43 pm)
Has anyone managed to get this to work in TSE?
#23
04/20/2006 (5:03 pm)
I'm in troubles ;)
I'm trying to adapt it with our requirements.... all is fine except one thing..

we have (in three places) the comparing of:
this->getDropBorderSearch() == DDBCtrl->getDropBorderType()
or
searchString == DDBCtrl->getDropBorderType()

I want to make ability to set like:
.dropBorderSearch = "weapon tools";
.dropBorderType = "armor coat";
and to use something like getWord in comparing..
So, on different DD's I can set multiple values ... got idea?

I was trying to use this:
bool ddBorderOk =false;
                  U32 sCount = getUnitCount(searchString, " ");
                  U32 tCount = getUnitCount(DDBCtrl->getDropBorderType(), " ");
                  U32 sInc=0;
                  U32 tInc=0;
                  while ( sInc<sCount && !ddBorderOk )
                  {
                     while ( tInc<tCount && !ddBorderOk )
                     {
                        if (getUnit(searchString, sInc, " ") == getUnit(DDBCtrl->getDropBorderType(), tInc, " "))
                        {
                           ddBorderOk = true;
                        }
                        tInc++;
                     }
                     sInc++;
                  }
The getUnitCount and getUnit I took from consoleFunctions.cc
While getUnitCount works perfectly, getUnit comparision gives some
strange stuff, as it always true, even if I comparing
.dropBorderType = "asd dsa";
and
.dropBorderSearch = "aaa sss";

I'm not that good in c++ so... anyone?
or maybe there is another working function like getWord but in c++?
#24
05/16/2006 (7:55 pm)
Hm has anyone used this with ver 1.4?

edit: Well, it seems to work, other than a bunch of the gui files have been moved around.
#25
07/25/2006 (1:03 pm)
Has anyone successfully ported this over to TSE yet?
#26
10/18/2006 (1:26 pm)
Quote:
Kyle Cook (Jul 25, 2006 at 22:03)
Has anyone successfully ported this over to TSE yet?

For TSE (0_4_5_0) Download code here :

http://xoomer.alice.it/afraboni/teamitalia/DragDrop.rar

Bye

^_^
#27
11/17/2006 (8:17 am)
Does anyone have the updated link to the code? The above link seems to send me back in circles with no code example?
#30
01/05/2007 (5:28 am)
Hi

I am new to torque.

I am using Beffy resources.i compiled the engine successfully.

i am very thankful to Beffy.this resources is working nicely for me.

But i have some problems.i want to drop items on ground from DragDrop inventory.

but i am not knowing the proper functions and .cs file to be modified.

if possible could any body help me.

i am thanking in advance.
#31
01/25/2007 (12:45 am)
Anyone tried this with 1.5? It seems like guiDragDropButtonCtrl.cc is calling things from GuiControl that aren't there.
#32
02/11/2007 (9:59 am)
@Chris

There are C++ changes in the readme, the only difference between the readme and the current build of TGB is that the changes in the guiCanvas.cc should be in TGBs guiMenuBar.cc.
#33
04/06/2007 (3:06 am)
Super ressource - thanks Beffy

Great starting point for our "pimp my vehicle" gui with upgradable object slots

With very few tweaks it just worked in 1.5
#34
04/06/2007 (10:47 am)
1.5.1 seems to have killed this resource for me. I'm working on debugging it.

I get errors like:
error C2039: 'mDragDropArraySize' : is not a member of 'GuiControl'
and
error C2039: 'DragDropArray' : is not a member of 'GuiControl'

Does anyone know how DragDropArray should be implemented into GuiControl to make this work?
#35
04/28/2007 (6:06 pm)
Has anyone been able to fix Stephen's problem yet? I'm having the same issue. ^^^^
#36
05/05/2007 (4:28 am)
I'm not sure about the problems that Stephan and Andy are having, however I have just patched this into the TGE 1.5.1 release.
Had to modify some paths in the .h and .cc files, and choose the appropriate place to put the "guiDragDropButtonCtrl.*" files.

For anyone attempting this, just take note of the new folder structure for the engine/gui folders.
You will need to modify the path in guiDragDropButtonCtrl.h, near the top. (Note: I placed the files into the engine/gui/controls/ folder)

From:
#ifndef _GUIMOUSEEVENTCTRL_H_
#include "gui/guiMouseEventCtrl.h"
#endif
To:
#ifndef _GUIMOUSEEVENTCTRL_H_
#include "gui/controls/guiMouseEventCtrl.h"
#endif

and in the guiDragDropButtonCtlr.cc file
From:
#include "gui/guiCanvas.h"           
#include "gui/guiDragDropButtonCtrl.h"
To:
#include "gui/core/guiCanvas.h"           
#include "gui/controls/guiDragDropButtonCtrl.h"

There may have been a couple of other paths that needed changing, but you should spot where that needs to be done in the readme.txt that comes in the file package.
Lastly there are a couple of references to "guiMenuBar" which needs to be changed to "guiCanvas".

-Dennis.
#37
05/05/2007 (7:08 am)
Hi Dennis. I'm trying to use the TSE/TGEA version of this, which isn't working.
#38
06/21/2007 (5:59 am)
Hi all. I got this to work in TGEA but when I open my gui there are no weapons/items. Can someone send me and example of how they set up the DragDropGui.cs file?? Or is it in the .gui file I need to make my mods in?? Thnks
#39
06/22/2007 (9:24 pm)
There are a bunch of changes for guiControl that go with the resource that aren't in the downloads. Can someone post an update please?
#40
07/02/2007 (5:02 pm)
if you're getting the errors like
error C2039: 'mDragDropArraySize' : is not a member of 'GuiControl'
it's probably because you didn't edit guicontrol.h and cc

the readme file in the download tells you what to do.