View Single Post
  #2   Spotlight this post!  
Unread 08-02-2009, 19:01
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: New class for Logitech Dual Action Gamepad

Quote:
Originally Posted by Phazonmutant View Post
Regarding the actual class:
The D-pad is made from a standard x and a y axis (as you know), but each only return either 1 or -1. The if statements (ex: x < -0.5) would more simply be written like if(x = -1).
I think Mike did that intentionally because the values that are being used are floats. Because of this, you shouldn't perform equality checks on them, but rather check a range. This page provides a good explanation on why this is the case. While the equality works most of the time, using .5 as the comparison point works all the time.
Reply With Quote