I am trying to draw a mini-map onto the HUD, but I am unable to figure out how to calculate the size of minimap so that it fits within the HUD-elements.
Here is a picture to illustrate:View imageI want the height of the mini-map to be about 68 pixels, but the width doesn't matter that much.The size of the level can be just about anything.Can anyone help me out?
minimap_height = 68
ratio = minimap_height/room_heightminimap_width = ratio*room_widthAnd to draw onto the minimap:minimap_x = ratio*xminimap_y = ratio*yThis does not work. Am I doing it right?:
mSc = 68/hh;m_w = mSc*ww;m_h = 68;/////////mSc is ratiom_w is minimap widthm_h is minimap heightww and hh are room width and heightAnd the map is drawn by doing like so:x*mSc;That should be working. Check for nuances in how you're using views.
Another solution is to draw pixels to a surface and then scale that surface down.Nevermind, guys. I got help from Brod @ GMC.
GMC: 164: 0:pOuch.
I am very sure what juju said works, and that you implemented it incorrectly. So
Mordi: -1 =PI am curious what solution the gmc gave you.EDIT: I saw that the gmc gave the exact same solution! So 64d wins for providing it first. >:(I guess we're all losers, then! :C
I, for one, am not shamed.
Nor should you be.