Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
0 registered members (), 806 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
[Solved]start screen bmap resizeable? #347621
11/17/10 03:52
11/17/10 03:52
Joined: Nov 2008
Posts: 43
Ice2642 Offline OP
Newbie
Ice2642  Offline OP
Newbie

Joined: Nov 2008
Posts: 43
Hello,

I would like to know if it is possible resize a bmap to be used in the start screen to it change to the same size of the screen resolution ?

for example, I have a start screen bmap with 1600x900. if the user set the resolution of the game for 640x480. I want the bmap to be resized to 640x480 too. or any othe size set up in the game preferences by the user.

how can I do this, or if it is not possible, how change the bmap to the game can fit all possibles screen resolution seted by the user to run the game with a right size bmap start screen ?

Thank you in advance.

BR

Last edited by Ice2642; 11/17/10 20:33.

A8 PRO 8.47.1
Re: start screen bmap resizeable? [Re: Ice2642] #347626
11/17/10 08:23
11/17/10 08:23
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Firstly, welcome aboard...

To similate a re-sizable bmap you are best off, in my opinion, to use a panel.

First, define yourself a "splash screen" using a panel, and assign your bmap to it.
DONT assign the panel an x_size or y_size, and it will inherit the size of the bmap.
Then whenever the screen resolution is changed, or when making the panel visible,
you need to recalculate the panels scale_x and scale_y values according to the required result...

EG : (assumes panel is named 'splash')
splash.pos_x = splash.pos_y = 0;
splash.scale_x = screen_size.x / splash.bmap.width;
splash.scale_y = screen_size.y / splash.bmap.height;


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: start screen bmap resizeable? [Re: EvilSOB] #347631
11/17/10 10:12
11/17/10 10:12
Joined: Nov 2008
Posts: 43
Ice2642 Offline OP
Newbie
Ice2642  Offline OP
Newbie

Joined: Nov 2008
Posts: 43
Thank you for the wellcome and answer.

I will try it, and apears it will work.

good idea laugh

thank you.

BR


A8 PRO 8.47.1
Re: start screen bmap resizeable? [Re: Ice2642] #347668
11/17/10 19:00
11/17/10 19:00
Joined: Nov 2008
Posts: 43
Ice2642 Offline OP
Newbie
Ice2642  Offline OP
Newbie

Joined: Nov 2008
Posts: 43
Thank you very much.

I made a function splash_startup to control the splash size

Code:
function painel_startup()
{
	while(1)
	{
	splash.pos_x = splash.pos_y = 0;
	splash.scale_x = screen_size.x / splash.bmap.width;
	splash.scale_y = screen_size.y / splash.bmap.height;
	wait(1);
	}
}



Work 100%





Uploaded with ImageShack.us

Best Regards,


A8 PRO 8.47.1
Re: start screen bmap resizeable? [Re: Ice2642] #347670
11/17/10 19:10
11/17/10 19:10
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Good stuff. Well done. And Im glad to help...

One suggestion though, to avoid 'wasting' horsepower with un-necessary tasks,
I would change your code to this...
Code:
function painel_startup()
{
	while(1)
	{
		if(is(splash, SHOW))
		{
			splash.pos_x = splash.pos_y = 0;
			splash.scale_x = screen_size.x / splash.bmap.width;
			splash.scale_y = screen_size.y / splash.bmap.height;
		}
		wait(1);
	}
}

That way it only actively re-sizes the splash if its actually visible...

There are other optimizations you could do, but this will get rid of the worst of it...


[DEIT] Do I see a hand-icon ripped from Dungeon Keeper in the screen-shots?
Or is it just a good copy...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: start screen bmap resizeable? [Re: EvilSOB] #347674
11/17/10 19:27
11/17/10 19:27
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
If you really don't want to waste horsepower, then update the scales only when you change the resolution, instead of putting an other function on the scheduler.

And I'm not so sure if that "if(is(splash, SHOW))" makes it better anyway. It's just about setting four values, with only two "div" operations, while if(is(splash, SHOW)) uses memory on the stack and code jumps.

Re: start screen bmap resizeable? [Re: Lukas] #347675
11/17/10 19:42
11/17/10 19:42
Joined: Nov 2008
Posts: 43
Ice2642 Offline OP
Newbie
Ice2642  Offline OP
Newbie

Joined: Nov 2008
Posts: 43
Ok,

I made a var KlX = 9; in the code start.

I change the function to;

Code:
function painel_startup()
{
	while(KlX==9)
	{
	splash.pos_x = splash.pos_y = 0;
	splash.scale_x = screen_size.x / splash.bmap.width;
	splash.scale_y = screen_size.y / splash.bmap.height;
	wait(1);
	}
}



In this way, just until KlX is = 9 the while will work. When the game start the KlX change to 0, no more needed the scale of intro panel.

This is a good solution ?

Thank you for the help.

BR


A8 PRO 8.47.1
Re: start screen bmap resizeable? [Re: Ice2642] #347678
11/17/10 19:58
11/17/10 19:58
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
Er, no, that's also a rather inelegant solution. Just put the code right after the spot where you change the resolution. You don't need an other function.

(And btw, if you don't want to return something, better use "void" instead of "function"...)

Re: start screen bmap resizeable? [Re: Lukas] #347680
11/17/10 20:06
11/17/10 20:06
Joined: Nov 2008
Posts: 43
Ice2642 Offline OP
Newbie
Ice2642  Offline OP
Newbie

Joined: Nov 2008
Posts: 43
Ok,

Thank you for the help.

I will get a look in the VOID solution, but, maybe the resize is needed if the player change thesettings in-game and return to start screen.

edit**

I change to;

Code:
void painel_startup()
{
	while(1)
	{
	splash.pos_x = splash.pos_y = 0;
	splash.scale_x = screen_size.x / splash.bmap.width;
	splash.scale_y = screen_size.y / splash.bmap.height;
	wait(5);
	}
}



Using the void now instead the function and chang the wait to 5 to get less resourses.

This is ok now ?

Thank you for the help. laugh

BR


Last edited by Ice2642; 11/17/10 20:12.

A8 PRO 8.47.1
Re: start screen bmap resizeable? [Re: Ice2642] #347681
11/17/10 20:12
11/17/10 20:12
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
In this case, just call this code each time the resolution is changed. For that purpose it is useful to put it into a functiona again (but without a loop!).

If you want to change the resolution with the F5 from default.c, you can use the loop you posted above for that, but remove it when you publish your game.

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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