heroes9898 Posted June 7, 2014 Share Posted June 7, 2014 Hi, my problem is, there is users using 800 * 600 resolution, and users using 1600 * 900 resolution. How should be the algorithm of this scaling? I solved the position problem, but scaling algorithm is too hard example: (I'm creating texts with a MTA using 1600 * 900 resolution) local width, height = guiGetScreenSize() scaleX = width/1600 scaleY = height/900 ... function renderText() dxDrawText("text", 487*scaleX, 244*scaleY, 682*scaleX, 261*scaleY, tocolor(255, 255, 255, 255), 1 * (???), "default") end ??? = ? Link to comment
xXMADEXx Posted June 7, 2014 Share Posted June 7, 2014 You can just sorta combine random algorithms, until you get it. Try using something like this: local width, height = guiGetScreenSize() scaleX = width/1600 scaleY = height/900 function renderText() dxDrawText("text", 487*scaleX, 244*scaleY, 682*scaleX, 261*scaleY, tocolor(255, 255, 255, 255), (scaleX+scaleY), "default") end Link to comment
heroes9898 Posted June 7, 2014 Author Share Posted June 7, 2014 ok. I'll try it. Looking so that it will work Link to comment
.:HyPeX:. Posted June 7, 2014 Share Posted June 7, 2014 You should just work over relative values. eg: --Original resolution made on 1360*768 local width,height = guiGetScreenSize() local Difference = 0.8 -- Reducing exponential difference throught scales ScaleWorkout = ( ( 1360 / width ) * ( 768 / height ) ) * Difference dxDrawText("text", width * 0.2, height * 0.5, width * 0.4, height * 0.6, tocolor(255,0,0,255), 2 / ScaleWorkout, "default") BTW: I'm still looking for an efficient text scaling, the exponential size going to 800x600 without the exponential reduction is a very small text, this should work perfectly, but it will be a bit too much. Link to comment
heroes9898 Posted June 7, 2014 Author Share Posted June 7, 2014 .:HyPeX:. the scale of the text on the screen is still not same Link to comment
Max+ Posted June 7, 2014 Share Posted June 7, 2014 Maybe this topic will help you ? https://forum.multitheftauto.com/viewtopic.php?f=91&t=33412 Link to comment
heroes9898 Posted June 7, 2014 Author Share Posted June 7, 2014 Thx. I tried that already. But the problem is, that the ratio of the resolutions are not same. 800/600 = 1.33.. 1600/900 = 1.77.. I pasted a little sticker on my monitor full bottom of the text. and changed the resolution of the game to 800*600 and sticker was no more under the text. Link to comment
Max+ Posted June 7, 2014 Share Posted June 7, 2014 well why dont you check for every screen like this , Example , height , width = guiGetScreenSize() scaleX = width scaleY = height if ( scaleX == 1600 and scaleY == 900 ) or ( scaleX == 800 and scaleY == 600 ) then --- do something Link to comment
.:HyPeX:. Posted June 7, 2014 Share Posted June 7, 2014 My code should work, it just needs some maths workout for the exponentials including widescreen values based on the difference width-height. BTW: You're doing something wrong by using the text position with text scaling, just use the relative values (e.g. width*0.2) for position. Then work out the maths for scale. 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