Game Development Community

Automatically scale bitmap to window?

by Doctor Fail · in Torque 2D Beginner · 11/18/2013 (8:57 pm) · 1 replies

So I'm putting finishing touches on my first rudimentary "Main Menu", and I've run across a small problem. I want to set a background image for the main menu using a GuiBitmapCtrl object, and I can get it to auto-size to the window on startup, but I cant seem to get it to resize with the window AND automatically scale itself to the window when the game begins. Here's what I've done:
%bg = new GuiBitmapCtrl()
{
HorizSizing = "";//cannot figure out what to set these to to get this right
VertSizing = "";
profile = MMGUI;
//extent = Canvas.getExtent(); //doesn't work, canvas does not start in the proper resolution
extent = getwords($pref::video::windowedres, 0, 1); // is there a way to do this with TAML?
bitmap = "./images/space.png";
cliptoparent = true;
};
If anyone has an idea, I would like to finish this up so I can work on some type of documentation of what I've learned to help the Gui documentation with everyone else.

#1
11/18/2013 (9:19 pm)
What are you using for the parent control? You could have the background image be the parent control since that control automatically resizes itself to the window. The ConsoleDialog and ToolboxDialog from the Sandbox have a blue background gradient with GuiSpriteCtrl that is used in this way.