Game Development Community

dev|Pro Game Development Curriculum

Gui Icon Control

by Christian M Weber · 04/15/2003 (12:15 pm) · 7 comments

Download Code File

Download the ZIP file and add guiIconCtrl.cc to your project.

New GUI objects need to be included and defined in gu/guiCanvas.cc

after all the other #include add
#include "gui/guiIconCtrl.h"

scroll down a little and add
IMPLEMENT_CONOBJECT(GuiIconCtrl);

...and compile (if you get any errors, do a clean compile)


Put the IconCtrl.cs in your client/scripts folder (you can exec it yourself in-game, or put a
exec("./scripts/IconCtrl.cs"); command in init.cs under the initClient() function anywhere after loading the GUIs )

Icon.png was ripped from some EQ site :p

Have fun with it.

#1
04/15/2003 (12:51 pm)
sounds like a good deal, thanks!
#2
04/15/2003 (7:11 pm)
Hmm, is this suitable for inventory drag to location?
#3
04/16/2003 (3:58 pm)
To what extent does this Gui function? Is it only a moveable icon or is it drag/drop?

I'm curious because I've already coded a functional drag/drop gui button, but I never made it a resource. If this isnt a full blow drag/drop button let me know and I'll send you the source and maybe you can make a resource out of it :)

jschnell@arn.net
#4
04/20/2003 (3:31 am)
@Erik, yes, thats what I use it for :) i modded the script I uploaded tho.. so if you want what I have, e-mail me.

@Jared, You can drag & drop, but you have to define where you can in the script and in the Gui.
#5
09/19/2004 (7:48 pm)
Chris,
I played with your code and it seems to work quite well. I had to modify the script to do what I wanted. I am using it for generic Icon code in the GUI itself.
I have a question: What is mCap? I cannot seem to find that math function in the docs. Everytime the onMouseUp code is executed it returns an error saying it cannot find mCap.

Thanks,
Frank
#6
05/25/2005 (12:54 pm)
I recently played with this resource, and I had to make some adjustments. First I changed the .cs file to allow any parent object to use the icon gui class. In its original form, you could only use it while in a mission. I needed to use it before a mission. Also, the original code centers the icon to the cursor when you click on it, so if you click on the icon at the lower left part of it, it will "jump" to the center. I didn't like the jump, so now where you click and drag the icon is where it stays (more windows like)

Here are the updated files if your interested. There are no instructions, as they are the same as above.

Updated files.

B--
#7
04/13/2007 (3:28 am)
This Ressource has never worked, because "mCap" function was not a part of the content file ;)

But i found this as a replacement:

function mCap(%inputValue, %minimumValue, %maximumValue)
{
   %returnValue = %inputValue;

   if (%returnValue < %minimumValue) 
   {
      %returnValue = %minimumValue;
   }

   if (%returnValue > %maximumValue) 
   {
      %returnValue = %maximumValue;
   }

   return %returnValue;
}

Its do the work, have tested it (thx @ Luke D).