MAB Posted November 28, 2015 Share Posted November 28, 2015 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... Link to comment
ALw7sH Posted November 28, 2015 Share Posted November 28, 2015 You have to ways make your image bigger using photoshop or anyother programe or just don't change the size of your design and that's what I like to do so I just make with position fit with all resloutions Link to comment
Dealman Posted November 28, 2015 Share Posted November 28, 2015 So if you don't want it to be bigger than 50x50 pixels, then just put the size as 50 pixels wide and high. You could just add an if statement that checks if the resolution is bigger than 1280x768. If true, size of the image is 50x50 pixels. If false, follow your usual formula. Also you can create different images, of course. Some games usually have interface textures designed for multiple ratios like 4:3, 16:9 and so on. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now