The ZX Ecosystem v5.1.0;_GUI_v3.1.0
Loading...
Searching...
No Matches
ZXPointing.h
Go to the documentation of this file.
1
2/* *************************************************************************/
20#ifndef ZXPOINTING
21#define ZXPOINTING
22
23#include <string>
25
26namespace zxeco
27{
28
29/* -----------------------------------------------------------------------------
30
31 Types, consts, etc.
32
33------------------------------------------------------------------------------*/
34 // needed for doxygen's DISTRIBUTE_GROUP_DOC
37
38struct PointingStatus // (no needed typedef in C++11)
39{
50 bool left = false, bool right = false): x{xx},y{yy},
51 buttonleft{left},
52 buttonright{right} {}
54
55 bool clicked(void) const noexcept
57 { return(buttonleft || buttonright); }
58
59 bool operator==(const PointingStatus & oth) const noexcept
61 { return((x == oth.x) && (y == oth.y) &&
62 (buttonleft == oth.buttonleft) &&
63 (buttonright == oth.buttonright)); }
64
65 bool operator!=(const PointingStatus & oth) const noexcept
67 { return(!operator==(oth)); }
68
69 std::string to_string(void) const
71 { return(std::string("Mouse(") + std::to_string(x) + "," +
72 std::to_string(y) + "; left " +
73 (buttonleft ? "on" : "off") + ", right " +
74 (buttonright ? "on" : "off") + ")"); }
75
76};
77
78
79} // end namespace zxeco
80
81#endif
82 // ZXMouse
84
uint16_t PixelCoord
Represent both x and y screen pix coordinates.
Definition: ZXGraphics.h:93
PointingStatus(PixelCoord xx=0, PixelCoord yy=0, bool left=false, bool right=false)
Default constructor.
Definition: ZXPointing.h:49
bool clicked(void) const noexcept
< Return TRUE if any button has been clicked.
Definition: ZXPointing.h:55
std::string to_string(void) const
< Return a text information of the status.
Definition: ZXPointing.h:69
bool operator!=(const PointingStatus &oth) const noexcept
< Return TRUE if there is any difference between them.
Definition: ZXPointing.h:65
bool buttonright
State (TRUE->pressed) of main buttons.
Definition: ZXPointing.h:45
PixelCoord x
Position of the pointing device on the zx screen.
Definition: ZXPointing.h:41
PixelCoord y
Position of the pointing device on the zx screen.
Definition: ZXPointing.h:41
bool buttonleft
State (TRUE->pressed) of main buttons.
Definition: ZXPointing.h:45
bool operator==(const PointingStatus &oth) const noexcept
< Return TRUE if both are exactly the same.
Definition: ZXPointing.h:59
Status of the pointing device.
Definition: ZXPointing.h:39
The main namespace of the library, that spans across all the zx modules.
Definition: ZXChars.h:31