[Solved]In need of simple GUI tutorial

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
flatline

[Solved]In need of simple GUI tutorial

Post 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?
Last edited by flatline on Sun Feb 03, 2013 4:01 pm, edited 1 time in total.
flatline

Re: [Help]In need of simple GUI tutorial

Post 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.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: [Help]In need of simple GUI tutorial

Post 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
Finished Dungeons - complete mods to play
flatline

Re: [Solved]In need of simple GUI tutorial

Post 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.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: [Solved]In need of simple GUI tutorial

Post by Komag »

ah, I should have suspected alpha.

The GUI stuff has helped my project a lot, very nice stuff
Finished Dungeons - complete mods to play
Post Reply