pane size and screen resolution

Posted By: GameScore

pane size and screen resolution - 09/06/12 08:52

i understand how to stretch a bmap up to the actual screen size
if the bmap should have the screen size
like this
Code:
main_pan.scale_x = screen_size.x / bmap_width(main_tga);
 main_pan.scale_y = screen_size.y / bmap_height(main_tga);



but how can i adjust a panel with 600*600 ?

i mean the actual resolution is
1280*1024 and the bmap have 600*800
now i change the resolution and i want to adapt the bmap
Posted By: 3dgs_snake

Re: pane size and screen resolution - 09/06/12 09:16

Hi,

I don't understand what you want to achieve, but here a code you can try :

Code:
// Scale bmap
var sx = screen_size.x / bmap_width(main_tga);
var sy = screen_size.y / bmap_height(main_tga);
      
var scale = minv(sx, sy);
main_pan.scale_x = main_pan.scale_y = scale;
main_pan.pos_x = (screen_size.x - (bmap_width(main_tga) * scale)) * 0.5;


Best regards.
Posted By: GameScore

Re: pane size and screen resolution - 09/07/12 07:17

thanks for your answer,
but it not what i mean

i mean my actual screen resolution is 1280*1024
and i have in this solution a panel with 600*600
now i change the solution to 1024*768
and i want that the panel to adapt ( scale )
the panel
Posted By: 3dgs_snake

Re: pane size and screen resolution - 09/07/12 07:30

Hi,

I think you need to put the update in a while(1) and when last_resolution != current_resolution, you apply your changes.
© 2023 lite-C Forums