aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2015-04-05 01:52:52 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2015-04-05 01:52:52 +0200
commit62d0f7e8e031251a4622cd0c9bc8bdc17048cfcd (patch)
treed4c74b5ca58db570a7856e08abd736652d98b492 /src/menu
parentfe9648fa1cdc8f9cf5216a88fadb8b96604047fd (diff)
downloadusdx-cpp.tar.gz
usdx-cpp.tar.xz
usdx-cpp.zip
compat/chrono_literals: Add C++14 backport.cpp
Add user-defined literals for duration types (like the ones from C++14), Because these are user-defined they start with an underscore.
Diffstat (limited to 'src/menu')
-rw-r--r--src/menu/mouse_event.cpp7
-rw-r--r--src/menu/software_mouse_pointer.cpp3
2 files changed, 6 insertions, 4 deletions
diff --git a/src/menu/mouse_event.cpp b/src/menu/mouse_event.cpp
index 3f4104a0..ddcc00f2 100644
--- a/src/menu/mouse_event.cpp
+++ b/src/menu/mouse_event.cpp
@@ -25,6 +25,7 @@
#include <cstddef>
#include "mouse_event.hpp"
+#include "utils/compat/chrono_literals.hpp"
namespace usdx
{
@@ -48,17 +49,17 @@ namespace usdx
{
if (direction == UP) {
if (this->direction == DOWN) {
- if (time.since(std::chrono::milliseconds{5000}))
+ if (time.since(5000_ms))
return CLICK;
}
else if (this->direction == CLICK) {
- if (time.since(std::chrono::milliseconds{5000}))
+ if (time.since(5000_ms))
return DBL_CLICK;
}
}
else if (direction == DOWN) {
if (this->direction == CLICK &&
- time.since(std::chrono::milliseconds{5000}))
+ time.since(5000_ms))
return CLICK;
}
}
diff --git a/src/menu/software_mouse_pointer.cpp b/src/menu/software_mouse_pointer.cpp
index 2708917c..fd102fa8 100644
--- a/src/menu/software_mouse_pointer.cpp
+++ b/src/menu/software_mouse_pointer.cpp
@@ -28,13 +28,14 @@
#include "software_mouse_pointer.hpp"
#include "utils/activator.hpp"
+#include "utils/compat/chrono_literals.hpp"
namespace usdx
{
SoftwareMousePointer::SoftwareMousePointer(Container* parent, EventManager* event_manager)
: DrawableControl(parent), color(255,255,255,100), down(false)
{
- fade_inactive = new Timer(this, std::chrono::seconds{2}, true);
+ fade_inactive = new Timer(this, 2_s, true);
this->vertices[0] = 0.0f;
this->vertices[1] = 40.0f;