putil: add id and pressure fields to PointerData

This commit is contained in:
rdb 2018-11-25 23:38:07 +01:00
parent 26fcf131c9
commit 37d2ff64de
2 changed files with 34 additions and 39 deletions

View File

@ -11,37 +11,6 @@
* @date 2002-07-15
*/
/**
*
*/
INLINE PointerData::
PointerData() {
_in_window = false;
_xpos = 0;
_ypos = 0;
}
/**
*
*/
INLINE PointerData::
PointerData(const PointerData &copy) :
_in_window(copy._in_window),
_xpos(copy._xpos),
_ypos(copy._ypos)
{
}
/**
*
*/
INLINE void PointerData::
operator = (const PointerData &copy) {
_in_window = copy._in_window;
_xpos = copy._xpos;
_ypos = copy._ypos;
}
/**
*
*/
@ -59,13 +28,34 @@ get_y() const {
}
/**
*
* If this returns false, the pointer is not currently present in the window
* and the values returned by get_x() and get_y() may not be meaningful.
*/
INLINE bool PointerData::
get_in_window() const {
return _in_window;
}
/**
* Returns a unique identifier for this pointer. This is for tracking
* individual fingers. This value should not be assumed to have a specific
* meaning other than that there will not be two different pointers active
* simultaneously with the same identifier.
*/
INLINE int PointerData::
get_id() const {
return _id;
}
/**
* Returns the pressure of the pointer. For mice, this will be 1.0 if any
* button is pressed, 0.0 otherwise.
*/
INLINE double PointerData::
get_pressure() const {
return _pressure;
}
INLINE std::ostream &operator << (std::ostream &out, const PointerData &md) {
md.output(out);

View File

@ -24,24 +24,29 @@
*/
class EXPCL_PANDA_PUTIL PointerData {
PUBLISHED:
INLINE PointerData();
INLINE PointerData(const PointerData &copy);
INLINE void operator = (const PointerData &copy);
INLINE double get_x() const;
INLINE double get_y() const;
INLINE bool get_in_window() const;
public:
INLINE int get_id() const;
INLINE double get_pressure() const;
void output(std::ostream &out) const;
PUBLISHED:
MAKE_PROPERTY(x, get_x);
MAKE_PROPERTY(y, get_y);
MAKE_PROPERTY(id, get_id);
MAKE_PROPERTY(in_window, get_in_window);
MAKE_PROPERTY(pressure, get_pressure);
public:
bool _in_window;
double _xpos;
double _ypos;
bool _in_window = false;
double _xpos = 0.0;
double _ypos = 0.0;
double _pressure = 0.0;
int _id = 0;
};
INLINE std::ostream &operator << (std::ostream &out, const PointerData &md);