1// 2// StickIt 3// File: JoystickWindow.h 4// Joystick window definitions. 5// Sampel code used in "Getting a Grip on BJoystick" by Eric Shepherd 6// 7 8#include <Window.h> 9#include <View.h> 10 11class BJoystick; 12 13class JoystickView : public BView { 14 public: 15 JoystickView(BRect bounds, BJoystick *stick); 16 virtual ~JoystickView(); 17 virtual void Draw(BRect updateRect); 18 virtual void Pulse(void); 19 20 private: 21 BRect _BuildButtons(BJoystick *stick); 22 BRect _BuildHats(BJoystick *stick, BRect rect); 23 void _BuildAxes(BJoystick *stick, BRect rect); 24 BRect _BuildString(BString name, const char* strName, 25 int number, BRect rect); 26 27 BJoystick *fStick; 28 BRect fLastHatRect; 29}; 30 31class JoystickWindow : public BWindow { 32 public: 33 JoystickWindow(const char *deviceName, 34 BJoystick *stick, BRect rect); 35 virtual bool QuitRequested(void); 36 37 private: 38 JoystickView *fView; 39}; 40