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
rotating a panel with different scale #294639
10/20/09 11:37
10/20/09 11:37
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline OP
Member

Joined: Apr 2009
Posts: 248
Philippines
Hello All,

I modify the function pan_rotate from the manual and add another parameter which is equal to number of rotations.. I just want to have an effect at the center of the screen and where the panels is rotating from small scale until it reaches to it's original scale..

My problem is since pos_x and pos_y of the panel is at the upper left corner I got a rotating panel effect that comes from the left side then to the center..

Is there a way that I can get an effect of a rotating panel at the center regardless of its scale??

Here's my function..
Code:
//----------------------------------------------------------------------
// ROTATES A PANEL
//----------------------------------------------------------------------
void pan_rotate(PANEL* panel, var num_rotate)
{
  set(panel, SHOW);
  panel.center_x = panel.size_x * 0.5; 
  panel.center_y = panel.size_y * 0.5;
  while (num_rotate > 0)          
  { 
  		panel.scale_x = 1/(maxv(1, num_rotate));
  		panel.scale_y = panel.scale_x;
  		panel.angle += (50*time_step) + (num_rotate*5);
  		if (panel.angle >= 360)
  		{
  			num_rotate--;
  			panel.angle = 0;	
		} 
  		wait(1);
  }	
  
  panel.angle = 0; 
}



the output of this function is rotating the panel from small scale until it reaches its original scale..

before calling the above function I set the panel on the center of the screen..

Any idea how??



Can't is not an option™
Re: rotating a panel with different scale [Re: seecah] #294651
10/20/09 12:33
10/20/09 12:33
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline OP
Member

Joined: Apr 2009
Posts: 248
Philippines
Maybe you don't understand my question but I got it..

Just adding these 2 lines after scaling the panel..

Quote:

panel.pos_x = 177 + ((bmap_width(panel.bmap)/2) - ((bmap_width(panel.bmap)/2)*panel.scale_x));
panel.pos_y = 324.5 + ((bmap_height(panel.bmap)/2) - ((bmap_height(panel.bmap)/2)*panel.scale_y));


where 177 is the original x position
324.5 is the original y position
of the panel at normal scale



Can't is not an option™
Re: rotating a panel with different scale [Re: seecah] #294664
10/20/09 13:56
10/20/09 13:56
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

Is this what your looking for

Quote:

center_x
center_y
Rotation center of the panel in pixels, relative to its pos_x / pos_y coordinates. The center is scaled with the panel.



Hope this helps!
Ottawa laugh

Ver 7.86.2 Pro and Lite-C

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

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