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
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 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
Panels in right scale and buttons in right positiion[SOLUTION] #341031
09/09/10 19:57
09/09/10 19:57
Joined: Sep 2009
Posts: 496
P
Progger Offline OP
Senior Member
Progger  Offline OP
Senior Member
P

Joined: Sep 2009
Posts: 496
Hi Community i wrote i think a useful but simple code
u remember u want to publish a game but u forgot that other people have another resoulution and u have to do 20 other bmaps
With this code u only need to create one bmap the code wll scale it for u right so that u can save much time
so here we go first as bacground u need to create a picture as big as your resolution is in my case 1440*900
press F5 to test it (:
now comes the code :

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////
var width;
var height;


PANEL* test=
{
	bmap="test.jpg";
	pos_x=0;
	pos_y=0;
	layer=1;
	flags=VISIBLE;
}

PANEL* testbutton=
{
   bmap="test2.jpg";
   //dont put any position here 
   layer=2;
   flags=VISIBLE;
}

function main()
{
	level_load("");
	while(1)
	{
		width=screen_size.x;
		height=screen_size.y;

		test.scale_x=1/(1440/width);//here there where 1440 stands there must be your screen_size.x
		test.scale_y=1/(900/height);//here there where 900 stands must be your screen_size.y
      
      testbutton.scale_x=1/(1440/width);//here there where 1440 there must be your screen_size.x
		testbutton.scale_y=1/(900/height);////here there where 900 there must be your screen_size.x
      
      testbutton.pos_x = 520/(1440/width);//so here put the position.x of the panel and the button button in relation to your screen_size in my case its near the middle 
       
testbutton.pos_y = 250/(900/height);//so here put the position.y of the panel and the button button in relation to your screen_size in my case its near the middle 
      
      
		wait(1);
	}
}



and here is an example
http://www.filefront.com/17277237/test.zip
WFG Progger laugh


Last edited by Progger; 09/09/10 20:48.

asking is the best Way to get help laugh laugh laugh
Re: Panels in right scale and buttons in right positiion[SOLUTION] [Re: Progger] #349956
12/12/10 19:23
12/12/10 19:23
Joined: Nov 2010
Posts: 125
Germany
chrisp1 Offline
Member
chrisp1  Offline
Member

Joined: Nov 2010
Posts: 125
Germany
nice laugh


---------------------------------------------------
My new project: www.sfc.de.to
My old project: www.littlesubmarine.de.to
My Youtubechannel: http://www.youtube.com/user/darkchrisp#p/a/u/0/5idMXmCDdmA
---------------------------------------------------
Re: Panels in right scale and buttons in right positiion[SOLUTION] [Re: chrisp1] #349967
12/12/10 20:23
12/12/10 20:23
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Hey,

I have to mention, that you code is not really effective - you could put the while in main into an event - the on_resize event (of course without the while).

Just a tip - but thanks for the contribution - now not so many people will hopefully ask for it laugh


Moderated by  HeelX, Tobias_Runde 

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