GuiSpriteCtrl Spawning Humongous
by practicing01 · in Torque 2D Beginner · 06/17/2013 (8:15 am) · 1 replies
I set its extents to 64x64 but it takes up the entire screen. Am I missing something or can someone point me to where in the source gui objects are rendered so I can try and find if it's a bug.
%ass=AssetDatabase.acquireAsset("DotsandCrits:image_joycursor");
%size="0 0";
if (%ass.getCellWidth()==0)
{
%size=%ass.getImageSize();
}
else
{
%size.X=%ass.getCellWidth();
%size.Y=%ass.getCellHeight();
}
$joycursor=new GuiSpriteCtrl()
{
Profile=gui_profile_modalless;
Position="0 0";
Extent=%size;
Image="DotsandCrits:image_joycursor";
HorizSizing="relative";
VertSizing="relative";
};
Canvas.pushDialog($joycursor);
AssetDatabase.releaseAsset(%ass.getAssetId());
Torque Owner Richard Ranft
Roostertail Games
If you already have a gui in place you could just add the sprite to it instead.
I think this behavior is unexpected - I didn't expect it - so we should either document it or change it.