Game Development Community

Mouseover buttons

by Jendrik Posche · in Torque Game Engine · 08/12/2008 (5:01 am) · 1 replies

Hi All,

Im trying to create a button that has a mouse over. I've read that the file names should be:

button_n.png
button_i.png
button_d.png
button_h.png

However when I have these images in my directory, i only get the normal button.png. When I open the console I'm seeing the following error:
Could not locate texture: /button.png_d
Could not locate texture: /button.png_i
Could not locate texture: /button.png_h

But when I use
button.png_d
button.png_i
button.png_h

I get the following error:

ResourceObject::construct: NULL resource create function for 'button.png_h'
Warning /engine/core/resmanager.cc 793 ResourceObject::construct: NULL resource create function.

How come it's adding _h/_d/_i after the extension? And how come it resmanager can't load the image.

I'm using TGE 1.5.2 here.

Regards

#1
08/12/2008 (6:41 am)
Your file names are correct, but you've got the name wrong in your GUI. The reason it was looking for button.png_d, etc is because you in the bitmap field for the button you put button.png. The correct way would have been just button, no underscores, no extensions.

Example:

new GuiBitmapButtonCtrl(OverlayQuitPage) {
      profile = "GuiButtonProfile";
      horizSizing = "left";
      vertSizing = "bottom";
      position = "614 10";
      extent = "16 14";
      minExtent = "8 2";
      visible = "1";
      command = "quit();";
      text = "Button";
      groupNum = "-1";
      buttonType = "PushButton";
      [b]bitmap = "./arrows/exit";[/b]
         helpTag = "0";
   };

Torque takes the base name of the texture you're looking for, adds the _whatever, and then looks for that texture starting in the folder that was initially designated. It will check for all the extensions that Torque supports and if it doesn't find it the first time it will then start moving up directories and looking there.