diff options
31 files changed, 138 insertions, 157 deletions
diff --git a/api/plugin-support.hpp b/api/plugin-support.hpp index 36a8c2bf..8fc01b98 100644 --- a/api/plugin-support.hpp +++ b/api/plugin-support.hpp @@ -159,7 +159,7 @@ private: in = in.mid(pfx_len); in = in.left(in.size() - rst_len); - static const char* names[] = + static constexpr const char* const names[] = { "opentrack-tracker-", "opentrack-proto-", diff --git a/csv/csv.cpp b/csv/csv.cpp index 189d05d9..8a5f5784 100644 --- a/csv/csv.cpp +++ b/csv/csv.cpp @@ -19,7 +19,7 @@ #include <utility> #include <algorithm> -const QTextCodec* CSV::m_codec = QTextCodec::codecForName("System"); +const QTextCodec* const CSV::m_codec = QTextCodec::codecForName("System"); const QRegExp CSV::m_rx = QRegExp(QString("((?:(?:[^;\\n]*;?)|(?:\"[^\"]*\";?))*)?\\n?")); const QRegExp CSV::m_rx2 = QRegExp(QString("(?:\"([^\"]*)\";?)|(?:([^;]*);?)?")); @@ -45,7 +45,7 @@ QString CSV::readLine() } else { - static const QChar lf(QChar::LineFeed); + const QChar lf(QChar::LineFeed); while (m_pos < m_string.length()) if (m_string[m_pos++] == lf) @@ -21,7 +21,6 @@ private: QString m_string; int m_pos; - static const QTextCodec* m_codec; - static const QRegExp m_rx; - static const QRegExp m_rx2; // Silly M$ compiler! It will generate an error if both of these variables are declared on the same line! (M$ Visual Studio Community 2015, Update 3) + static QTextCodec const* const m_codec; + static const QRegExp m_rx, m_rx2; }; diff --git a/filter-accela/accela-settings.hpp b/filter-accela/accela-settings.hpp index 2fea2f33..63173aa8 100644 --- a/filter-accela/accela-settings.hpp +++ b/filter-accela/accela-settings.hpp @@ -19,7 +19,7 @@ struct settings_accela : opts double x, y; }; - static constexpr gains rot_gains[16] = + static constexpr inline gains const rot_gains[16] = { { 9, 300 }, { 8, 200 }, @@ -30,7 +30,7 @@ struct settings_accela : opts { .5, .4 }, }; - static constexpr gains pos_gains[16] = + static constexpr inline gains const pos_gains[16] = { { 9, 200 }, { 8, 150 }, diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp index fc660d2c..23d71ef0 100644 --- a/filter-accela/ftnoir_filter_accela.cpp +++ b/filter-accela/ftnoir_filter_accela.cpp @@ -14,9 +14,6 @@ #include "compat/math-imports.hpp" -constexpr settings_accela::gains settings_accela::rot_gains[16]; -constexpr settings_accela::gains settings_accela::pos_gains[16]; - accela::accela() : first_run(true) { s.make_splines(spline_rot, spline_pos); diff --git a/gui/init.cpp b/gui/init.cpp index e648cfa0..1de98f60 100644 --- a/gui/init.cpp +++ b/gui/init.cpp @@ -61,7 +61,7 @@ void set_qt_style() #if defined _WIN32 || defined __APPLE__ // our layouts on OSX make some control wrongly sized -sh 20160908 { - const char* preferred[] { "fusion", "windowsvista", "macintosh" }; + const char* const preferred[] { "fusion", "windowsvista", "macintosh" }; for (const char* style_name : preferred) { QStyle* s = QStyleFactory::create(style_name); diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index d690b406..9059a251 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -190,8 +190,6 @@ static bool is_nan(const dmat<u,w>& r) return false; } -constexpr double pipeline::c_mult; -constexpr double pipeline::c_div; template<typename x, typename y, typename... xs> static inline bool nan_check_(const x& datum, const y& next, const xs&... rest) { @@ -480,8 +478,9 @@ void pipeline::run() #endif { - static constexpr const char* posechannels[6] = { "TX", "TY", "TZ", "Yaw", "Pitch", "Roll" }; - static constexpr const char* datachannels[5] = { "dt", "raw", "corrected", "filtered", "mapped" }; + static const char* const posechannels[6] = { "TX", "TY", "TZ", "Yaw", "Pitch", "Roll" }; + static const char* const datachannels[5] = { "dt", "raw", "corrected", "filtered", "mapped" }; + logger.write(datachannels[0]); char buffer[128]; for (unsigned j = 1; j < 5; ++j) diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp index 0061e439..1e1919f4 100644 --- a/logic/pipeline.hpp +++ b/logic/pipeline.hpp @@ -114,8 +114,8 @@ private: void run() override; // note: float exponent base is 2 - static constexpr double c_mult = 16; - static constexpr double c_div = 1./c_mult; + static constexpr inline double c_mult = 16; + static constexpr inline double c_div = 1./c_mult; public: pipeline(Mappings& m, runtime_libraries& libs, event_handler& ev, TrackLogger& logger); ~pipeline(); diff --git a/migration/20160906_00-mappings.cpp b/migration/20160906_00-mappings.cpp index 0712afca..567fbdcb 100644 --- a/migration/20160906_00-mappings.cpp +++ b/migration/20160906_00-mappings.cpp @@ -20,7 +20,7 @@ using namespace migrations; -static const char* old_names[] = +static const char* const old_names[] = { "tx", "tx_alt", "ty", "ty_alt", @@ -30,7 +30,7 @@ static const char* old_names[] = "rz", "rz_alt", }; -static const char* new_names[] = { +static const char* const new_names[] = { "spline-X", "alt-spline-X", "spline-Y", "alt-spline-Y", "spline-Z", "alt-spline-Z", diff --git a/migration/20160906_01-axis-signs.cpp b/migration/20160906_01-axis-signs.cpp index 6dfa0d7c..7b0be70a 100644 --- a/migration/20160906_01-axis-signs.cpp +++ b/migration/20160906_01-axis-signs.cpp @@ -15,13 +15,18 @@ using namespace options; using namespace migrations; +const char* const axis_names[] = +{ + "yaw", "pitch", "roll", + "x", "y", "z", +}; + +const QString alt_sign_fmt = QStringLiteral("%1-alt-axis-sign"); + struct axis_signs_split_rc11 : migration { axis_signs_split_rc11() = default; - static const char* axis_names[6]; - static const QString fmt; - QString unique_date() const override { return "20160909_01"; @@ -32,47 +37,43 @@ struct axis_signs_split_rc11 : migration return "asymmetric axis option to other section"; } - bool should_run() const override + bool should_run() const override; + void run() override; +}; + +OPENTRACK_MIGRATION(axis_signs_split_rc11); + +bool axis_signs_split_rc11::should_run() const +{ + bundle new_bundle = make_bundle("opentrack-mappings"); + bundle old_bundle = make_bundle("opentrack-ui"); + + for (const char* name : axis_names) { - bundle new_bundle = make_bundle("opentrack-mappings"); - bundle old_bundle = make_bundle("opentrack-ui"); - - for (const char* name : axis_names) - { - // new present, already applied - if (new_bundle->contains(fmt.arg(name))) - return false; - } - - for (const char* name : axis_names) - { - // old present - if (old_bundle->contains(fmt.arg(name))) - return true; - } - - // nothing to copy - return false; + // new present, already applied + if (new_bundle->contains(alt_sign_fmt.arg(name))) + return false; } - void run() override + for (const char* name : axis_names) { - bundle new_bundle = make_bundle("opentrack-mappings"); - bundle old_bundle = make_bundle("opentrack-ui"); - - for (const char* name : axis_names) - new_bundle->store_kv(fmt.arg(name), QVariant(old_bundle->get<bool>(fmt.arg(name)))); - - new_bundle->save(); + // old present + if (old_bundle->contains(alt_sign_fmt.arg(name))) + return true; } -}; -const char* axis_signs_split_rc11::axis_names[] = + // nothing to copy + return false; +} + +void axis_signs_split_rc11::run() { - "yaw", "pitch", "roll", - "x", "y", "z", -}; + bundle new_bundle = make_bundle("opentrack-mappings"); + bundle old_bundle = make_bundle("opentrack-ui"); -const QString axis_signs_split_rc11::fmt = QStringLiteral("%1-alt-axis-sign"); + for (const char* name : axis_names) + new_bundle->store_kv(alt_sign_fmt.arg(name), + QVariant(old_bundle->get<bool>(alt_sign_fmt.arg(name)))); -OPENTRACK_MIGRATION(axis_signs_split_rc11); + new_bundle->save(); +} diff --git a/migration/20160906_02-modules.cpp b/migration/20160906_02-modules.cpp index 0f0951f1..9ce2b9dc 100644 --- a/migration/20160906_02-modules.cpp +++ b/migration/20160906_02-modules.cpp @@ -15,12 +15,17 @@ using namespace options; using namespace migrations; +static const char* const module_names[3] = +{ + "tracker-dll", + "protocol-dll", + "filter-dll", +}; + struct split_modules_rc11 : migration { split_modules_rc11() = default; - static const char* names[3]; - QString unique_date() const override { return "20160909_02"; @@ -36,11 +41,11 @@ struct split_modules_rc11 : migration bundle new_bundle = make_bundle("modules"); bundle old_bundle = make_bundle("opentrack-ui"); - for (const char* name : names) + for (const char* name : module_names) if (new_bundle->contains(name)) return false; - for (const char* name : names) + for (const char* name : module_names) if (old_bundle->contains(name)) return true; @@ -52,18 +57,11 @@ struct split_modules_rc11 : migration bundle new_bundle = make_bundle("modules"); bundle old_bundle = make_bundle("opentrack-ui"); - for (const char* name : names) + for (const char* name : module_names) new_bundle->store_kv(name, QVariant(old_bundle->get<QString>(name))); new_bundle->save(); } }; -const char* split_modules_rc11::names[3] = -{ - "tracker-dll", - "protocol-dll", - "filter-dll", -}; - OPENTRACK_MIGRATION(split_modules_rc11); diff --git a/migration/20170420_00-udp-naming.cpp b/migration/20170420_00-udp-naming.cpp index de4674bd..0361b7b9 100644 --- a/migration/20170420_00-udp-naming.cpp +++ b/migration/20170420_00-udp-naming.cpp @@ -13,11 +13,11 @@ using namespace migrations; using namespace options; -static constexpr const char* old_tracker_name = "UDP sender"; -static constexpr const char* old_proto_name = "UDP Tracker"; +static const char* const old_tracker_name = "UDP sender"; +static const char* const old_proto_name = "UDP Tracker"; -static constexpr const char* new_tracker_name = "UDP over network"; -static constexpr const char* new_proto_name = "UDP over network"; +static const char* const new_tracker_name = "UDP over network"; +static const char* const new_proto_name = "UDP over network"; struct rename_udp_stuff : migration { diff --git a/migration/20171013_00-tracker-pt-threshold.cpp b/migration/20171013_00-tracker-pt-threshold.cpp index 32e69f6d..aab64de7 100644 --- a/migration/20171013_00-tracker-pt-threshold.cpp +++ b/migration/20171013_00-tracker-pt-threshold.cpp @@ -13,9 +13,9 @@ using namespace options; using namespace migrations; -static constexpr const char* old_name = "threshold-primary"; -static constexpr const char* new_name = "threshold-slider"; -static constexpr const char* bundle_name = "tracker-pt"; +static const char* const old_name = "threshold-primary"; +static const char* const new_name = "threshold-slider"; +static const char* const bundle_name = "tracker-pt"; struct move_int_to_slider : migration { diff --git a/pose-widget/pose-widget.cpp b/pose-widget/pose-widget.cpp index 69861b24..0880fd1e 100644 --- a/pose-widget/pose-widget.cpp +++ b/pose-widget/pose-widget.cpp @@ -287,7 +287,7 @@ void pose_transform::project_quad_texture() const int orig_depth = tex.depth() / 8; const int dest_depth = image.depth() / 8; - static constexpr int const_depth = 4; + constexpr int const_depth = 4; if (unlikely(orig_depth != const_depth || dest_depth != const_depth)) { diff --git a/proto-mouse/ftnoir_protocol_mouse.cpp b/proto-mouse/ftnoir_protocol_mouse.cpp index ccc91e33..b4b27ea9 100644 --- a/proto-mouse/ftnoir_protocol_mouse.cpp +++ b/proto-mouse/ftnoir_protocol_mouse.cpp @@ -17,6 +17,12 @@ # define MOUSEEVENTF_MOVE_NOCOALESCE 0x2000 #endif +static const double invert[] = +{ + 1., 1., 1., + 1., -1., 1. +}; + void mouse::pose(const double *headpose) { const int axis_x = s.Mouse_X - 1; @@ -24,12 +30,6 @@ void mouse::pose(const double *headpose) int mouse_x = 0, mouse_y = 0; - static constexpr double invert[] = - { - 1., 1., 1., - 1., -1., 1. - }; - if (axis_x >= 0 && axis_x < 6) { mouse_x = get_value(headpose[axis_x] * invert[axis_x], @@ -76,7 +76,7 @@ int mouse::get_delta(int val, int prev) int mouse::get_value(double val, double sensitivity, bool is_rotation) { - static constexpr double sgn[] = { 1e-2, 1 }; + constexpr double sgn[] = { 1e-2, 1 }; constexpr double c = 1e-1; return iround(val * c * sensitivity * sgn[unsigned(is_rotation)]); diff --git a/proto-vjoystick/vjoystick.cpp b/proto-vjoystick/vjoystick.cpp index 73cf74c6..e5e18157 100644 --- a/proto-vjoystick/vjoystick.cpp +++ b/proto-vjoystick/vjoystick.cpp @@ -39,7 +39,15 @@ const unsigned char handle::axis_ids[6] = // HID_USAGE_WHL, }; -constexpr double handle::val_minmax[6]; +static const double val_minmax[6] = +{ + 50, + 50, + 50, + 180, + 180, + 180 +}; void handle::init() { diff --git a/proto-vjoystick/vjoystick.h b/proto-vjoystick/vjoystick.h index 6469a4e6..72dde0f0 100644 --- a/proto-vjoystick/vjoystick.h +++ b/proto-vjoystick/vjoystick.h @@ -30,16 +30,6 @@ private: LONG axis_min[6]; LONG axis_max[6]; - static constexpr double val_minmax[6] = - { - 50, - 50, - 50, - 180, - 180, - 180 - }; - void init(); public: handle(); diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp index b797a907..638b67a7 100644 --- a/spline/spline-widget.cpp +++ b/spline/spline-widget.cpp @@ -223,7 +223,7 @@ void spline_widget::drawFunction() painter.drawPath(path); #else - static constexpr int line_length_pixels = 3; + constexpr int line_length_pixels = 3; const qreal max = _config->maxInput(); const qreal step = clamp(line_length_pixels / c.x(), 5e-2, max); QPointF prev = point_to_pixel(QPoint(0, 0)); diff --git a/spline/spline.cpp b/spline/spline.cpp index 823fd64f..fc77bf8b 100644 --- a/spline/spline.cpp +++ b/spline/spline.cpp @@ -27,8 +27,6 @@ using namespace spline_detail; -constexpr std::size_t spline::value_count; - spline::spline(const QString& name, const QString& axis_name, Axis axis) : axis(axis) { diff --git a/spline/spline.hpp b/spline/spline.hpp index 0d080cef..a3532855 100644 --- a/spline/spline.hpp +++ b/spline/spline.hpp @@ -16,6 +16,7 @@ using namespace options; #include "export.hpp" +#include <cstddef> #include <vector> #include <limits> #include <memory> @@ -102,7 +103,7 @@ class OTR_SPLINE_EXPORT spline : public base_spline std::shared_ptr<spline_detail::settings> s; QMetaObject::Connection connection, conn_maxx, conn_maxy; - static constexpr std::size_t value_count = 4096; + static constexpr inline std::size_t value_count = 4096; std::vector<float> data = std::vector<float>(value_count, float(-16)); diff --git a/tracker-aruco/ftnoir_tracker_aruco.cpp b/tracker-aruco/ftnoir_tracker_aruco.cpp index c322d323..faa8bb44 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.cpp +++ b/tracker-aruco/ftnoir_tracker_aruco.cpp @@ -33,6 +33,32 @@ #include <algorithm> #include <iterator> +static const int adaptive_sizes[] = +{ +#if defined USE_EXPERIMENTAL_CANNY + 10, + 30, + 80, +#else + 7, + 9, + 13, +#endif +}; + +struct resolution_tuple +{ + int width; + int height; +}; + +static const resolution_tuple resolution_choices[] = +{ + { 640, 480 }, + { 320, 240 }, + { 0, 0 } +}; + aruco_tracker::aruco_tracker() { cv::setBreakOnError(true); diff --git a/tracker-aruco/ftnoir_tracker_aruco.h b/tracker-aruco/ftnoir_tracker_aruco.h index 3a98e9d1..b753fdec 100644 --- a/tracker-aruco/ftnoir_tracker_aruco.h +++ b/tracker-aruco/ftnoir_tracker_aruco.h @@ -69,7 +69,7 @@ class aruco_tracker : protected virtual QThread, public ITracker { Q_OBJECT friend class aruco_dialog; - static constexpr float c_search_window = 1.3f; + static constexpr inline float c_search_window = 1.3f; public: aruco_tracker(); ~aruco_tracker() override; @@ -124,44 +124,17 @@ private: unsigned adaptive_size_pos = 0; bool use_otsu = false; - struct resolution_tuple - { - int width; - int height; - }; - - static constexpr inline const int adaptive_sizes[] = - { -#if defined USE_EXPERIMENTAL_CANNY - 10, - 30, - 80, -#else - 7, - 9, - 13, -#endif - }; - #if !defined USE_EXPERIMENTAL_CANNY static constexpr inline int adaptive_thres = 6; #else static constexpr inline int adaptive_thres = 3; #endif - static constexpr inline const resolution_tuple resolution_choices[] = - { - { 640, 480 }, - { 320, 240 }, - { 0, 0 } - }; - #ifdef DEBUG_UNSHARP_MASKING static constexpr inline double gauss_kernel_size = 3; #endif static constexpr inline double timeout = 1; - static constexpr inline double timeout_backoff_c = 4./11; static constexpr inline float size_min = 0.05; diff --git a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp index 14498861..a93a22cb 100644 --- a/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp +++ b/tracker-freepie-udp/ftnoir_tracker_freepie-udp.cpp @@ -75,7 +75,7 @@ void tracker_freepie::run() { if (filled) { - static constexpr int add_cbx[] = + constexpr int add_cbx[] = { 0, 90, diff --git a/tracker-pt/ftnoir_tracker_pt.h b/tracker-pt/ftnoir_tracker_pt.h index d1f7e1d7..3cb5f67b 100644 --- a/tracker-pt/ftnoir_tracker_pt.h +++ b/tracker-pt/ftnoir_tracker_pt.h @@ -81,7 +81,7 @@ private: std::atomic<unsigned> point_count = 0; std::atomic<bool> ever_success = false; - static constexpr f rad2deg = f(180/M_PI); + static constexpr inline f rad2deg = f(180/M_PI); //static constexpr float deg2rad = float(M_PI/180); }; diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp index 10a2c6cb..5bd1a4c8 100644 --- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp +++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp @@ -90,7 +90,7 @@ TrackerDialog_PT::TrackerDialog_PT(const QString& module_name) : connect(this, &TrackerDialog_PT::poll_tracker_info, this, &TrackerDialog_PT::poll_tracker_info_impl, Qt::DirectConnection); - static constexpr pt_color_type color_types[] = { + constexpr pt_color_type color_types[] = { pt_color_average, pt_color_natural, pt_color_red_only, diff --git a/tracker-pt/point_tracker.cpp b/tracker-pt/point_tracker.cpp index 5efbbfe8..6116bec5 100644 --- a/tracker-pt/point_tracker.cpp +++ b/tracker-pt/point_tracker.cpp @@ -16,8 +16,6 @@ using namespace types; #include <QDebug> -constexpr unsigned PointModel::N_POINTS; - static void get_row(const mat33& m, int i, vec3& v) { v[0] = m(i,0); diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h index 6abe5df9..5e741c75 100644 --- a/tracker-pt/point_tracker.h +++ b/tracker-pt/point_tracker.h @@ -32,7 +32,7 @@ using namespace types; struct PointModel final { - static constexpr unsigned N_POINTS = 3; + static constexpr inline unsigned N_POINTS = 3; vec3 M01; // M01 in model frame vec3 M02; // M02 in model frame diff --git a/tracker-s2bot/ftnoir_tracker_s2bot.cpp b/tracker-s2bot/ftnoir_tracker_s2bot.cpp index a7411fb7..44ae6132 100644 --- a/tracker-s2bot/ftnoir_tracker_s2bot.cpp +++ b/tracker-s2bot/ftnoir_tracker_s2bot.cpp @@ -18,6 +18,15 @@ tracker_s2bot::~tracker_s2bot() wait(); } +static constexpr int add_cbx[] = +{ + 0, + 90, + -90, + 180, + -180, +}; + void tracker_s2bot::run() { if (s.freq == 0) s.freq = 10; timer.setInterval(1000.0/s.freq); @@ -44,15 +53,6 @@ void tracker_s2bot::run() { clamp(s.idx_z, 0, 3), }; - static constexpr int add_cbx[] = - { - 0, - 90, - -90, - 180, - -180, - }; - int add_indices[] = { s.add_yaw, s.add_pitch, s.add_roll, }; double orient[4] {}; diff --git a/tracker-tobii-eyex/tobii-eyex.hpp b/tracker-tobii-eyex/tobii-eyex.hpp index 8583acf0..170e74c1 100644 --- a/tracker-tobii-eyex/tobii-eyex.hpp +++ b/tracker-tobii-eyex/tobii-eyex.hpp @@ -36,7 +36,7 @@ public: return true; } private: - static constexpr const char* client_id = "opentrack-tobii-eyex"; + static constexpr inline const char* const client_id = "opentrack-tobii-eyex"; static void call_tx_deinit(); diff --git a/tracker-wii/wiiyourself/wiimote.cpp b/tracker-wii/wiiyourself/wiimote.cpp index 956c4fc6..e1e49101 100644 --- a/tracker-wii/wiiyourself/wiimote.cpp +++ b/tracker-wii/wiiyourself/wiimote.cpp @@ -114,13 +114,13 @@ const unsigned wiimote::FreqLookup [TOTAL_FREQUENCIES] = { 0, 4200, 3920, 3640, 3360, 3130, 2940, 2760, 2610, 2470 }; -const TCHAR* wiimote::ButtonNameFromBit [TOTAL_BUTTON_BITS] = +const TCHAR* const wiimote::ButtonNameFromBit [TOTAL_BUTTON_BITS] = { _T("Left") , _T("Right"), _T("Down"), _T("Up"), _T("Plus") , _T("??") , _T("??") , _T("??") , _T("Two") , _T("One") , _T("B") , _T("A") , _T("Minus"), _T("??") , _T("??") , _T("Home") }; -const TCHAR* wiimote::ClassicButtonNameFromBit [TOTAL_BUTTON_BITS] = +const TCHAR* const wiimote::ClassicButtonNameFromBit [TOTAL_BUTTON_BITS] = { _T("??") , _T("TrigR") , _T("Plus") , _T("Home"), _T("Minus"), _T("TrigL") , _T("Down") , _T("Right") , _T("Up") , _T("Left") , _T("ZR") , _T("X") , diff --git a/tracker-wii/wiiyourself/wiimote.h b/tracker-wii/wiiyourself/wiimote.h index 1db2c098..3588b7c7 100644 --- a/tracker-wii/wiiyourself/wiimote.h +++ b/tracker-wii/wiiyourself/wiimote.h @@ -8,12 +8,7 @@ // // wiimote.h (tab = 4 spaces) -#ifdef _MSC_VER // VC -# pragma once -#endif - -#ifndef _WIIMOTE_H -# define _WIIMOTE_H +#pragma once #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -165,7 +160,7 @@ class wiimote : public wiimote_state const wiimote_state &new_state) {}; // get the button name from its bit index (some bits are unused) - static const TCHAR* ButtonNameFromBit [TOTAL_BUTTON_BITS]; + static const TCHAR* const ButtonNameFromBit [TOTAL_BUTTON_BITS]; static const TCHAR* GetButtonNameFromBit (unsigned index) { _ASSERT(index < TOTAL_BUTTON_BITS); @@ -175,8 +170,8 @@ class wiimote : public wiimote_state } // same for the Classic Controller - static const TCHAR* ClassicButtonNameFromBit [TOTAL_BUTTON_BITS]; - static const TCHAR* GetClassicButtonNameFromBit (unsigned index) + static const TCHAR* const ClassicButtonNameFromBit [TOTAL_BUTTON_BITS]; + static const TCHAR* GetClassicButtonNameFromBit (unsigned index) { _ASSERT(index < TOTAL_BUTTON_BITS); if(index >= TOTAL_BUTTON_BITS) @@ -491,5 +486,3 @@ volatile int MotionPlusDetectCount; // waiting for the result unsigned ExtTriggerFlags;// extension changes " } Recording; }; - -#endif // _WIIMOTE_H
\ No newline at end of file |