ManaPlus
src
input
mouseinput.h
Go to the documentation of this file.
1
/*
2
* The ManaPlus Client
3
* Copyright (C) 2012-2019 The ManaPlus Developers
4
* Copyright (C) 2019-2021 Andrei Karas
5
*
6
* This file is part of The ManaPlus Client.
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
22
/* _______ __ __ __ ______ __ __ _______ __ __
23
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
24
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
25
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
26
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
27
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
28
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
29
*
30
* Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
31
*
32
*
33
* Per Larsson a.k.a finalman
34
* Olof Naessén a.k.a jansem/yakslem
35
*
36
* Visit: http://guichan.sourceforge.net
37
*
38
* License: (BSD)
39
* Redistribution and use in source and binary forms, with or without
40
* modification, are permitted provided that the following conditions
41
* are met:
42
* 1. Redistributions of source code must retain the above copyright
43
* notice, this list of conditions and the following disclaimer.
44
* 2. Redistributions in binary form must reproduce the above copyright
45
* notice, this list of conditions and the following disclaimer in
46
* the documentation and/or other materials provided with the
47
* distribution.
48
* 3. Neither the name of Guichan nor the names of its contributors may
49
* be used to endorse or promote products derived from this software
50
* without specific prior written permission.
51
*
52
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
58
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
59
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
60
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
61
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
62
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63
*/
64
65
#ifndef INPUT_MOUSEINPUT_H
66
#define INPUT_MOUSEINPUT_H
67
68
#include "
enums/events/mousebutton.h
"
69
#include "
enums/events/mouseeventtype.h
"
70
71
#include "
localconsts.h
"
72
73
class
MouseInput
final
74
{
75
public
:
76
MouseInput
()
noexcept2
:
77
mType
(
MouseEventType
::
MOVED
),
78
mButton
(
MouseButton
::
EMPTY
),
79
mTimeStamp
(0),
80
mX
(0),
81
mY
(0),
82
mRealX
(0),
83
mRealY
(0)
84
{ }
85
86
MouseInput
(
const
MouseInput
&m)
noexcept2
:
87
mType
(m.mType),
88
mButton
(m.mButton),
89
mTimeStamp
(m.mTimeStamp),
90
mX
(m.mX),
91
mY
(m.mY),
92
mRealX
(m.mRealX),
93
mRealY
(m.mRealY)
94
{
95
}
96
97
A_DEFAULT_COPY
(
MouseInput
)
98
99
MouseInput
&operator=(const
MouseInput
&m)
noexcept2
100
{
101
mType
= m.mType;
102
mButton
= m.mButton;
103
mTimeStamp
= m.mTimeStamp;
104
mX
= m.mX;
105
mY
= m.mY;
106
mRealX
= m.mRealX;
107
mRealY
= m.mRealY;
108
return
*
this
;
109
}
110
111
~MouseInput
()
112
{ }
113
114
void
setType
(
MouseEventTypeT
type)
noexcept2
115
{
116
mType
= type;
117
}
118
119
MouseEventTypeT
getType
() const
noexcept2
120
{
121
return
mType
;
122
}
123
124
void
setButton
(
MouseButtonT
button)
noexcept2
125
{
126
mButton
= button;
127
}
128
129
MouseButtonT
getButton
() const
noexcept2
130
{
131
return
mButton
;
132
}
133
134
int
getTimeStamp
() const
noexcept2
135
{
136
return
mTimeStamp
;
137
}
138
139
void
setTimeStamp
(
int
timeStamp)
noexcept2
140
{
141
mTimeStamp
= timeStamp;
142
}
143
144
void
setX
(
int
x
)
noexcept2
145
{
146
mX
=
x
;
147
}
148
149
int
getX
() const
noexcept2
150
{
151
return
mX
;
152
}
153
154
void
setY
(
int
y
)
noexcept2
155
{
156
mY
=
y
;
157
}
158
159
int
getY
() const
noexcept2
160
{
161
return
mY
;
162
}
163
164
void
setReal
(
const
int
x
,
const
int
y
)
noexcept2
165
{
mRealX
=
x
;
mRealY
=
y
; }
166
167
int
getRealX
() const
noexcept2
A_WARN_UNUSED
168
{
return
mRealX
; }
169
170
int
getRealY
() const
noexcept2
A_WARN_UNUSED
171
{
return
mRealY
; }
172
173
#ifdef ANDROID
174
int
getTouchX
() const
noexcept2
A_WARN_UNUSED
175
{
return
mRealX
; }
176
177
int
getTouchY
() const
noexcept2
A_WARN_UNUSED
178
{
return
mRealY
; }
179
#else
// ANDROID
180
181
int
getTouchX
() const
noexcept2
A_WARN_UNUSED
182
{
return
mX
; }
183
184
int
getTouchY
() const
noexcept2
A_WARN_UNUSED
185
{
return
mY
; }
186
#endif
// ANDROID
187
188
protected
:
192
MouseEventTypeT
mType
;
193
197
MouseButtonT
mButton
;
198
203
int
mTimeStamp
;
204
208
int
mX
;
209
213
int
mY
;
214
215
int
mRealX
;
216
217
int
mRealY
;
218
};
219
220
#endif
// INPUT_MOUSEINPUT_H
MouseInput
Definition:
mouseinput.h:74
MouseInput::getRealY
int getRealY() const
Definition:
mouseinput.h:170
MouseInput::getTouchY
int getTouchY() const
Definition:
mouseinput.h:184
MouseInput::mButton
MouseButtonT mButton
Definition:
mouseinput.h:197
MouseInput::mType
MouseEventTypeT mType
Definition:
mouseinput.h:192
MouseInput::mRealX
int mRealX
Definition:
mouseinput.h:215
MouseInput::~MouseInput
~MouseInput()
Definition:
mouseinput.h:111
MouseInput::MouseInput
MouseInput(const MouseInput &m)
Definition:
mouseinput.h:86
MouseInput::setY
void setY(int y)
Definition:
mouseinput.h:154
MouseInput::getTouchX
int getTouchX() const
Definition:
mouseinput.h:181
MouseInput::mTimeStamp
int mTimeStamp
Definition:
mouseinput.h:203
MouseInput::setButton
void setButton(MouseButtonT button)
Definition:
mouseinput.h:124
MouseInput::setReal
void setReal(const int x, const int y)
Definition:
mouseinput.h:164
MouseInput::MouseInput
MouseInput()
Definition:
mouseinput.h:76
MouseInput::setTimeStamp
void setTimeStamp(int timeStamp)
Definition:
mouseinput.h:139
MouseInput::setX
void setX(int x)
Definition:
mouseinput.h:144
MouseInput::mY
int mY
Definition:
mouseinput.h:213
MouseInput::getX
int getX() const
Definition:
mouseinput.h:149
MouseInput::setType
void setType(MouseEventTypeT type)
Definition:
mouseinput.h:114
MouseInput::getY
int getY() const
Definition:
mouseinput.h:159
MouseInput::getButton
MouseButtonT getButton() const
Definition:
mouseinput.h:129
MouseInput::mX
int mX
Definition:
mouseinput.h:208
MouseInput::mRealY
int mRealY
Definition:
mouseinput.h:217
MouseInput::getTimeStamp
int getTimeStamp() const
Definition:
mouseinput.h:134
MouseInput::getRealX
int getRealX() const
Definition:
mouseinput.h:167
MouseInput::getType
MouseEventTypeT getType() const
Definition:
mouseinput.h:119
y
y
Definition:
graphics_calcImageRect.hpp:73
x
x
Definition:
graphics_calcImageRect.hpp:73
localconsts.h
A_WARN_UNUSED
#define A_WARN_UNUSED
Definition:
localconsts.h:161
noexcept2
#define noexcept2
Definition:
localconsts.h:50
final
#define final
Definition:
localconsts.h:46
A_DEFAULT_COPY
#define A_DEFAULT_COPY(func)
Definition:
localconsts.h:41
mousebutton.h
MouseButtonT
MouseButton ::T MouseButtonT
Definition:
mousebutton.h:78
mouseeventtype.h
MouseEventTypeT
MouseEventType ::T MouseEventTypeT
Definition:
mouseeventtype.h:83
MouseButton
Definition:
mousebutton.h:70
MouseButton::EMPTY
@ EMPTY
Definition:
mousebutton.h:73
MouseEventType
Definition:
mouseeventtype.h:70
MouseEventType::MOVED
@ MOVED
Definition:
mouseeventtype.h:72
Generated on Wed Mar 17 2021 19:19:08 for ManaPlus by
1.9.1