Update enumerations to match SFML 3

This commit is contained in:
Chris Thrasher committed 2024-09-27 13:24:31 -06:00
1 parent fef1e09542
commit c74378bade
9 files changed
+32 -19

No files matched your search

+4 -4
View File
@@ -142,10 +142,10 @@ typedef enum
sfKeyF14, ///< The F14 key
sfKeyF15, ///< The F15 key
sfKeyPause, ///< The Pause key
sfKeyCount, ///< Keep last -- the total number of keyboard keys
} sfKeyCode;
CSFML_WINDOW_API const unsigned int sfKeyCount; ///< The total number of keyboard keys
////////////////////////////////////////////////////////////
/// \brief Scancodes
@@ -310,10 +310,10 @@ typedef enum
sfScanLaunchApplication2, //!< Keyboard Launch Application 2 key
sfScanLaunchMail, //!< Keyboard Launch Mail key
sfScanLaunchMediaSelect, //!< Keyboard Launch Media Select key
sfScancodeCount //!< Keep last -- the total number of scancodes
} sfScancode;
CSFML_WINDOW_API const unsigned int sfScancodeCount; //!< The total number of scancodes
////////////////////////////////////////////////////////////
/// \brief Check if a key is pressed
+7 -7
View File
@@ -39,15 +39,15 @@
////////////////////////////////////////////////////////////
typedef enum
{
sfMouseLeft, ///< The left mouse button
sfMouseRight, ///< The right mouse button
sfMouseMiddle, ///< The middle (wheel) mouse button
sfMouseXButton1, ///< The first extra mouse button
sfMouseXButton2, ///< The second extra mouse button
sfMouseButtonCount ///< Keep last -- the total number of mouse buttons
sfMouseLeft, ///< The left mouse button
sfMouseRight, ///< The right mouse button
sfMouseMiddle, ///< The middle (wheel) mouse button
sfMouseButtonExtra1, ///< The first extra mouse button
sfMouseButtonExtra2, ///< The second extra mouse button
} sfMouseButton;
CSFML_WINDOW_API const unsigned int sfMouseButtonCount; ///< The total number of mouse buttons
////////////////////////////////////////////////////////////
/// \brief Mouse wheels
///
+2 -2
View File
@@ -45,10 +45,10 @@ typedef enum
sfSensorGravity, ///< Measures the direction and intensity of gravity, independent of device acceleration (m/s^2)
sfSensorUserAcceleration, ///< Measures the direction and intensity of device acceleration, independent of the gravity (m/s^2)
sfSensorOrientation, ///< Measures the absolute 3D orientation (degrees)
sfSensorCount ///< Keep last -- the total number of sensor types
} sfSensorType;
CSFML_WINDOW_API const unsigned int sfSensorCount; ///< The total number of sensor types
////////////////////////////////////////////////////////////
/// \brief Check if a sensor is available on the underlying platform
+5
View File
@@ -33,6 +33,11 @@
#include <cstring>
////////////////////////////////////////////////////////////
const unsigned int sfKeyCount = sfKeyPause + 1;
const unsigned int sfScancodeCount = sfScanLaunchMediaSelect + 1;
////////////////////////////////////////////////////////////
bool sfKeyboard_isKeyPressed(sfKeyCode key)
{
+4
View File
@@ -33,6 +33,10 @@
#include <SFML/Window/Mouse.hpp>
////////////////////////////////////////////////////////////
const unsigned int sfMouseButtonCount = sfMouseButtonExtra2 + 1;
////////////////////////////////////////////////////////////
bool sfMouse_isButtonPressed(sfMouseButton button)
{
+4
View File
@@ -31,6 +31,10 @@
#include <SFML/Window/Sensor.hpp>
////////////////////////////////////////////////////////////
const unsigned int sfSensorCount = sfSensorOrientation + 1;
////////////////////////////////////////////////////////////
bool sfSensor_isAvailable(sfSensorType sensor)
{
+2 -2
View File
@@ -14,7 +14,7 @@ TEST_CASE("[Window] sfKeyboard")
STATIC_CHECK(sfKeyC == static_cast<int>(sf::Keyboard::Key::C));
STATIC_CHECK(sfKeyD == static_cast<int>(sf::Keyboard::Key::D));
STATIC_CHECK(sfKeyPause == static_cast<int>(sf::Keyboard::Key::Pause));
STATIC_CHECK(sfKeyCount == sf::Keyboard::KeyCount);
CHECK(sfKeyCount == sf::Keyboard::KeyCount);
}
SECTION("sfScancode")
@@ -24,6 +24,6 @@ TEST_CASE("[Window] sfKeyboard")
STATIC_CHECK(sfScanB == static_cast<int>(sf::Keyboard::Scan::B));
STATIC_CHECK(sfScanC == static_cast<int>(sf::Keyboard::Scan::C));
STATIC_CHECK(sfScanD == static_cast<int>(sf::Keyboard::Scan::D));
STATIC_CHECK(sfScancodeCount == sf::Keyboard::ScancodeCount);
CHECK(sfScancodeCount == sf::Keyboard::ScancodeCount);
}
}
+3 -3
View File
@@ -11,9 +11,9 @@ TEST_CASE("[Window] sfMouse")
STATIC_CHECK(sfMouseLeft == static_cast<int>(sf::Mouse::Button::Left));
STATIC_CHECK(sfMouseRight == static_cast<int>(sf::Mouse::Button::Right));
STATIC_CHECK(sfMouseMiddle == static_cast<int>(sf::Mouse::Button::Middle));
STATIC_CHECK(sfMouseXButton1 == static_cast<int>(sf::Mouse::Button::Extra1));
STATIC_CHECK(sfMouseXButton2 == static_cast<int>(sf::Mouse::Button::Extra2));
STATIC_CHECK(sfMouseButtonCount == sf::Mouse::ButtonCount);
STATIC_CHECK(sfMouseButtonExtra1 == static_cast<int>(sf::Mouse::Button::Extra1));
STATIC_CHECK(sfMouseButtonExtra2 == static_cast<int>(sf::Mouse::Button::Extra2));
CHECK(sfMouseButtonCount == sf::Mouse::ButtonCount);
}
SECTION("sfMouseWheel")
+1 -1
View File
@@ -14,6 +14,6 @@ TEST_CASE("[Window] sfSensor")
STATIC_CHECK(sfSensorGravity == static_cast<int>(sf::Sensor::Type::Gravity));
STATIC_CHECK(sfSensorUserAcceleration == static_cast<int>(sf::Sensor::Type::UserAcceleration));
STATIC_CHECK(sfSensorOrientation == static_cast<int>(sf::Sensor::Type::Orientation));
STATIC_CHECK(sfSensorCount == sf::Sensor::Count);
CHECK(sfSensorCount == sf::Sensor::Count);
}
}