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
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,253 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
How to create double mouseClick and mouseClick Event for Game #405384
07/30/12 04:51
07/30/12 04:51
Joined: Dec 2009
Posts: 128
China
frankjiang Offline OP
Member
frankjiang  Offline OP
Member

Joined: Dec 2009
Posts: 128
China
How to create double mouseClick and mouseClick Event for Game?
is it possible to this thing?
any good guys have good idea for this topic?any one know?


development 3d game is interesting!
Re: How to create double mouseClick and mouseClick Event for Game [Re: frankjiang] #405387
07/30/12 08:32
07/30/12 08:32
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Code:
int nMouseClickedOnce = 0;
int nMouseClickedTwice = 0;

void mouseClick()
{
   int nWaitTime = 200;
   if (nMouseClickedOnce == 0)
   {
      nMouseClickedOnce = 1;
   }
   else
   {
      nMouseClickedTwice = 1;
   }
   while(nWaitTime > 0)
   {
      nWaitTime -=1;
      wait(1);
   }
   nMouseClickedOnce = 0;
   nMouseClickedTwice = 0;
}

void test()
{
   on_mouse_left = mouseClick;
   if (nMouseClickedTwice)
   {
      printf("Mouse clicked twice");
   }
}



Re: How to create double mouseClick and mouseClick Event for Game [Re: PadMalcom] #405399
07/30/12 10:52
07/30/12 10:52
Joined: Dec 2009
Posts: 128
China
frankjiang Offline OP
Member
frankjiang  Offline OP
Member

Joined: Dec 2009
Posts: 128
China
Thank you for your code, guys!


development 3d game is interesting!
Re: How to create double mouseClick and mouseClick Event for Game [Re: PadMalcom] #405400
07/30/12 10:59
07/30/12 10:59
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
or everything inside a loop

Code:
var nMouseLeft = 0;

while ( 1 )
{
	if ( mouse_left )
	{
		if ( !nMouseLeft )
		{
			nMouseLeft = MC_DOUBLECLICKTIME;
		}
		else if ( nMouseLeft < 0 )
		{
			nMouseLeft *= -1;
			
			printf ( "Double click" );
		}
	}
	else if ( nMouseLeft )
	{
		if ( nMouseLeft < 0 )
		{
			nMouseLeft = minv ( nMouseLeft + time_step, 0 );
			
			if ( !nMouseLeft )
			{
				printf ( "Simgle click" );
			}
		}
		else if ( nMouseLeft == MC_DOUBLECLICKTIME )
		{
			nMouseLeft *= -1;
		}
		else
		{
			nMouseLeft = 0;
		}
	}
	
	wait(1);
}



Salud!


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