Gamestudio Links
Zorro Links
Newest Posts
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
2 registered members (TipmyPip, AndrewAMD), 1,151 guests, and 4 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
Page 1 of 5 1 2 3 4 5
Automatic resizing panels function #44440
04/15/05 04:12
04/15/05 04:12
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
Think of this as the bare minimum for what you'll ultimately need. This is an intentional thing, since most of us will need it for different reasons.

The scale_x and scale_y values will accurately scale up a fullscreen, 640x480 panel across the 5 most common resolutions. I don't recommend rescaling panels with burned in text, small details, or gradients. An example of what you can add to this would be pos_x/pos_y changes for strings, panels, etc when switching resolutions. Just place what you need in the appropriate if block and call the function when you switch resolutions.

You'd probably want to add some more ifs to handle specific needs or to only use certain blocks for certain actions, since there's no need to change every single element every time you call it. Adding a parameter to the function would help with this. Just pass the current panel to it and create an if for that panel. You'd need to define the panel name to make it easier to track(but that's optional). I used a panel pointer since this will make the function appear less cluttered/busy when it grows in size. The panel declaration is included for consistency.

This probably seems like a simple contribution, but think about a project with large amounts of text, panels, and multiple resolutions and it isn't so simple, anymore. I feel it's best to keep it all in a single function instead of spreading it around amongst various functions.

Code:

panel* pnl;
bmap bmap_name = <bmap_file.bmp>;

panel panel_name
{
bmap = bmap_name;
layer = 1;
pos_x = 0;
pos_y = 0;
flags = overlay;
}

function resize()
{
if(video_mode == 6) //640x480
{
pnl = panel_name; //assign panel names as you go
pnl.scale_x = 1;
pnl.scale_y = 1;
return;
}
if(video_mode == 7) //800x600
{
pnl = panel_name; //assign panel names as you go
pnl.scale_x = 1.25;
pnl.scale_y = 1.25;
return;
}
if(video_mode == 8) //1024x768
{
pnl = panel_name; //assign panel names as you go
pnl.scale_x = 1.6;
pnl.scale_y = 1.6;
return;
}
if(video_mode == 9) //1280x1024
{
pnl = panel_name; //assign panel names as you go
pnl.scale_x = 2;
pnl.scale_y = 2.134;
return;
}
if(video_mode == 11) //1600x1200
{
pnl = panel_name; //assign panel names as you go
pnl.scale_x = 2.5;
pnl.scale_y = 2.5;
return;
}
}




My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Automatic resizing panels function [Re: Orange Brat] #44441
04/15/05 06:34
04/15/05 06:34
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
Here's an example of where I'm headed with my own version. This is incomplete, unpolished, and represents only one video_mode. I've also added the "panel" parameter to it. It allows me to get more specific. The final version of this section will have all of the required "panel" sections and all of the correct values assigned to whatever else gets included:

Code:

define pause, 0; //defines for resize parameter
define loadmenu, 1;
define savemenu, 2;
define gameSavingScreen, 3;
define mainmenu, 4;
define credits, 5;
bmap mm_640 = <mm640.bmp>; //mainmenu master panels
bmap mm_800 = <mm800.bmp>;
bmap mm_1024 = <mm1024.bmp>;
bmap mm_1280 = <mm1280.bmp>;
bmap mm_1600 = <mm1600.bmp>;
bmap cred_640 = <cred640.bmp>; //credits panels
bmap cred_800 = <cred800.bmp>;
bmap cred_1024 = <cred1024.bmp>;
bmap cred_1280 = <cred1280.bmp>;
bmap cred_1600 = <cred1600.bmp>;
bmap blackpanel_pan = <blackpanel_pcx.bmp>; //background panel

if(video_mode == 7) //800x600
{
if(panel == pause)
{
pnl = blackpanel_pan;
pnl.scale_x = 1.25;
pnl.scale_y = 1.25;

//add specific here

return;
}
if(panel == loadmenu)
{
pnl = blackpanel_pan;
pnl.scale_x = 1.25;
pnl.scale_y = 1.25;

//add specific here

return;
}
if(panel == savemenu)
{
pnl = blackpanel_pan;
pnl.scale_x = 1.25;
pnl.scale_y = 1.25;

//add specific here

return;
}
if(panel == gameSavingScreen)
{
pnl = blackpanel_pan;
pnl.scale_x = 1.25;
pnl.scale_y = 1.25;

//add specific here

return;
}
if(panel == mainmenu)
{
pnl = mainmenu_pan;
pnl.bmap = mm_800;
return;
}
if(panel == credits)
{
pnl = creditsPnl;
pnl.bmap = cred_800;
return;
}
}




My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Automatic resizing panels function [Re: Orange Brat] #44442
04/15/05 16:33
04/15/05 16:33
Joined: Aug 2002
Posts: 673
Las Cruces, NM
JimFox Offline
User
JimFox  Offline
User

Joined: Aug 2002
Posts: 673
Las Cruces, NM
Hi Orange Brat,
I don't think it is at all simple. This is a complicated issue, and your contribution is very helpful. Thank you very much!
Regards,


Jim
Re: Automatic resizing panels function [Re: JimFox] #44443
05/11/05 00:05
05/11/05 00:05
Joined: Apr 2005
Posts: 134
MN, US
Jalen Offline
Member
Jalen  Offline
Member

Joined: Apr 2005
Posts: 134
MN, US
Ditto! Just what I was looking for! Seems so obvious and important that it should be in the manual!


A6 Pro v. 6.60 www.BloodClans.com
Re: Automatic resizing panels function [Re: Jalen] #44444
02/24/06 03:19
02/24/06 03:19

A
Anonymous
Unregistered
Anonymous
Unregistered
A



good job OrangeBrat,
another idea would be to relocate the panels according to the size change when you decrease to a small resolution (like 400x300) since they will not be in the right place otherwise (unless you're resizing it manually with the mouse instead of video_switch)

Re: Automatic resizing panels function [Re: ] #44445
02/24/06 04:03
02/24/06 04:03
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
I think I was approaching it in such a way that the left edge of the panels touched the left side of the screen. Using that placement, the scale factors work perfectly, however it may not work using a different placement.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Automatic resizing panels function [Re: Orange Brat] #44446
03/05/06 21:12
03/05/06 21:12
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline
Senior Member
kasimir  Offline
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
I have A6.10 - it does'not work (panel.scale_x /scale_y).
Which g-studio-version i need???

Re: Automatic resizing panels function [Re: kasimir] #44447
03/05/06 21:38
03/05/06 21:38
Joined: Sep 2005
Posts: 357
Florida
Hellcrypt Offline
Senior Member
Hellcrypt  Offline
Senior Member

Joined: Sep 2005
Posts: 357
Florida
This would take a whole lot of copying and pasting.
6.31 or 6.40

Last edited by Hellcrypt; 03/05/06 21:40.

I do not solve problems.... I prevent them.
Re: Automatic resizing panels function [Re: Hellcrypt] #44448
03/05/06 21:44
03/05/06 21:44
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline OP

Senior Expert
Orange Brat  Offline OP

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
Yeah, a game final version would be lengthy, but unless you are only going to use a single set of panels for every resolution(and commercial games do this...HL2 did), then it is a necessary thing.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Automatic resizing panels function [Re: Orange Brat] #44449
03/15/06 03:08
03/15/06 03:08
Joined: Jul 2005
Posts: 366
eleroux Offline
Senior Member
eleroux  Offline
Senior Member

Joined: Jul 2005
Posts: 366
just a comment - wouldn't it be better to reduce a bigger panel instead of increasing a small one? for detail, that is. I don't know if it would have an impact on performance.

Page 1 of 5 1 2 3 4 5

Moderated by  adoado, checkbutton, mk_1, Perro 

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