]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/device.cpp
Fix a compiler warning from MSVC
[libs/gui.git] / source / input / device.cpp
index d5b3b864af3c854d42de216196ab42a17952a364..22429a0371bfcb9062e7c96d478e4a7c1d3a579f 100644 (file)
@@ -1,5 +1,5 @@
-#include <msp/strings/format.h>
 #include "device.h"
+#include <msp/strings/format.h>
 
 using namespace std;
 
@@ -15,12 +15,12 @@ Device::~Device()
 
 Device *Device::find_subdevice(const string &n)
 {
-       return (n==name ? this : 0);
+       return (n==name ? this : nullptr);
 }
 
 Device *Device::find_subdevice(DeviceType t, unsigned i)
 {
-       return (t==type && i==0 ? this : 0);
+       return (t==type && i==0 ? this : nullptr);
 }
 
 bool Device::get_button_state(unsigned btn) const
@@ -39,12 +39,12 @@ float Device::get_axis_value(unsigned axis) const
        return axes[axis];
 }
 
-std::string Device::get_button_name(unsigned btn) const
+string Device::get_button_name(unsigned btn) const
 {
        return format("Button %d", btn);
 }
 
-std::string Device::get_axis_name(unsigned axis) const
+string Device::get_axis_name(unsigned axis) const
 {
        return format("Axis %d", axis);
 }
@@ -54,7 +54,7 @@ void Device::set_button_state(unsigned btn, bool state, bool event)
        if(btn>=buttons.size())
                buttons.resize(btn+1, false);
 
-       if(state!=buttons[btn])
+       if(state!=static_cast<bool>(buttons[btn]))
        {
                buttons[btn] = state;