Go to Post In theory, there is no difference between theory and practice. In practice, however... - Alan Anderson [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 Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 23-02-2015, 14:34
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Properly calling a Logitech Attack 3 Joystick Class

Quote:
Originally Posted by Travis Hoffman View Post
I don't believe you can re-map the default value of the throttle, which is set to axis 3 (0-based values). You can define the number of axes and buttons, but not which axis is which.
The documentation for the Joystick::SetAxisChannel() method suggests otherwise.

Quote:
Last I "wrote" a custom class, I took gyro.cpp/.h source, renamed the files gyro48.cpp/.h, and changed the code to permit adjustment of the sensitivity parameter, which was previously not exposed to the end user.
If you were adding an interface to a private attribute of the class, then the way you did it was probably necessary. But was there ever a version of the Gyro class that didn't have the SetSensitivity() method?

Quote:
Seemed easier and more likely to work to adapt existing code than figure out all the BS of inheritance and writing my own classes and worrying about missing some inane piece of required syntax that would break the code or worse, compile it and cause unintended results I am not equipped to debug. If this somehow violates some code of appropriateness seasoned programmers adhere to, well, I'm not a seasoned programmer, nor do I aspire to be, so I guess it doesn't matter.
Since you seem to think subclassing by way of inheritance is complicated, I suspect you don't know what it means. It is not complicated. It should be as easy as
Code:
public class Axis_3 extends Joystick {
  float Axis_3::GetThrottle()
  {
	return GetRawAxis(2);
  }
}
That's kind of crude, but it should be effective. Note that I don't use C++ enough to be confident that I've done it correctly. Perhaps someone else with more experience and expertise can chime in and either confirm or correct my code.

Quote:
In the case of the joystick class, I'd simply change the default throttle axis from 3 to 2. Bing bang zoom. But with GetZ or GetRawAxis in the default class, I don't need to do that, so I won't even bother.
With the existence of SetAxisChannel(), I think you can indeed change the throttle axis of any Joystick object from 3 to 2 without even creating a new class.
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 14:50.

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