Game Development Community

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());

#1
06/17/2013 (10:44 am)
You need to have a base GuiControl that fills the screen and then add your sprite control - every time I try to push a control using pushDialog without a full screen base control it gets expanded to fill the whole screen. If you need mouse clicks to pass through make sure you set the base control's modal field to false.

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.