Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Ayumi, kzhao, 7th_zorro), 739 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İ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 | chip programmers | 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