Difference between revisions of "DgsGetScreenSize"

From Multi Theft Auto: Wiki
Jump to: navigation, search
(Syntax)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
{{Client function}}
 
{{Client function}}
This function is a replica of dgsGetScreenSize. In order to satisfy the needs of developers, the function exists here.
+
This function is a replica of [[[guiGetScreenSize]]. In order to satisfy the needs of developers, the function exists here.
  
 
==Syntax==  
 
==Syntax==  

Revision as of 03:12, 17 July 2019

This function is a replica of [[[guiGetScreenSize]]. In order to satisfy the needs of developers, the function exists here.

Syntax

float, float dgsGetScreenSize()

Returns

This returns two floats representing the player's screen resolution, width and height.

Example

This example checks whether a player is using a low resolution, and warns them that GUI may appear incorrect.

--setup a function when the resource starts
DGS = exports.dgs

function checkResolutionOnStart ()
	local x,y = DGS:dgsGetScreenSize() --get their screen size
	if ( x <= 640 ) and ( y <= 480 ) then --if their resolution is lower or equal to 640x480
		--warn them about GUI problems.
		outputChatBox ( "WARNING: You are running on a low resolution.  Some GUI may be placed or appear incorrectly." )
	end
end
--attach the function to the event handler
addEventHandler ( "onClientResourceStart", resourceRoot, checkResolutionOnStart )

See Also

Multi Language Supports

Animation

3D Interface

3D Text

Arrow List

Browser

Button

Check Box

Combo Box

Edit

Ellipse Detect Area

Detect Area

Grid List

Image

Memo

Label

Progress Bar

Radio Button

Scroll Bar

Scroll Pane

Switch Button

Tab Panel

Window

Plugin

Media Browser

Rounded Rectangle

Color Picker