PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
PJoystick.h
Go to the documentation of this file.
1//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
3// Name: src/devices/PJoystick.h
4// Purpose: Class for handling Abstract Joysticks
5// Author: Shane T. Mueller, Ph.D.
6// Copyright: (c) 2011 Shane T. Mueller <smueller@obereed.net>
7// License: GPL 2
8//
9//
10//
11// This file is part of the PEBL project.
12//
13// PEBL is free software; you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation; either version 2 of the License, or
16// (at your option) any later version.
17//
18// PEBL is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with PEBL; if not, write to the Free Software
25// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27#ifndef __PJOYSTICK_H__
28#define __PJOYSTICK_H__
29
30#include "PDevice.h"
31#include "../base/PEBLObject.h"
32#include <fstream>
33#include <string>
34
35
36//This is an abstract joystick class, and holds information that should be present for any
37//joystick implementation. It must be subclassed with a PlatformJoystick
38
39
40class PJoystick: public PDevice, virtual public PEBLObjectBase
41{
42
43public:
44
45
47 PJoystick();
48
50 virtual ~PJoystick();
51
52 int GetNumHats(){return mNumHats;};
53 int GetNumBalls(){return mNumBalls;};
54 int GetNumAxes(){return mNumAxes;};
55 int GetNumButtons(){return mNumButtons;};
56
57 virtual signed int GetHatState(unsigned int hat)=0;
58 virtual Variant GetBallState(unsigned int ball)=0;
59 virtual signed int GetAxisState(unsigned int axis)=0;
60 virtual signed int GetButtonState(unsigned int button)=0;
61
62
63protected:
64
65 //Inheritable printing Method.
66 virtual std::ostream& SendToStream(std::ostream& out)const;
67
73
74 bool mIsOpen;
75
76private:
77
78
79};
80
81
82
83#endif
virtual signed int GetAxisState(unsigned int axis)=0
virtual Variant GetBallState(unsigned int ball)=0
virtual signed int GetButtonState(unsigned int button)=0
virtual std::ostream & SendToStream(std::ostream &out) const
Definition PJoystick.cpp:48
Variant mName
Definition PJoystick.h:68
int mNumButtons
Definition PJoystick.h:72
int mNumHats
Definition PJoystick.h:69
bool mIsOpen
Definition PJoystick.h:74
int mNumAxes
Definition PJoystick.h:71
int GetNumButtons()
Definition PJoystick.h:55
int GetNumHats()
Definition PJoystick.h:52
int GetNumBalls()
Definition PJoystick.h:53
virtual ~PJoystick()
The Standard destructor.
Definition PJoystick.cpp:43
virtual signed int GetHatState(unsigned int hat)=0
int mNumBalls
Definition PJoystick.h:70
PJoystick()
The Standard constructor.
Definition PJoystick.cpp:37
int GetNumAxes()
Definition PJoystick.h:54