Jump to content

Scaling problems with the dxDrawText

Dzsozi (h03)

Recommended Posts

Hello everyone!

Today I started to work with Vandam98 and StiviK's resource, the GTA V radar that they've uploaded to the community. I want to make it better and more look like the GTA V radar. Anyway, I never could make dxDrawTexts, it's always a problem for me, I can't make it to the same size on every resolutions. So my current problem is can be seen on the pictures. I've played with the game and edited this script on 1920x1080 resolution (usually I use this res.), after I "finished" it I tried on 800x600 and boom, problem is appeared.

1920x1080 | Perfect, it should be look like this on every resolution (I mean the dxText).


800x600 | As you can see the text is too big, not the same as on the previous picture, but why?


Here's the line of the dxDrawText and the guiGetScreenSize things:

sWidth, sHeight = guiGetScreenSize() 
Auflosung_x = 1920 
Auflosung_y = 1080 
px = sWidth/Auflosung_x 
py = sHeight/Auflosung_y 
dxDrawText ( string.format("%.0f",distance) .. " m", 35*px, 227.5*py, 355*px, 227.5*py, tocolor ( 255, 255, 255, 255 ), 1.15, "default-bold", "right", "bottom" ) 

I would appreciate if someone could explain it for me, how does dxDrawText scalings work for all resolution, and things like that. I hope that someone could help.

P.S.: Sorry for my English if there was something written wrong or if you don't understand it, I'm from Hungary.

P.S. 2: I'm really excited about working with Vandam98 and/or StiviK, or fixing things about this resource and make it better, add missing things and more!

Thank you!

Link to comment

Are those relative sizes? I think you haven't posted the full script. O_o

Anyway check this out: viewtopic.php?f=91&t=82677&p=753736#p753736

This is how you do it.

local Auflosung_x , Auflosung_y  = guiGetScreenSize() 
local fontSize = 1.15/1920*Auflosung_x  
dxDrawText ( string.format("%.0f",distance) .. " m", Auflosung_x*0.4 , Auflosung_y*0.3 , Auflosung_x*0.2,  Auflosung_y*0.3 , tocolor ( 255, 255, 255, 255 ), fontSize, "default-bold", "right", "bottom" ) 

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