Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
831090e4
Commit
831090e4
authored
Feb 03, 2019
by
chili
Browse files
housekp: optional mouse evt
parent
1a760aaa
Changes
2
Show whitespace changes
Inline
Side-by-side
hw3d/Mouse.cpp
View file @
831090e4
...
...
@@ -51,7 +51,7 @@ bool Mouse::RightIsPressed() const noexcept
return
rightIsPressed
;
}
Mouse
::
Event
Mouse
::
Read
()
noexcept
std
::
optional
<
Mouse
::
Event
>
Mouse
::
Read
()
noexcept
{
if
(
buffer
.
size
()
>
0u
)
{
...
...
@@ -59,10 +59,7 @@ Mouse::Event Mouse::Read() noexcept
buffer
.
pop
();
return
e
;
}
else
{
return
Mouse
::
Event
();
}
return
{};
}
void
Mouse
::
Flush
()
noexcept
...
...
hw3d/Mouse.h
View file @
831090e4
...
...
@@ -20,6 +20,7 @@
******************************************************************************************/
#pragma once
#include <queue>
#include <optional>
class
Mouse
{
...
...
@@ -39,7 +40,6 @@ public:
Move
,
Enter
,
Leave
,
Invalid
};
private:
Type
type
;
...
...
@@ -48,14 +48,6 @@ public:
int
x
;
int
y
;
public:
Event
()
noexcept
:
type
(
Type
::
Invalid
),
leftIsPressed
(
false
),
rightIsPressed
(
false
),
x
(
0
),
y
(
0
)
{}
Event
(
Type
type
,
const
Mouse
&
parent
)
noexcept
:
type
(
type
),
...
...
@@ -64,10 +56,6 @@ public:
x
(
parent
.
x
),
y
(
parent
.
y
)
{}
bool
IsValid
()
const
noexcept
{
return
type
!=
Type
::
Invalid
;
}
Type
GetType
()
const
noexcept
{
return
type
;
...
...
@@ -103,7 +91,7 @@ public:
bool
IsInWindow
()
const
noexcept
;
bool
LeftIsPressed
()
const
noexcept
;
bool
RightIsPressed
()
const
noexcept
;
Mouse
::
Event
Read
()
noexcept
;
std
::
optional
<
Mouse
::
Event
>
Read
()
noexcept
;
bool
IsEmpty
()
const
noexcept
{
return
buffer
.
empty
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment