Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (3run, AndrewAMD), 667 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: Toggle button functions [Re: Kartoffel] #411190
11/13/12 22:25
11/13/12 22:25
Joined: Mar 2003
Posts: 1,524
Canada
Stansmedia Offline OP
Serious User
Stansmedia  Offline OP
Serious User

Joined: Mar 2003
Posts: 1,524
Canada
Alright the & and * worked! Awesome! Heres the code... totally working laugh

Code:
#define ON 1
#define OFF 0

var notevisible = 0;
var patternvisible = 0;
var rootvisible = 0;
var notefacing = 0;



function togglevariable(var* index)
{
	if(*index)
	{
		*index = OFF;
	}
	else
	{
		*index = ON;
	}
}

void noteoptionlogic(var number,PANEL* panel)
{
	switch (number)
	{
		case 1: togglevariable(&notevisible);		break;
		case 2: togglevariable(&patternvisible);				break;
		case 3: togglevariable(&rootvisible);				break;
		case 4: togglevariable(&notefacing);	break;
		default: error("Error in note option panel");	break;
	}	
}

PANEL* noteoptions = 
{
	pos_y = 0;
	pos_y = 32;
	layer = 5;
	bmap = "notepanel.tga";
	button_toggle(128, 0, "checkon.tga", "checkoff.tga", "checkonover.tga", "checkoffover.tga", noteoptionlogic, NULL, NULL);
	button_toggle(128, 32, "checkon.tga", "checkoff.tga", "checkonover.tga", "checkoffover.tga", noteoptionlogic, NULL, NULL);
	button_toggle(128, 64, "checkon.tga", "checkoff.tga", "checkonover.tga", "checkoffover.tga", noteoptionlogic, NULL, NULL);
	button_toggle(128, 96, "checkon.tga", "checkoff.tga", "checkonover.tga", "checkoffover.tga", noteoptionlogic, NULL, NULL);
}



Decessus - 80% done. 100% abandoned.
GET MY ANDROID GAME! https://play.google.com/store/apps/details?id=com.lasertrain.zspinballfree&hl=en
Re: Toggle button functions [Re: Stansmedia] #411191
11/13/12 23:02
11/13/12 23:02
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
I'm glad you got it fixed. ON and OFF are by the way already defined in atypes.h. You don't need to redefine them.

@Kartoffel: The tutorial is far from being complete, but it's a good place to get your feet wet. I feel that the scope is even ok for a tutorial. Of cause it will never be able to replace a good book on c.


Always learn from history, to be sure you make the same mistakes again...
Page 3 of 3 1 2 3

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