HUD - Scaling with percentages %

Blitz3D Forums/Blitz3D Beginners Area/HUD - Scaling with percentages %

Imperium(Posted 2013) [#1]
When I launch my game in a higher resolution the HUD stays the fixed aspect ratio. How can I setup the HUD image to scale accordingly using percentages? I'm not using any Libraries yet so I'm making use of the DrawImage command. Is this bad to use this in a 3d graphics mode?

I found a thread here which went over this but I lost the link.


GfK(Posted 2013) [#2]
It's bad, for exactly this reason.

You probably want something like NSprite2, which basically lets you use 2D-looking sprites, in 3D. You can do that in BB3D anyway, but NSprite2 takes the pain out of it.


Imperium(Posted 2013) [#3]
Yeah I got Nsprite2. I will use those functions instead.


Yasha(Posted 2013) [#4]
Do note that aspect ratio and resolution are different things. When you go from 4:3 to 16:10, you want the stuff in the bottom left to stay in the bottom left rather than he halfway across the screen, and you also want it to not be stretched; this is correcting for aspect ratio. Correcting for resolution is making them stay the same onscreen size.

Both are easy to do with a spriting system, but as long as your HUD is composed of separate elements you can actually adjust for aspect ratio quite easily using 2D mode too just by using relative positioning (e.g. draw at XSize - rightN rather than an absolute leftward number). Of course you will see much better results with a sprite system anyway (much better performance for a start).

For dealing with scaling, you should look up the term "virtual resolution". As long as your base graphics are detailed enough, or vectorised, the 2D engine can be made to do all the work for you without any code modification.


Imperium(Posted 2013) [#5]
.