Go to Post Has FIRST ever made a game that was easy to do? - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 14-01-2014, 12:28
Sparkyshires Sparkyshires is offline
Registered User
AKA: Michael Shires
FRC #0384 (Sparky)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2006
Location: Virginia
Posts: 226
Sparkyshires is an unknown quantity at this point
TOGGLE code not working

Hey guys! I know it's kinda early in the season for code issues, but I've got a question about toggle code. How come this:

Code:
bool Toggle, Button2Value;
Button2Value = false;
Toggle = false;
if(stick1.GetRawButton(2))
{
	if(Button2Value == false)
	{
		Button2Value = true;
		Toggle = !Toggle;
	}
}
else
{
	Button2Value = false;
}
would not change the value of Toggle afterwards? the idea is that button 2 can be pressed for an unlimited amount of time, then let go and the value of Toggle would be switched, until it was pressed again for an undefined amount of time. However, whenever I run it the Toggle variable never seems to change value. If the rest of the code is required, just ask and I'll post it.
__________________
"Measure with a micrometer, mark with chalk, cut with an axe."

Last edited by Sparkyshires : 14-01-2014 at 12:43.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:05.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi