File tree Expand file tree Collapse file tree 9 files changed +20
-24
lines changed Expand file tree Collapse file tree 9 files changed +20
-24
lines changed Original file line number Diff line number Diff line change @@ -144,8 +144,10 @@ typedef enum
144144 sfKeyPause , ///< The Pause key
145145} sfKeyCode ;
146146
147- CSFML_WINDOW_API const unsigned int sfKeyCount ; ///< The total number of keyboard keys
148-
147+ enum
148+ {
149+ sfKeyCount = sfKeyPause + 1 ///< The total number of keyboard keys
150+ };
149151
150152////////////////////////////////////////////////////////////
151153/// \brief Scancodes
@@ -312,8 +314,10 @@ typedef enum
312314 sfScanLaunchMediaSelect , //!< Keyboard Launch Media Select key
313315} sfScancode ;
314316
315- CSFML_WINDOW_API const unsigned int sfScancodeCount ; //!< The total number of scancodes
316-
317+ enum
318+ {
319+ sfScancodeCount = sfScanLaunchMediaSelect + 1 //!< The total number of scancodes
320+ };
317321
318322////////////////////////////////////////////////////////////
319323/// \brief Check if a key is pressed
Original file line number Diff line number Diff line change @@ -46,7 +46,10 @@ typedef enum
4646 sfMouseButtonExtra2 , ///< The second extra mouse button
4747} sfMouseButton ;
4848
49- CSFML_WINDOW_API const unsigned int sfMouseButtonCount ; ///< The total number of mouse buttons
49+ enum
50+ {
51+ sfMouseButtonCount = sfMouseButtonExtra2 + 1 ///< The total number of mouse buttons
52+ };
5053
5154////////////////////////////////////////////////////////////
5255/// \brief Mouse wheels
Original file line number Diff line number Diff line change @@ -47,8 +47,10 @@ typedef enum
4747 sfSensorOrientation , ///< Measures the absolute 3D orientation (degrees)
4848} sfSensorType ;
4949
50- CSFML_WINDOW_API const unsigned int sfSensorCount ; ///< The total number of sensor types
51-
50+ enum
51+ {
52+ sfSensorCount = sfSensorOrientation + 1 ///< The total number of sensor types
53+ };
5254
5355////////////////////////////////////////////////////////////
5456/// \brief Check if a sensor is available on the underlying platform
Original file line number Diff line number Diff line change 3333#include < cstring>
3434
3535
36- // //////////////////////////////////////////////////////////
37- const unsigned int sfKeyCount = sfKeyPause + 1 ;
38- const unsigned int sfScancodeCount = sfScanLaunchMediaSelect + 1 ;
39-
40-
4136// //////////////////////////////////////////////////////////
4237bool sfKeyboard_isKeyPressed (sfKeyCode key)
4338{
Original file line number Diff line number Diff line change 3333#include < SFML/Window/Mouse.hpp>
3434
3535
36- // //////////////////////////////////////////////////////////
37- const unsigned int sfMouseButtonCount = sfMouseButtonExtra2 + 1 ;
38-
39-
4036// //////////////////////////////////////////////////////////
4137bool sfMouse_isButtonPressed (sfMouseButton button)
4238{
Original file line number Diff line number Diff line change 3131#include < SFML/Window/Sensor.hpp>
3232
3333
34- // //////////////////////////////////////////////////////////
35- const unsigned int sfSensorCount = sfSensorOrientation + 1 ;
36-
37-
3834// //////////////////////////////////////////////////////////
3935bool sfSensor_isAvailable (sfSensorType sensor)
4036{
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ TEST_CASE("[Window] sfKeyboard")
1414 STATIC_CHECK (sfKeyC == static_cast <int >(sf::Keyboard::Key::C));
1515 STATIC_CHECK (sfKeyD == static_cast <int >(sf::Keyboard::Key::D));
1616 STATIC_CHECK (sfKeyPause == static_cast <int >(sf::Keyboard::Key::Pause));
17- CHECK (sfKeyCount == sf::Keyboard::KeyCount);
17+ STATIC_CHECK (sfKeyCount == sf::Keyboard::KeyCount);
1818 }
1919
2020 SECTION (" sfScancode" )
@@ -24,6 +24,6 @@ TEST_CASE("[Window] sfKeyboard")
2424 STATIC_CHECK (sfScanB == static_cast <int >(sf::Keyboard::Scan::B));
2525 STATIC_CHECK (sfScanC == static_cast <int >(sf::Keyboard::Scan::C));
2626 STATIC_CHECK (sfScanD == static_cast <int >(sf::Keyboard::Scan::D));
27- CHECK (sfScancodeCount == sf::Keyboard::ScancodeCount);
27+ STATIC_CHECK (sfScancodeCount == sf::Keyboard::ScancodeCount);
2828 }
2929}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ TEST_CASE("[Window] sfMouse")
1313 STATIC_CHECK (sfMouseMiddle == static_cast <int >(sf::Mouse::Button::Middle));
1414 STATIC_CHECK (sfMouseButtonExtra1 == static_cast <int >(sf::Mouse::Button::Extra1));
1515 STATIC_CHECK (sfMouseButtonExtra2 == static_cast <int >(sf::Mouse::Button::Extra2));
16- CHECK (sfMouseButtonCount == sf::Mouse::ButtonCount);
16+ STATIC_CHECK (sfMouseButtonCount == sf::Mouse::ButtonCount);
1717 }
1818
1919 SECTION (" sfMouseWheel" )
Original file line number Diff line number Diff line change @@ -14,6 +14,6 @@ TEST_CASE("[Window] sfSensor")
1414 STATIC_CHECK (sfSensorGravity == static_cast <int >(sf::Sensor::Type::Gravity));
1515 STATIC_CHECK (sfSensorUserAcceleration == static_cast <int >(sf::Sensor::Type::UserAcceleration));
1616 STATIC_CHECK (sfSensorOrientation == static_cast <int >(sf::Sensor::Type::Orientation));
17- CHECK (sfSensorCount == sf::Sensor::Count);
17+ STATIC_CHECK (sfSensorCount == sf::Sensor::Count);
1818 }
1919}
You can’t perform that action at this time.
0 commit comments