Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Centering content on-screen? #251833
02/15/09 09:47
02/15/09 09:47
Joined: May 2008
Posts: 121
O
ortucis Offline OP
Member
ortucis  Offline OP
Member
O

Joined: May 2008
Posts: 121
I have created a simple menu with background image and buttons showing over it (video_mode = 8). Now instead of manually entering x/y values to place these buttons, is there any way to position them at the centre of the background image (1024x768) no matter what the actual game resolution be?

Or maybe, is there a way to just centre them all everytime the resolution is changed instead of setting up new values for x/y everytime?

Thanks.


Click to reveal.. (warning)
Re: Centering content on-screen? [Re: ortucis] #251842
02/15/09 10:18
02/15/09 10:18
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
write a function, and call it everytime you change the resolution.

like


void vCenterPanels(){
panelname.pos_x = screen_size.x/2 - bmap_width(panelname.bmap)/2;
panelname.pos_y = screen_size.y/2 - bmap_height(panelname.bmap/2;
..
}

or something like

void vCenterMe(PANEL* p){
p.pos_x = screen_size.x/2 - bmap_width(p.bmap)/2;
p.pos_y = screen_size.y/2 - bmap_height(p.bmap/2;
}


3333333333
Re: Centering content on-screen? [Re: Quad] #252097
02/16/09 14:14
02/16/09 14:14
Joined: May 2008
Posts: 121
O
ortucis Offline OP
Member
ortucis  Offline OP
Member
O

Joined: May 2008
Posts: 121
Late (very late) reply from me but this only centers the panel image (as far as I can tell). I still can't seem to find a way for the buttons in the panel to center (horizontally.. even vertically if I can) on-screen without entering manual positions for x/y.

Thanks for solving the res problem though (I also found it in the manual.. :| ).


Click to reveal.. (warning)
Re: Centering content on-screen? [Re: ortucis] #252127
02/16/09 17:56
02/16/09 17:56
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
you coud use somthing white this pan_setpos(PANEL*, var type, var num, VECTOR* xy)


"empty"

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1