DgsGetSize

From Multi Theft Auto: Wiki
Revision as of 20:32, 16 April 2021 by Lettify (talk | contribs) (DGS (OOP Syntax)/(Template Organization) Mission)
Jump to navigation Jump to search

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!

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

General Events