Jump to content

Screen resolution for Dx


bradio10

Recommended Posts

How to make it :

place the window where you want. Like 400,300 on 1152x864 resolution. After that make the math using calculator.

X = 400/1152

Y = 300/864

Then in dxDraw you put. dxDrawImage(ScreenW*X,ScreenH*Y,.......) this will be at the same place on every resolution.

I hope you get it.

Link to comment

Well, here is an example for center screen:

local sx, sy = guiGetScreenSize ( ) 
local width = 400 
local height = 200 
local x = ( sx / 2 - width / 2 ) 
local y = ( sy / 2 - height / 2 ) 
addEventHandler ( "onClientRender", root, function ( ) 
    dxDrawRectangle ( x, y, width, height ) 
end ) 
  

Its just basic math.

Link to comment
How to make it :

place the window where you want. Like 400,300 on 1152x864 resolution. After that make the math using calculator.

X = 400/1152

Y = 300/864

Then in dxDraw you put. dxDrawImage(ScreenW*X,ScreenH*Y,.......) this will be at the same place on every resolution.

I hope you get it.

So, like this?

screenW, screenH = guiGetScreenSize () 
  
function draw() 
x = 400/1024 
y = 300/768 
dxDrawRectangle ( screenW*x, screenH*y, screenW*x, screenH*y, 255, 255, 255, 255, true) 
end 
addEventHandler ("onClientRender", root, draw) 

Link to comment

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