Resizing panels problem

Posted By: CyberGhost

Resizing panels problem - 08/19/15 00:37

These panels are intended to cover the whole screen/engine window. The resolution of the screen can be changed in the settings, so, I put these two lines for every panel of this kind in a while loop:-

Code:
panel.size_x = screen_size.x;
panel.size_y = screen_size.y;



But the panel is not resized and it keeps its original size ...
Posted By: Denn15

Re: Resizing panels problem - 08/19/15 10:02

as far as i know, to resize panels you should set its scale_x and scale_y

for your purpose this should work
Code:
panel.scale_x = screen_size.x / panel.size_x; 
panel.scale_y = screen_size.y / panel.size_y;



im not entirely sure if the size_x and size_y components change value after the panel is scaled, but if it is, then, if your panel is 64 by 64 pixels, just do it like this instead

Code:
panel.scale_x = screen_size.x / 64; 
panel.scale_y = screen_size.y / 64;

Posted By: Reconnoiter

Re: Resizing panels problem - 08/19/15 12:46

Use size_x/size_y if you want your panel bmap to be tiled over the screen or part of the screen. This keeps buttons at the same size. This is usefull for example for a fullscreen inventory screen or other fullscreen menus. Or for some 2d games that use mostly panels.

Use scale_x/scale_y if you want to resize your panel. It scales the bmap, size and buttons etc. This is for example usefull for loading screens or other panels with only a bmap/image.
Posted By: Kartoffel

Re: Resizing panels problem - 08/19/15 12:58

note that you can only use the tiling that Reconnoiter mentioned if the texture size is a power of two.

Also I recommend to apply the FILTER-flag to the panel which enables linear interpolation and prevents the pixelated look of unfiltered texture scaling.
Posted By: CyberGhost

Re: Resizing panels problem - 08/19/15 13:56

Ok, I used scale_x/y and FILTER flag like Kartoffel said and it worked ,but there is some line on the right side/bottom of the screen that the panel doesn't cover, is this normal? I have to decrease one or two pixels from the size of the panel when I use the 2 instructions for resizing (f.i. if the size of the image file is 1000x500 ,I have to change it in the script to be 998x498) and it works ,but should I do this every time or there is a permanent solution?
© 2024 lite-C Forums