Jump to content

how to calculate HUD coordinates


Kaneki16

Recommended Posts

Posted

First you need to get the clients' screen resoulution, you can do it by:
 

local sx, sy = guiGetScreenSize()

I usually divide sx and sy by 2 so:
 

dxDrawImage(sx/2, sy/2, 50, 50, "someimg.png")

And then you start positioning your image.

dxDrawImage((sx/2) - 300, sy/2, 50, 50, "someimg.png") -- And start reducing the number you want

 

  • Discord Moderators
Posted

That'll not work at all, it'll be at the same distance from the center of the screen for anyone(so anyone with a smaller screen than yours will not see it)
Instead, on X just type a coordinate (0, 100, etc..)

on Y do: SY- something.
DxSetAspectRatioAdjustmentEnabled

Posted

Step 1. Download guieditor script, make everything you need here, copy your code.

Step 2. Paste this before your dxDraw functions

local sx,sy = guiGetScreenSize()
local px,py = 1366,768 -- replace 1366, 768 with your resolution
local x,y =  (sx/px), (sy/py)

Step 3. For example you got this

dxDrawRectangle(200,400,100,500)

replace coordinates like this

dxDrawRectangle(x*200,y*400,x*100,y*500)

and that's it.

Easy, isn't it?

  • 2 years later...

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