|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: [panel] center panel while scaling?
[Re: darkinferno]
#298168
11/12/09 17:05
11/12/09 17:05
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
User
|
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! I think it's
// place panel in the center of the screen
function center_panel(PANEL* panel)
{
panel.pos_x = (screen_size.x - bmap_width(panel.bmap))/2;
panel.pos_y = (screen_size.y - bmap_height(panel.bmap))/2;
}
use after the scaling
Hope this helps! Ottawa  Ver 7.86.2 Pro and Lite-C
|
|
|
Re: [panel] center panel while scaling?
[Re: darkinferno]
#298178
11/12/09 18:34
11/12/09 18:34
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
dont know if it works but you can try it
panel.pos_x = (screen_size.x - bmap_width(panel.bmap)*panel.scale_x)/2
Last edited by flits; 11/12/09 18:35.
"empty"
|
|
|
Re: [panel] center panel while scaling?
[Re: darkinferno]
#298179
11/12/09 18:34
11/12/09 18:34
|
Joined: Oct 2007
Posts: 5,209 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
|
you should use panel scale and bitmap_widtth/height together in order to achieve this. Only panel's scale changes, bitmaps width and height is dependant on file, and always remains same even if you scale the panel. ill try somethings and see if it works.
edit:flits was faster.
Last edited by Quadraxas; 11/12/09 18:34.
3333333333
|
|
|
Re: [panel] center panel while scaling?
[Re: Quad]
#298180
11/12/09 18:41
11/12/09 18:41
|
Joined: Oct 2007
Posts: 5,209 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
|
#include <acknex.h>
BMAP* pmap = "map.bmp";
PANEL* test_panel = {
bmap = pmap;
flags = SHOW;
}
void main(){
while(1){
test_panel.scale_x += time_step*(key_d-key_a);
test_panel.scale_y += time_step*(key_w-key_s);
test_panel.scale_x = clamp(test_panel.scale_x,0.1,10);
test_panel.scale_y = clamp(test_panel.scale_y,0.1,10);
test_panel.pos_x = screen_size.x/2-(bmap_width(test_panel.bmap)*test_panel.scale_x/2);
test_panel.pos_y = screen_size.y/2-(bmap_height(test_panel.bmap)*test_panel.scale_y/2);
wait(1);
}
}
use a random bmap and run.
3333333333
|
|
|
|