heroes9898 Posted June 7, 2014 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 ??? = ? Don´t let your fears stand in the way of your dreams!
xXMADEXx Posted June 7, 2014 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 The Ultimate Lua Tutorial! | MTA PHP SDK
heroes9898 Posted June 7, 2014 Author Posted June 7, 2014 ok. I'll try it. Looking so that it will work Don´t let your fears stand in the way of your dreams!
.:HyPeX:. Posted June 7, 2014 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. My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
heroes9898 Posted June 7, 2014 Author Posted June 7, 2014 .:HyPeX:. the scale of the text on the screen is still not same Don´t let your fears stand in the way of your dreams!
Max+ Posted June 7, 2014 Posted June 7, 2014 Maybe this topic will help you ? https://forum.multitheftauto.com/viewtopic.php?f=91&t=33412 - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
heroes9898 Posted June 7, 2014 Author 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. Don´t let your fears stand in the way of your dreams!
Max+ Posted June 7, 2014 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 - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
.:HyPeX:. Posted June 7, 2014 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. My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
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