Page 1 of 1

[Solved]In need of simple GUI tutorial

Posted: Sat Feb 02, 2013 10:15 pm
by flatline
I'm trying to show a small icon I've created on the hud. Right now, I managed to get it working by switching the file reference in Toorums Quest, but if I try it in my regular dungeon, nothing shows. I just need a short, working script for inserting a graphical icon.

Right now, I have:

Code: Select all

cloneObject{
  name = "party",
  baseObject = "party",
  onDrawGui = function(icon)
  guiscript.Icon(icon)
  end,
}
and in my "guiscript" script I have:

Code: Select all

function Icon(icon)
	icon.drawImage("mod_assets/icon.tga", 0, 0)
end
I'm obviously missing some parts. Thoughts?

Re: [Help]In need of simple GUI tutorial

Posted: Sun Feb 03, 2013 1:37 pm
by flatline
Is there no-one who can give a hint?

What am I missing here?
The image itself works in-game when tested with Toorums Quest 2, so clearly I've misunderstood how the GUI scripting works. I've tried searching but I can't seem to find what I'm missing.

Re: [Help]In need of simple GUI tutorial

Posted: Sun Feb 03, 2013 2:17 pm
by Komag
I have never tested an image, but the description says:
drawImage(filename, x, y): draws an image modulated with current pen color.
so maybe you need to set the color first, like:

Code: Select all

icon.color(255,255,255)
I personally would also try with more difference in names to keep things straight, but that's just me

Re: [Solved]In need of simple GUI tutorial

Posted: Sun Feb 03, 2013 4:03 pm
by flatline
Solved it. To sum up what I learned:
DDS images need an alpha channel, even if you aren't using it. Mipmaps seem to be a must too, even if unused. Size is not an issue though. The original script issue solved itself and I'm not sure how. I just redid the dungeon a fifth time and it worked. GUI editing is fun.

Re: [Solved]In need of simple GUI tutorial

Posted: Sun Feb 03, 2013 5:09 pm
by Komag
ah, I should have suspected alpha.

The GUI stuff has helped my project a lot, very nice stuff