Jump to content

getScreenSize help


..:D&G:..

Recommended Posts

Posted

Hey, I need some hep on the function getScreenSize. This seems to be a really helpfull function for me, but I need a bit more help.

How do I use this function for this line? :

dxDrawRectangle(52, 220, 329, 351, tocolor(1, 0, 0, 170), true) 

I know I have to do:

local x, y = guiGetScreenSize() 

Now how do I implement the x and y on the position of the rectangle?

76561198066470453.png

SP37Ecj.jpg?2MTA:Rust Pre-Alpha Build v.0.3:SP37Ecj.jpg?2

https://forum.mtasa.com/viewtopic.php?f=114&t=97848

2Pac: ''Only God can judge me!''

Posted

What are you trying to do?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
local sx, sy = guiGetScreenSize ( ) 
dxDrawRectangle( ( sx / 2 - 52 ), ( sy / 2 - 220 ), 329, 351, tocolor(1, 0, 0, 170), true) 

The position won't be correct now, but you can move it until it fit what you need and see if it worked.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
local sx, sy = guiGetScreenSize ( ) 
dxDrawRectangle( ( sx / 2 - 52 ), ( sy / 2 - 220 ), 329, 351, tocolor(1, 0, 0, 170), true) 

The position won't be correct now, but you can move it until it fit what you need and see if it worked.

leveraging the topic, how to put rims or contour in DxDrawRectangle?

Posted

sx / 2 = half of the screen width.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...