Jump to content

GUI Compatible Screen


CapY

Recommended Posts

  • 7 months later...
Posted

To make a gui element working in the same place in the screen but working for all resolutions only use:

(posX/resolutionWidth)*xguiGetScreenSizeVariable, (posY/resolutionHeight)*yguiGetScreenSizeVariable, (width/resolutionWidth)*xguiGetScreenSizeVariable, (height/resolutionHeight)*yguiGetScreenSizeVariable 

Posted

Then let me help them.

There's 2 types of GUI's:

Absolute and Relative.

I recommend using relative for beginners and absolute for advanced scripters.

For example:

guiCreateStaticImage ( float x, float y, float width, float height, string path, bool relative, [element parent = nil] ) 

Float x = integer ( number ( 0-9999 ) ), represents a position of window in X units.

Float y = integer ( number ( 0-9999 ) ), represent a position of GUI element in Y units.

Float width = integer ( number ( 0-9999 ) ), represents the size of GUI element.

Example: <-------------------------------------->

Float height = integer ( number ( 0-9999 ) ), represents the size of GUI element.

Example:

^

|

|

|

|

|

|

v

string = "blablabla", "", ' ', basically quotes.

bool = true and false

element parent = nil - this is an optional argument.

nil = represents nothing

Example of usage:

guiCreateStaticImage( 0.20, 0.200, 0.100, 0.100, "imagename.png",true ) 

Relative GUI's has to contain decimals in integers, while Absolute ones don't.

For having accurate absolute GUI's, simply use this:

local screenWidth, screenHeight = guiGetScreenSize() 
    local windowWidth, windowHeight = 800, 600 
    local left = screenWidth/2 - windowWidth/2 
    local top = screenHeight/2 - windowHeight/2 

Apologises for mistakes, I'm in rush.

Posted
Then let me help them.

There's 2 types of GUI's:

Absolute and Relative.

I recommend using relative for beginners and absolute for advanced scripters.

For example:

guiCreateStaticImage ( float x, float y, float width, float height, string path, bool relative, [element parent = nil] ) 

Float x = integer ( number ( 0-9999 ) ), represents a position of window in X units.

Float y = integer ( number ( 0-9999 ) ), represent a position of GUI element in Y units.

Float width = integer ( number ( 0-9999 ) ), represents the size of GUI element.

Example: <-------------------------------------->

Float height = integer ( number ( 0-9999 ) ), represents the size of GUI element.

Example:

^

|

|

|

|

|

|

v

string = "blablabla", "", ' ', basically quotes.

bool = true and false

element parent = nil - this is an optional argument.

nil = represents nothing

Example of usage:

guiCreateStaticImage( 0.20, 0.200, 0.100, 0.100, "imagename.png",true ) 

Relative GUI's has to contain decimals in integers, while Absolute ones don't.

For having accurate absolute GUI's, simply use this:

local screenWidth, screenHeight = guiGetScreenSize() 
    local windowWidth, windowHeight = 800, 600 
    local left = screenWidth/2 - windowWidth/2 
    local top = screenHeight/2 - windowHeight/2 

Apologises for mistakes, I'm in rush.

I recommend using relative for beginners and absolute for advanced scripters. Same thing...

Posted

Same thing...

Absolute GUI elements are NOT always correct on all resolutions while relative ones are.

I know. But what you said isn't about what I said... I said "Same thing..." about "I recommend relative for begginers and absolute for advanceds".

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...