I was wondering, how do you make an image fit all screens?! like HUDs, i do fit texts, rectangles and lines like that.
local sx,sy = guiGetScreenSize() -- to be used later to fit the drawing elements with all screen resolutions
local x,y = 1280/sx,768/sy -- my screen resolution is 1280x768x32 .. this is a shortcut of guiGetScreenSize function example
function draw ()
dxDrawLine(x*1093,y*134,x*1093,y*149,tocolor(0,0,0,255),x*3,false)
dxDrawRectangle(x*1094,y*115,x*(121),y*14,tocolor(150,150,0,200),false)
dxDrawText("hi",x*1005,y*157,x*1221,y*197,tocolor(0, 0, 0, 255),x*1.1, "bankgothic", "left", "top", false, false, false, false, false)
end
addEventHandler("onClientRender",root,draw)
So this fits the positions and widths and heights and scales etc.. it makes it small when the screen resolution is small and big with the big screen resolution...
now for an image.. lets say i have a 50x50 .jpg file now if the screen resolution of the player is bigger than the one i made the resource in, the width and height will be more than 50 because i am going to do this in the height and width arguments
"x*50,y*50" so it is bigger than 50 when the player's screen resolution is bigger than mine... making a image smaller doesn't effect the way it looks but when putting it in bigger widths and height than it is, it is going to look like if it is zoomed and bad
so my question is about how to make my image fit bigger resolutions than mine like texts and rectangles etc...