How do you scale images for different resolutions?
BlitzMax Forums/BlitzMax Programming/How do you scale images for different resolutions?
| ||
I am playing around with in game gui. Going up and down in resolutions was making managing gui slightly tricky. I was wondering what you guys did to scale the images nicely with resolutions changes.Local LoadingWindow:TImage = LoadImage("Media/Images/GUI/WindowBracketSheetTwoBoards.png") Local WindowWidth:Float = Float(GraphicsWidth()/4) Local WindowHeight:Float = ImageHeight(LoadingWindow)*((Float(GraphicsWidth()/4))/(ImageWidth(LoadingWindow))) Local LoadingWindowBuffered:TImage = CreateImage(WindowWidth,WindowHeight,1,DYNAMICIMAGE|MASKEDIMAGE) For the image width, I divided the window width by 4 (because I wanted the image to take up about a fourth). and then I kept the image aspect ratio the same by multiplying its height with the same change that the width had to make. I'm hoping someone could show me a better way maybe using SetScale or something because another issue I was having was drawing text over the images at the right size font and SetScale would directly effect DrawText. Any help would be greatly appreciated! |
| ||
Stumbled across this from user Jur In my project I use 3 fixed game area sizes to cover major monitor ratios - 4:3, 5:4 and 16:10. Then I use projection matrix to scale these game sizes to particular resolution. That means I need 3 variants of full screen graphics (title screen and such) Does that sound about right as far as whats best for me to do? |
| ||
Not sure if this is what you mean, but might be of use... http://www.blitzbasic.com/codearcs/codearcs.php?code=2879 |