DgsGetSize: Difference between revisions
Jump to navigation
Jump to search
m (DGS OOP Syntax changing) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
float float dgsGetSize ( element theElement, bool relative ) | float, float dgsGetSize ( element theElement, bool relative ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{DGS/OOP| | |||
Note = It variables is a conjunction: | |||
*Relative: '''size.relative''' (whether element size is relative) | |||
*Width: '''size.w''' or '''size.width''' | |||
*Height: '''size.h''' or '''size.height''' | |||
*toVector: '''size.toVector''' [returns a [[Vector/Vector2|Vector]], use <code>size.toVector.x</code> (for width) and <code>size.toVector.y</code> (for height)]| | |||
Method = DGSElement:getSize| | |||
Variable = size| | |||
Counterpart = dgsSetSize | |||
}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 25: | Line 35: | ||
==See Also== | ==See Also== | ||
{{ | |||
===<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Functions</span>=== | |||
{{DGS General Functions}} | |||
===<span style="color:#eb3f00;text-shadow:0.05em 0.05em 0.2em #00000099;">General Events</span>=== | |||
{{DGS Events/General}} |
Latest revision as of 19:02, 3 May 2021
This function gets the size of a DGS element.
Syntax
float, float dgsGetSize ( element theElement, bool relative )
DGS OOP Syntax Help! I don't understand this!
- Note: It variables is a conjunction:
- Relative: size.relative (whether element size is relative)
- Width: size.w or size.width
- Height: size.h or size.height
- toVector: size.toVector [returns a Vector, use
size.toVector.x
(for width) andsize.toVector.y
(for height)]
- Method: DGSElement:getSize(...)
- Variable: .size
- Counterpart: dgsSetSize
Required Arguments
- theElement: The DGS element to get size of.
- relative: This is whether sizes and positioning are relative. If this is true, then all x,y,width,height floats must be between 0 and 1, representing sizes relative to the parent.
Returns
Returns the DGS element size x and y if the function has been successful, false otherwise.
Example
This example creates a random sized dgs window and outputs its size to the chatbox.
DGS = exports.dgs local window = DGS:dgsCreateWindow ( 0, 0, (math.random ( 0, 100 ) / 100), (math.random ( 0, 100 ) / 100), "test", true ) -- Create the window local x, y = DGS:dgsGetSize ( window, false ) -- Get the dgs window size outputChatBox ( "Window size: " .. x .. " " .. y ) --output the dgs window size
See Also
General Functions
- dgsGetPosition
- dgsSetPosition
- dgsSetParent
- dgsGetParent
- dgsGetChild
- dgsGetChildren
- dgsGetSize
- dgsSetSize
- dgsGetType
- dgsSetLayer
- dgsGetLayer
- dgsSetCurrentLayerIndex
- dgsGetCurrentLayerIndex
- dgsGetLayerElements
- dgsGetProperty
- dgsSetProperty
- dgsSetPropertyInherit
- dgsGetProperties
- dgsSetProperties
- dgsGetVisible
- dgsSetVisible
- dgsGetEnabled
- dgsSetEnabled
- dgsGetPositionAlignment
- dgsSetPositionAlignment
- dgsGetAlpha
- dgsSetAlpha
- dgsGetFont
- dgsSetFont
- dgsGetText
- dgsSetText
- dgsGetPostGUI
- dgsSetPostGUI
- dgsGetInputEnabled
- dgsSetInputEnabled
- dgsGetInputMode
- dgsSetInputMode
- dgsAttachToAutoDestroy
- dgsDetachFromAutoDestroy
- dgsFocus
- dgsBlur
- dgsCreateFont
- dgsBringToFront
- dgsMoveToBack
- dgsGetScreenSize
- dgsGetCursorPosition
- dgsGetMouseEnterGUI
- dgsGetMouseLeaveGUI
- dgsIsMouseWithinGUI
- dgsSetSystemFont
- dgsGetSystemFont
- dgsGetElementsInLayer
- dgsGetElementsFromResource
- dgsGetFocusedGUI
- dgsImportFunction
- dgsImportOOPClass
- dgsG2DLoadHooker
- dgsSetRenderSetting
- dgsGetRenderSetting
- dgsSimulateClick
- dgsGetRootElement
- dgsAddMoveHandler
- dgsRemoveMoveHandler
- dgsIsMoveHandled
- dgsAddSizeHandler
- dgsRemoveSizeHandler
- dgsIsSizeHandled
- dgsAttachElements
- dgsDetachElements
- dgsElementIsAttached
- dgsAddPropertyListener
- dgsRemovePropertyListener
- dgsGetListenedProperties
- dgsSetMultiClickInterval
- dgsGetMultiClickInterval
- dgsSetMouseStayDelay
- dgsGetMouseStayDelay
- dgsCenterElement
- dgsSetElementKeeperEnabled
- dgsGetElementKeeperEnabled
- dgsSetClickingSound
- dgsGetClickingSound
- dgsSetClickingSoundVolume
- dgsGetClickingSoundVolume
General Events
- onDgsBlur
- onDgsCreate
- onDgsCursorTypeChange
- onDgsCursorStateChange
- onDgsDestroy
- onDgsElementRender
- onDgsElementMove
- onDgsElementSize
- onDgsElementEnter
- onDgsElementLeave
- onDgsFocus
- onDgsKey
- onDgsPositionChange
- onDgsPreRender
- onDgsRender
- onDgsElementScroll
- onDgsSizeChange
- onDgsTextChange
- onDgsWindowClose
- onDgsPropertyChange