Creation/Dev/Script/Client/GuiStretchCtrl: Difference between revisions
(Added picture, description and an example script) |
m (→Description: Fixed a spelling error) |
||
Line 9: | Line 9: | ||
Use ''globalToLocalCoord()'' and ''localToGlobalCoord()'' to translate between real mouse positions and scaled positions inside the control. | Use ''globalToLocalCoord()'' and ''localToGlobalCoord()'' to translate between real mouse positions and scaled positions inside the control. | ||
GuiStretchCtrl can make it easier to do games inside the GUI since you don't need to care about resizing, you can just use absolut coordinates and the GuiStretchCtrl is automatically stretching the graphics and text and is | GuiStretchCtrl can make it easier to do games inside the GUI since you don't need to care about resizing, you can just use absolut coordinates and the GuiStretchCtrl is automatically stretching the graphics and text and is translating mouse positions to correctly hit the buttons and other controls. | ||
=Variables= | =Variables= |
Revision as of 03:46, 23 February 2007
Inherits GuiControl.
Description
This control stretches the content (client controls) to the current size of the control. Define clientwidth and clientheight (or clientextent) to say which area should be stretched to the actual size.
Use globalToLocalCoord() and localToGlobalCoord() to translate between real mouse positions and scaled positions inside the control.
GuiStretchCtrl can make it easier to do games inside the GUI since you don't need to care about resizing, you can just use absolut coordinates and the GuiStretchCtrl is automatically stretching the graphics and text and is translating mouse positions to correctly hit the buttons and other controls.
Variables
clientwidth - integer, defines the width of the area to stretch
clientheight - integer, defines the height of the area to stretch
clientextent - of format {width,height}, combination of clientwidth and clientheight
Example
new GuiStretchCtrl("Test_Stretch") { x = 10; y = 10; width = 160; height = 120; clientwidth = 176; clientheight = 70; new GuiShowImgCtrl("Test_StretchContent1") { x = 0; y = 0; image = "2002_sysmsgbg.png"; width = 176; height = 70; } new GuiButtonCtrl("Test_StretchContent2") { profile = GuiButtonProfile; x = 38; y = 30; width = 100; height = 30; text = "Stretch"; } }