Changed to namespace
This commit is contained in:
parent
bf9f59d3e3
commit
34b6323929
@ -32,122 +32,117 @@
|
||||
#include <SFML/System/Vector3.hpp>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief The audio listener is the point in the scene
|
||||
/// from where all the sounds are heard
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_AUDIO_API Listener
|
||||
namespace sf::Listener
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the global volume of all the sounds and musics
|
||||
///
|
||||
/// The volume is a number between 0 and 100; it is combined with
|
||||
/// the individual volume of each sound / music.
|
||||
/// The default value for the volume is 100 (maximum).
|
||||
///
|
||||
/// \param volume New global volume, in the range [0, 100]
|
||||
///
|
||||
/// \see getGlobalVolume
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void setGlobalVolume(float volume);
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the global volume of all the sounds and musics
|
||||
///
|
||||
/// The volume is a number between 0 and 100; it is combined with
|
||||
/// the individual volume of each sound / music.
|
||||
/// The default value for the volume is 100 (maximum).
|
||||
///
|
||||
/// \param volume New global volume, in the range [0, 100]
|
||||
///
|
||||
/// \see getGlobalVolume
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_AUDIO_API void setGlobalVolume(float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current value of the global volume
|
||||
///
|
||||
/// \return Current global volume, in the range [0, 100]
|
||||
///
|
||||
/// \see setGlobalVolume
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static float getGlobalVolume();
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current value of the global volume
|
||||
///
|
||||
/// \return Current global volume, in the range [0, 100]
|
||||
///
|
||||
/// \see setGlobalVolume
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_AUDIO_API float getGlobalVolume();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of the listener in the scene
|
||||
///
|
||||
/// The default listener's position is (0, 0, 0).
|
||||
///
|
||||
/// \param position New listener's position
|
||||
///
|
||||
/// \see getPosition, setDirection
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void setPosition(const Vector3f& position);
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of the listener in the scene
|
||||
///
|
||||
/// The default listener's position is (0, 0, 0).
|
||||
///
|
||||
/// \param position New listener's position
|
||||
///
|
||||
/// \see getPosition, setDirection
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_AUDIO_API void setPosition(const Vector3f& position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the listener in the scene
|
||||
///
|
||||
/// \return Listener's position
|
||||
///
|
||||
/// \see setPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Vector3f getPosition();
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the listener in the scene
|
||||
///
|
||||
/// \return Listener's position
|
||||
///
|
||||
/// \see setPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_AUDIO_API Vector3f getPosition();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the forward vector of the listener in the scene
|
||||
///
|
||||
/// The direction (also called "at vector") is the vector
|
||||
/// pointing forward from the listener's perspective. Together
|
||||
/// with the up vector, it defines the 3D orientation of the
|
||||
/// listener in the scene. The direction vector doesn't
|
||||
/// have to be normalized.
|
||||
/// The default listener's direction is (0, 0, -1).
|
||||
///
|
||||
/// \param direction New listener's direction
|
||||
///
|
||||
/// \see getDirection, setUpVector, setPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void setDirection(const Vector3f& direction);
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the forward vector of the listener in the scene
|
||||
///
|
||||
/// The direction (also called "at vector") is the vector
|
||||
/// pointing forward from the listener's perspective. Together
|
||||
/// with the up vector, it defines the 3D orientation of the
|
||||
/// listener in the scene. The direction vector doesn't
|
||||
/// have to be normalized.
|
||||
/// The default listener's direction is (0, 0, -1).
|
||||
///
|
||||
/// \param direction New listener's direction
|
||||
///
|
||||
/// \see getDirection, setUpVector, setPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_AUDIO_API void setDirection(const Vector3f& direction);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current forward vector of the listener in the scene
|
||||
///
|
||||
/// \return Listener's forward vector (not normalized)
|
||||
///
|
||||
/// \see setDirection
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Vector3f getDirection();
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current forward vector of the listener in the scene
|
||||
///
|
||||
/// \return Listener's forward vector (not normalized)
|
||||
///
|
||||
/// \see setDirection
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_AUDIO_API Vector3f getDirection();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the upward vector of the listener in the scene
|
||||
///
|
||||
/// The up vector is the vector that points upward from the
|
||||
/// listener's perspective. Together with the direction, it
|
||||
/// defines the 3D orientation of the listener in the scene.
|
||||
/// The up vector doesn't have to be normalized.
|
||||
/// The default listener's up vector is (0, 1, 0). It is usually
|
||||
/// not necessary to change it, especially in 2D scenarios.
|
||||
///
|
||||
/// \param upVector New listener's up vector
|
||||
///
|
||||
/// \see getUpVector, setDirection, setPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void setUpVector(const Vector3f& upVector);
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the upward vector of the listener in the scene
|
||||
///
|
||||
/// The up vector is the vector that points upward from the
|
||||
/// listener's perspective. Together with the direction, it
|
||||
/// defines the 3D orientation of the listener in the scene.
|
||||
/// The up vector doesn't have to be normalized.
|
||||
/// The default listener's up vector is (0, 1, 0). It is usually
|
||||
/// not necessary to change it, especially in 2D scenarios.
|
||||
///
|
||||
/// \param upVector New listener's up vector
|
||||
///
|
||||
/// \see getUpVector, setDirection, setPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_AUDIO_API void setUpVector(const Vector3f& upVector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current upward vector of the listener in the scene
|
||||
///
|
||||
/// \return Listener's upward vector (not normalized)
|
||||
///
|
||||
/// \see setUpVector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Vector3f getUpVector();
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current upward vector of the listener in the scene
|
||||
///
|
||||
/// \return Listener's upward vector (not normalized)
|
||||
///
|
||||
/// \see setUpVector
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_AUDIO_API Vector3f getUpVector();
|
||||
} // namespace sf::Listener
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Listener
|
||||
/// \namespace sf::Listener
|
||||
/// \ingroup audio
|
||||
///
|
||||
/// The audio listener defines the global properties of the
|
||||
@ -160,9 +155,6 @@ public:
|
||||
/// listener in the 3D audio environment (position, direction and
|
||||
/// up vector), and to adjust the global volume.
|
||||
///
|
||||
/// Because the listener is unique in the scene, sf::Listener only
|
||||
/// contains static functions and doesn't have to be instantiated.
|
||||
///
|
||||
/// Usage example:
|
||||
/// \code
|
||||
/// // Move the listener to the position (1, 0, -5)
|
||||
|
@ -38,44 +38,43 @@ class String;
|
||||
/// \brief Give access to the system clipboard
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_WINDOW_API Clipboard
|
||||
namespace Clipboard
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the content of the clipboard as string data
|
||||
///
|
||||
/// This function returns the content of the clipboard
|
||||
/// as a string. If the clipboard does not contain string
|
||||
/// it returns an empty sf::String object.
|
||||
///
|
||||
/// \return Clipboard contents as sf::String object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static String getString();
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the content of the clipboard as string data
|
||||
///
|
||||
/// This function returns the content of the clipboard
|
||||
/// as a string. If the clipboard does not contain string
|
||||
/// it returns an empty sf::String object.
|
||||
///
|
||||
/// \return Clipboard contents as sf::String object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API String getString();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the content of the clipboard as string data
|
||||
///
|
||||
/// This function sets the content of the clipboard as a
|
||||
/// string.
|
||||
///
|
||||
/// \warning Due to limitations on some operating systems,
|
||||
/// setting the clipboard contents is only
|
||||
/// guaranteed to work if there is currently an
|
||||
/// open window for which events are being handled.
|
||||
///
|
||||
/// \param text sf::String containing the data to be sent
|
||||
/// to the clipboard
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void setString(const String& text);
|
||||
};
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the content of the clipboard as string data
|
||||
///
|
||||
/// This function sets the content of the clipboard as a
|
||||
/// string.
|
||||
///
|
||||
/// \warning Due to limitations on some operating systems,
|
||||
/// setting the clipboard contents is only
|
||||
/// guaranteed to work if there is currently an
|
||||
/// open window for which events are being handled.
|
||||
///
|
||||
/// \param text sf::String containing the data to be sent
|
||||
/// to the clipboard
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API void setString(const String& text);
|
||||
} // namespace Clipboard
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Clipboard
|
||||
/// \namespace sf::Clipboard
|
||||
/// \ingroup window
|
||||
///
|
||||
/// sf::Clipboard provides an interface for getting and
|
||||
|
@ -31,150 +31,143 @@
|
||||
|
||||
#include <SFML/System/String.hpp>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Give access to the real-time state of the joysticks
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_WINDOW_API Joystick
|
||||
namespace sf::Joystick
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Constants related to joysticks capabilities
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum
|
||||
{
|
||||
Count = 8, //!< Maximum number of supported joysticks
|
||||
ButtonCount = 32, //!< Maximum number of supported buttons
|
||||
AxisCount = 8 //!< Maximum number of supported axes
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Axes supported by SFML joysticks
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Axis
|
||||
{
|
||||
X, //!< The X axis
|
||||
Y, //!< The Y axis
|
||||
Z, //!< The Z axis
|
||||
R, //!< The R axis
|
||||
U, //!< The U axis
|
||||
V, //!< The V axis
|
||||
PovX, //!< The X axis of the point-of-view hat
|
||||
PovY //!< The Y axis of the point-of-view hat
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Structure holding a joystick's identification
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
struct SFML_WINDOW_API Identification
|
||||
{
|
||||
String name{"No Joystick"}; //!< Name of the joystick
|
||||
unsigned int vendorId{0}; //!< Manufacturer identifier
|
||||
unsigned int productId{0}; //!< Product identifier
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a joystick is connected
|
||||
///
|
||||
/// \param joystick Index of the joystick to check
|
||||
///
|
||||
/// \return True if the joystick is connected, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool isConnected(unsigned int joystick);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the number of buttons supported by a joystick
|
||||
///
|
||||
/// If the joystick is not connected, this function returns 0.
|
||||
///
|
||||
/// \param joystick Index of the joystick
|
||||
///
|
||||
/// \return Number of buttons supported by the joystick
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static unsigned int getButtonCount(unsigned int joystick);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a joystick supports a given axis
|
||||
///
|
||||
/// If the joystick is not connected, this function returns false.
|
||||
///
|
||||
/// \param joystick Index of the joystick
|
||||
/// \param axis Axis to check
|
||||
///
|
||||
/// \return True if the joystick supports the axis, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool hasAxis(unsigned int joystick, Axis axis);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a joystick button is pressed
|
||||
///
|
||||
/// If the joystick is not connected, this function returns false.
|
||||
///
|
||||
/// \param joystick Index of the joystick
|
||||
/// \param button Button to check
|
||||
///
|
||||
/// \return True if the button is pressed, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool isButtonPressed(unsigned int joystick, unsigned int button);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of a joystick axis
|
||||
///
|
||||
/// If the joystick is not connected, this function returns 0.
|
||||
///
|
||||
/// \param joystick Index of the joystick
|
||||
/// \param axis Axis to check
|
||||
///
|
||||
/// \return Current position of the axis, in range [-100 .. 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static float getAxisPosition(unsigned int joystick, Axis axis);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the joystick information
|
||||
///
|
||||
/// \param joystick Index of the joystick
|
||||
///
|
||||
/// \return Structure containing joystick information.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Identification getIdentification(unsigned int joystick);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the states of all joysticks
|
||||
///
|
||||
/// This function is used internally by SFML, so you normally
|
||||
/// don't have to call it explicitly. However, you may need to
|
||||
/// call it if you have no window yet (or no window at all):
|
||||
/// in this case the joystick states are not updated automatically.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void update();
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Constants related to joysticks capabilities
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum
|
||||
{
|
||||
Count = 8, //!< Maximum number of supported joysticks
|
||||
ButtonCount = 32, //!< Maximum number of supported buttons
|
||||
AxisCount = 8 //!< Maximum number of supported axes
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Axes supported by SFML joysticks
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Axis
|
||||
{
|
||||
X, //!< The X axis
|
||||
Y, //!< The Y axis
|
||||
Z, //!< The Z axis
|
||||
R, //!< The R axis
|
||||
U, //!< The U axis
|
||||
V, //!< The V axis
|
||||
PovX, //!< The X axis of the point-of-view hat
|
||||
PovY //!< The Y axis of the point-of-view hat
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Structure holding a joystick's identification
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
struct SFML_WINDOW_API Identification
|
||||
{
|
||||
String name{"No Joystick"}; //!< Name of the joystick
|
||||
unsigned int vendorId{0}; //!< Manufacturer identifier
|
||||
unsigned int productId{0}; //!< Product identifier
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a joystick is connected
|
||||
///
|
||||
/// \param joystick Index of the joystick to check
|
||||
///
|
||||
/// \return True if the joystick is connected, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API bool isConnected(unsigned int joystick);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the number of buttons supported by a joystick
|
||||
///
|
||||
/// If the joystick is not connected, this function returns 0.
|
||||
///
|
||||
/// \param joystick Index of the joystick
|
||||
///
|
||||
/// \return Number of buttons supported by the joystick
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API unsigned int getButtonCount(unsigned int joystick);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a joystick supports a given axis
|
||||
///
|
||||
/// If the joystick is not connected, this function returns false.
|
||||
///
|
||||
/// \param joystick Index of the joystick
|
||||
/// \param axis Axis to check
|
||||
///
|
||||
/// \return True if the joystick supports the axis, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API bool hasAxis(unsigned int joystick, Axis axis);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a joystick button is pressed
|
||||
///
|
||||
/// If the joystick is not connected, this function returns false.
|
||||
///
|
||||
/// \param joystick Index of the joystick
|
||||
/// \param button Button to check
|
||||
///
|
||||
/// \return True if the button is pressed, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API bool isButtonPressed(unsigned int joystick, unsigned int button);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of a joystick axis
|
||||
///
|
||||
/// If the joystick is not connected, this function returns 0.
|
||||
///
|
||||
/// \param joystick Index of the joystick
|
||||
/// \param axis Axis to check
|
||||
///
|
||||
/// \return Current position of the axis, in range [-100 .. 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API float getAxisPosition(unsigned int joystick, Axis axis);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the joystick information
|
||||
///
|
||||
/// \param joystick Index of the joystick
|
||||
///
|
||||
/// \return Structure containing joystick information.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API Identification getIdentification(unsigned int joystick);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the states of all joysticks
|
||||
///
|
||||
/// This function is used internally by SFML, so you normally
|
||||
/// don't have to call it explicitly. However, you may need to
|
||||
/// call it if you have no window yet (or no window at all):
|
||||
/// in this case the joystick states are not updated automatically.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API void update();
|
||||
} // namespace sf::Joystick
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Joystick
|
||||
/// \namespace sf::Joystick
|
||||
/// \ingroup window
|
||||
///
|
||||
/// sf::Joystick provides an interface to the state of the
|
||||
/// joysticks. It only contains static functions, so it's not
|
||||
/// meant to be instantiated. Instead, each joystick is identified
|
||||
/// by an index that is passed to the functions of this class.
|
||||
/// joysticks. Each joystick is identified by an index that
|
||||
/// is passed to the functions in this namespace.
|
||||
///
|
||||
/// This class allows users to query the state of joysticks at any
|
||||
/// This namespace allows users to query the state of joysticks at any
|
||||
/// time and directly, without having to deal with a window and
|
||||
/// its events. Compared to the JoystickMoved, JoystickButtonPressed
|
||||
/// and JoystickButtonReleased events, sf::Joystick can retrieve the
|
||||
|
@ -30,165 +30,159 @@
|
||||
#include <SFML/Window/Export.hpp>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Give access to the real-time state of the keyboard
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_WINDOW_API Keyboard
|
||||
namespace sf::Keyboard
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Key codes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Key
|
||||
{
|
||||
Unknown = -1, //!< Unhandled key
|
||||
A = 0, //!< The A key
|
||||
B, //!< The B key
|
||||
C, //!< The C key
|
||||
D, //!< The D key
|
||||
E, //!< The E key
|
||||
F, //!< The F key
|
||||
G, //!< The G key
|
||||
H, //!< The H key
|
||||
I, //!< The I key
|
||||
J, //!< The J key
|
||||
K, //!< The K key
|
||||
L, //!< The L key
|
||||
M, //!< The M key
|
||||
N, //!< The N key
|
||||
O, //!< The O key
|
||||
P, //!< The P key
|
||||
Q, //!< The Q key
|
||||
R, //!< The R key
|
||||
S, //!< The S key
|
||||
T, //!< The T key
|
||||
U, //!< The U key
|
||||
V, //!< The V key
|
||||
W, //!< The W key
|
||||
X, //!< The X key
|
||||
Y, //!< The Y key
|
||||
Z, //!< The Z key
|
||||
Num0, //!< The 0 key
|
||||
Num1, //!< The 1 key
|
||||
Num2, //!< The 2 key
|
||||
Num3, //!< The 3 key
|
||||
Num4, //!< The 4 key
|
||||
Num5, //!< The 5 key
|
||||
Num6, //!< The 6 key
|
||||
Num7, //!< The 7 key
|
||||
Num8, //!< The 8 key
|
||||
Num9, //!< The 9 key
|
||||
Escape, //!< The Escape key
|
||||
LControl, //!< The left Control key
|
||||
LShift, //!< The left Shift key
|
||||
LAlt, //!< The left Alt key
|
||||
LSystem, //!< The left OS specific key: window (Windows and Linux), apple (MacOS X), ...
|
||||
RControl, //!< The right Control key
|
||||
RShift, //!< The right Shift key
|
||||
RAlt, //!< The right Alt key
|
||||
RSystem, //!< The right OS specific key: window (Windows and Linux), apple (MacOS X), ...
|
||||
Menu, //!< The Menu key
|
||||
LBracket, //!< The [ key
|
||||
RBracket, //!< The ] key
|
||||
Semicolon, //!< The ; key
|
||||
Comma, //!< The , key
|
||||
Period, //!< The . key
|
||||
Quote, //!< The ' key
|
||||
Slash, //!< The / key
|
||||
Backslash, //!< The \ key
|
||||
Tilde, //!< The ~ key
|
||||
Equal, //!< The = key
|
||||
Hyphen, //!< The - key (hyphen)
|
||||
Space, //!< The Space key
|
||||
Enter, //!< The Enter/Return keys
|
||||
Backspace, //!< The Backspace key
|
||||
Tab, //!< The Tabulation key
|
||||
PageUp, //!< The Page up key
|
||||
PageDown, //!< The Page down key
|
||||
End, //!< The End key
|
||||
Home, //!< The Home key
|
||||
Insert, //!< The Insert key
|
||||
Delete, //!< The Delete key
|
||||
Add, //!< The + key
|
||||
Subtract, //!< The - key (minus, usually from numpad)
|
||||
Multiply, //!< The * key
|
||||
Divide, //!< The / key
|
||||
Left, //!< Left arrow
|
||||
Right, //!< Right arrow
|
||||
Up, //!< Up arrow
|
||||
Down, //!< Down arrow
|
||||
Numpad0, //!< The numpad 0 key
|
||||
Numpad1, //!< The numpad 1 key
|
||||
Numpad2, //!< The numpad 2 key
|
||||
Numpad3, //!< The numpad 3 key
|
||||
Numpad4, //!< The numpad 4 key
|
||||
Numpad5, //!< The numpad 5 key
|
||||
Numpad6, //!< The numpad 6 key
|
||||
Numpad7, //!< The numpad 7 key
|
||||
Numpad8, //!< The numpad 8 key
|
||||
Numpad9, //!< The numpad 9 key
|
||||
F1, //!< The F1 key
|
||||
F2, //!< The F2 key
|
||||
F3, //!< The F3 key
|
||||
F4, //!< The F4 key
|
||||
F5, //!< The F5 key
|
||||
F6, //!< The F6 key
|
||||
F7, //!< The F7 key
|
||||
F8, //!< The F8 key
|
||||
F9, //!< The F9 key
|
||||
F10, //!< The F10 key
|
||||
F11, //!< The F11 key
|
||||
F12, //!< The F12 key
|
||||
F13, //!< The F13 key
|
||||
F14, //!< The F14 key
|
||||
F15, //!< The F15 key
|
||||
Pause, //!< The Pause key
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Key codes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Key
|
||||
{
|
||||
Unknown = -1, //!< Unhandled key
|
||||
A = 0, //!< The A key
|
||||
B, //!< The B key
|
||||
C, //!< The C key
|
||||
D, //!< The D key
|
||||
E, //!< The E key
|
||||
F, //!< The F key
|
||||
G, //!< The G key
|
||||
H, //!< The H key
|
||||
I, //!< The I key
|
||||
J, //!< The J key
|
||||
K, //!< The K key
|
||||
L, //!< The L key
|
||||
M, //!< The M key
|
||||
N, //!< The N key
|
||||
O, //!< The O key
|
||||
P, //!< The P key
|
||||
Q, //!< The Q key
|
||||
R, //!< The R key
|
||||
S, //!< The S key
|
||||
T, //!< The T key
|
||||
U, //!< The U key
|
||||
V, //!< The V key
|
||||
W, //!< The W key
|
||||
X, //!< The X key
|
||||
Y, //!< The Y key
|
||||
Z, //!< The Z key
|
||||
Num0, //!< The 0 key
|
||||
Num1, //!< The 1 key
|
||||
Num2, //!< The 2 key
|
||||
Num3, //!< The 3 key
|
||||
Num4, //!< The 4 key
|
||||
Num5, //!< The 5 key
|
||||
Num6, //!< The 6 key
|
||||
Num7, //!< The 7 key
|
||||
Num8, //!< The 8 key
|
||||
Num9, //!< The 9 key
|
||||
Escape, //!< The Escape key
|
||||
LControl, //!< The left Control key
|
||||
LShift, //!< The left Shift key
|
||||
LAlt, //!< The left Alt key
|
||||
LSystem, //!< The left OS specific key: window (Windows and Linux), apple (MacOS X), ...
|
||||
RControl, //!< The right Control key
|
||||
RShift, //!< The right Shift key
|
||||
RAlt, //!< The right Alt key
|
||||
RSystem, //!< The right OS specific key: window (Windows and Linux), apple (MacOS X), ...
|
||||
Menu, //!< The Menu key
|
||||
LBracket, //!< The [ key
|
||||
RBracket, //!< The ] key
|
||||
Semicolon, //!< The ; key
|
||||
Comma, //!< The , key
|
||||
Period, //!< The . key
|
||||
Quote, //!< The ' key
|
||||
Slash, //!< The / key
|
||||
Backslash, //!< The \ key
|
||||
Tilde, //!< The ~ key
|
||||
Equal, //!< The = key
|
||||
Hyphen, //!< The - key (hyphen)
|
||||
Space, //!< The Space key
|
||||
Enter, //!< The Enter/Return keys
|
||||
Backspace, //!< The Backspace key
|
||||
Tab, //!< The Tabulation key
|
||||
PageUp, //!< The Page up key
|
||||
PageDown, //!< The Page down key
|
||||
End, //!< The End key
|
||||
Home, //!< The Home key
|
||||
Insert, //!< The Insert key
|
||||
Delete, //!< The Delete key
|
||||
Add, //!< The + key
|
||||
Subtract, //!< The - key (minus, usually from numpad)
|
||||
Multiply, //!< The * key
|
||||
Divide, //!< The / key
|
||||
Left, //!< Left arrow
|
||||
Right, //!< Right arrow
|
||||
Up, //!< Up arrow
|
||||
Down, //!< Down arrow
|
||||
Numpad0, //!< The numpad 0 key
|
||||
Numpad1, //!< The numpad 1 key
|
||||
Numpad2, //!< The numpad 2 key
|
||||
Numpad3, //!< The numpad 3 key
|
||||
Numpad4, //!< The numpad 4 key
|
||||
Numpad5, //!< The numpad 5 key
|
||||
Numpad6, //!< The numpad 6 key
|
||||
Numpad7, //!< The numpad 7 key
|
||||
Numpad8, //!< The numpad 8 key
|
||||
Numpad9, //!< The numpad 9 key
|
||||
F1, //!< The F1 key
|
||||
F2, //!< The F2 key
|
||||
F3, //!< The F3 key
|
||||
F4, //!< The F4 key
|
||||
F5, //!< The F5 key
|
||||
F6, //!< The F6 key
|
||||
F7, //!< The F7 key
|
||||
F8, //!< The F8 key
|
||||
F9, //!< The F9 key
|
||||
F10, //!< The F10 key
|
||||
F11, //!< The F11 key
|
||||
F12, //!< The F12 key
|
||||
F13, //!< The F13 key
|
||||
F14, //!< The F14 key
|
||||
F15, //!< The F15 key
|
||||
Pause, //!< The Pause key
|
||||
|
||||
KeyCount //!< Keep last -- the total number of keyboard keys
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a key is pressed
|
||||
///
|
||||
/// \param key Key to check
|
||||
///
|
||||
/// \return True if the key is pressed, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool isKeyPressed(Key key);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Show or hide the virtual keyboard
|
||||
///
|
||||
/// Warning: the virtual keyboard is not supported on all
|
||||
/// systems. It will typically be implemented on mobile OSes
|
||||
/// (Android, iOS) but not on desktop OSes (Windows, Linux, ...).
|
||||
///
|
||||
/// If the virtual keyboard is not available, this function does
|
||||
/// nothing.
|
||||
///
|
||||
/// \param visible True to show, false to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void setVirtualKeyboardVisible(bool visible);
|
||||
KeyCount //!< Keep last -- the total number of keyboard keys
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a key is pressed
|
||||
///
|
||||
/// \param key Key to check
|
||||
///
|
||||
/// \return True if the key is pressed, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API bool isKeyPressed(Key key);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Show or hide the virtual keyboard
|
||||
///
|
||||
/// Warning: the virtual keyboard is not supported on all
|
||||
/// systems. It will typically be implemented on mobile OSes
|
||||
/// (Android, iOS) but not on desktop OSes (Windows, Linux, ...).
|
||||
///
|
||||
/// If the virtual keyboard is not available, this function does
|
||||
/// nothing.
|
||||
///
|
||||
/// \param visible True to show, false to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API void setVirtualKeyboardVisible(bool visible);
|
||||
} // namespace sf::Keyboard
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Keyboard
|
||||
/// \namespace sf::Keyboard
|
||||
/// \ingroup window
|
||||
///
|
||||
/// sf::Keyboard provides an interface to the state of the
|
||||
/// keyboard. It only contains static functions (a single
|
||||
/// keyboard is assumed), so it's not meant to be instantiated.
|
||||
/// keyboard.
|
||||
///
|
||||
/// This class allows users to query the keyboard state at any
|
||||
/// This namespace allows users to query the keyboard state at any
|
||||
/// time and directly, without having to deal with a window and
|
||||
/// its events. Compared to the KeyPressed and KeyReleased events,
|
||||
/// sf::Keyboard can retrieve the state of a key at any time
|
||||
|
@ -40,107 +40,105 @@ class WindowBase;
|
||||
/// \brief Give access to the real-time state of the mouse
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_WINDOW_API Mouse
|
||||
namespace Mouse
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Mouse buttons
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Button
|
||||
{
|
||||
Left, //!< The left mouse button
|
||||
Right, //!< The right mouse button
|
||||
Middle, //!< The middle (wheel) mouse button
|
||||
XButton1, //!< The first extra mouse button
|
||||
XButton2, //!< The second extra mouse button
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Mouse buttons
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Button
|
||||
{
|
||||
Left, //!< The left mouse button
|
||||
Right, //!< The right mouse button
|
||||
Middle, //!< The middle (wheel) mouse button
|
||||
XButton1, //!< The first extra mouse button
|
||||
XButton2, //!< The second extra mouse button
|
||||
|
||||
ButtonCount //!< Keep last -- the total number of mouse buttons
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Mouse wheels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Wheel
|
||||
{
|
||||
VerticalWheel, //!< The vertical mouse wheel
|
||||
HorizontalWheel //!< The horizontal mouse wheel
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a mouse button is pressed
|
||||
///
|
||||
/// \warning Checking the state of buttons Mouse::XButton1 and
|
||||
/// Mouse::XButton2 is not supported on Linux with X11.
|
||||
///
|
||||
/// \param button Button to check
|
||||
///
|
||||
/// \return True if the button is pressed, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool isButtonPressed(Button button);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the mouse in desktop coordinates
|
||||
///
|
||||
/// This function returns the global position of the mouse
|
||||
/// cursor on the desktop.
|
||||
///
|
||||
/// \return Current position of the mouse
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Vector2i getPosition();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the mouse in window coordinates
|
||||
///
|
||||
/// This function returns the current position of the mouse
|
||||
/// cursor, relative to the given window.
|
||||
///
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Current position of the mouse
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Vector2i getPosition(const WindowBase& relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the current position of the mouse in desktop coordinates
|
||||
///
|
||||
/// This function sets the global position of the mouse
|
||||
/// cursor on the desktop.
|
||||
///
|
||||
/// \param position New position of the mouse
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void setPosition(const Vector2i& position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the current position of the mouse in window coordinates
|
||||
///
|
||||
/// This function sets the current position of the mouse
|
||||
/// cursor, relative to the given window.
|
||||
///
|
||||
/// \param position New position of the mouse
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void setPosition(const Vector2i& position, const WindowBase& relativeTo);
|
||||
ButtonCount //!< Keep last -- the total number of mouse buttons
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Mouse wheels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Wheel
|
||||
{
|
||||
VerticalWheel, //!< The vertical mouse wheel
|
||||
HorizontalWheel //!< The horizontal mouse wheel
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a mouse button is pressed
|
||||
///
|
||||
/// \warning Checking the state of buttons Mouse::XButton1 and
|
||||
/// Mouse::XButton2 is not supported on Linux with X11.
|
||||
///
|
||||
/// \param button Button to check
|
||||
///
|
||||
/// \return True if the button is pressed, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API bool isButtonPressed(Button button);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the mouse in desktop coordinates
|
||||
///
|
||||
/// This function returns the global position of the mouse
|
||||
/// cursor on the desktop.
|
||||
///
|
||||
/// \return Current position of the mouse
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API Vector2i getPosition();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the mouse in window coordinates
|
||||
///
|
||||
/// This function returns the current position of the mouse
|
||||
/// cursor, relative to the given window.
|
||||
///
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Current position of the mouse
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API Vector2i getPosition(const WindowBase& relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the current position of the mouse in desktop coordinates
|
||||
///
|
||||
/// This function sets the global position of the mouse
|
||||
/// cursor on the desktop.
|
||||
///
|
||||
/// \param position New position of the mouse
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API void setPosition(const Vector2i& position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the current position of the mouse in window coordinates
|
||||
///
|
||||
/// This function sets the current position of the mouse
|
||||
/// cursor, relative to the given window.
|
||||
///
|
||||
/// \param position New position of the mouse
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API void setPosition(const Vector2i& position, const WindowBase& relativeTo);
|
||||
} // namespace Mouse
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Mouse
|
||||
/// \namespace sf::Mouse
|
||||
/// \ingroup window
|
||||
///
|
||||
/// sf::Mouse provides an interface to the state of the
|
||||
/// mouse. It only contains static functions (a single
|
||||
/// mouse is assumed), so it's not meant to be instantiated.
|
||||
/// mouse. A single mouse is assumed.
|
||||
///
|
||||
/// This class allows users to query the mouse state at any
|
||||
/// This namespace allows users to query the mouse state at any
|
||||
/// time and directly, without having to deal with a window and
|
||||
/// its events. Compared to the MouseMoved, MouseButtonPressed
|
||||
/// and MouseButtonReleased events, sf::Mouse can retrieve the
|
||||
|
@ -31,80 +31,73 @@
|
||||
|
||||
#include <SFML/System/Vector3.hpp>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Give access to the real-time state of the sensors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_WINDOW_API Sensor
|
||||
namespace sf::Sensor
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Sensor type
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Type
|
||||
{
|
||||
Accelerometer, //!< Measures the raw acceleration (m/s^2)
|
||||
Gyroscope, //!< Measures the raw rotation rates (degrees/s)
|
||||
Magnetometer, //!< Measures the ambient magnetic field (micro-teslas)
|
||||
Gravity, //!< Measures the direction and intensity of gravity, independent of device acceleration (m/s^2)
|
||||
UserAcceleration, //!< Measures the direction and intensity of device acceleration, independent of the gravity (m/s^2)
|
||||
Orientation, //!< Measures the absolute 3D orientation (degrees)
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Sensor type
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Type
|
||||
{
|
||||
Accelerometer, //!< Measures the raw acceleration (m/s^2)
|
||||
Gyroscope, //!< Measures the raw rotation rates (degrees/s)
|
||||
Magnetometer, //!< Measures the ambient magnetic field (micro-teslas)
|
||||
Gravity, //!< Measures the direction and intensity of gravity, independent of device acceleration (m/s^2)
|
||||
UserAcceleration, //!< Measures the direction and intensity of device acceleration, independent of the gravity (m/s^2)
|
||||
Orientation, //!< Measures the absolute 3D orientation (degrees)
|
||||
|
||||
Count //!< Keep last -- the total number of sensor types
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a sensor is available on the underlying platform
|
||||
///
|
||||
/// \param sensor Sensor to check
|
||||
///
|
||||
/// \return True if the sensor is available, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool isAvailable(Type sensor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable a sensor
|
||||
///
|
||||
/// All sensors are disabled by default, to avoid consuming too
|
||||
/// much battery power. Once a sensor is enabled, it starts
|
||||
/// sending events of the corresponding type.
|
||||
///
|
||||
/// This function does nothing if the sensor is unavailable.
|
||||
///
|
||||
/// \param sensor Sensor to enable
|
||||
/// \param enabled True to enable, false to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static void setEnabled(Type sensor, bool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current sensor value
|
||||
///
|
||||
/// \param sensor Sensor to read
|
||||
///
|
||||
/// \return The current sensor value
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Vector3f getValue(Type sensor);
|
||||
Count //!< Keep last -- the total number of sensor types
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a sensor is available on the underlying platform
|
||||
///
|
||||
/// \param sensor Sensor to check
|
||||
///
|
||||
/// \return True if the sensor is available, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API bool isAvailable(Type sensor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable a sensor
|
||||
///
|
||||
/// All sensors are disabled by default, to avoid consuming too
|
||||
/// much battery power. Once a sensor is enabled, it starts
|
||||
/// sending events of the corresponding type.
|
||||
///
|
||||
/// This function does nothing if the sensor is unavailable.
|
||||
///
|
||||
/// \param sensor Sensor to enable
|
||||
/// \param enabled True to enable, false to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API void setEnabled(Type sensor, bool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current sensor value
|
||||
///
|
||||
/// \param sensor Sensor to read
|
||||
///
|
||||
/// \return The current sensor value
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API Vector3f getValue(Type sensor);
|
||||
} // namespace sf::Sensor
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Sensor
|
||||
/// \namespace sf::Sensor
|
||||
/// \ingroup window
|
||||
///
|
||||
/// sf::Sensor provides an interface to the state of the
|
||||
/// various sensors that a device provides. It only contains static
|
||||
/// functions, so it's not meant to be instantiated.
|
||||
/// various sensors that a device provides.
|
||||
///
|
||||
/// This class allows users to query the sensors values at any
|
||||
/// This namespace allows users to query the sensors values at any
|
||||
/// time and directly, without having to deal with a window and
|
||||
/// its events. Compared to the SensorChanged event, sf::Sensor
|
||||
/// can retrieve the state of a sensor at any time (you don't need to
|
||||
|
@ -40,59 +40,57 @@ class WindowBase;
|
||||
/// \brief Give access to the real-time state of the touches
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_WINDOW_API Touch
|
||||
namespace Touch
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a touch event is currently down
|
||||
///
|
||||
/// \param finger Finger index
|
||||
///
|
||||
/// \return True if \a finger is currently touching the screen, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool isDown(unsigned int finger);
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a touch event is currently down
|
||||
///
|
||||
/// \param finger Finger index
|
||||
///
|
||||
/// \return True if \a finger is currently touching the screen, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API bool isDown(unsigned int finger);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of a touch in desktop coordinates
|
||||
///
|
||||
/// This function returns the current touch position
|
||||
/// in global (desktop) coordinates.
|
||||
///
|
||||
/// \param finger Finger index
|
||||
///
|
||||
/// \return Current position of \a finger, or undefined if it's not down
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Vector2i getPosition(unsigned int finger);
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of a touch in desktop coordinates
|
||||
///
|
||||
/// This function returns the current touch position
|
||||
/// in global (desktop) coordinates.
|
||||
///
|
||||
/// \param finger Finger index
|
||||
///
|
||||
/// \return Current position of \a finger, or undefined if it's not down
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API Vector2i getPosition(unsigned int finger);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of a touch in window coordinates
|
||||
///
|
||||
/// This function returns the current touch position
|
||||
/// relative to the given window.
|
||||
///
|
||||
/// \param finger Finger index
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Current position of \a finger, or undefined if it's not down
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static Vector2i getPosition(unsigned int finger, const WindowBase& relativeTo);
|
||||
};
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of a touch in window coordinates
|
||||
///
|
||||
/// This function returns the current touch position
|
||||
/// relative to the given window.
|
||||
///
|
||||
/// \param finger Finger index
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Current position of \a finger, or undefined if it's not down
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API Vector2i getPosition(unsigned int finger, const WindowBase& relativeTo);
|
||||
} // namespace Touch
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Touch
|
||||
/// \namespace sf::Touch
|
||||
/// \ingroup window
|
||||
///
|
||||
/// sf::Touch provides an interface to the state of the
|
||||
/// touches. It only contains static functions, so it's not
|
||||
/// meant to be instantiated.
|
||||
/// touches.
|
||||
///
|
||||
/// This class allows users to query the touches state at any
|
||||
/// This namespace allows users to query the touches state at any
|
||||
/// time and directly, without having to deal with a window and
|
||||
/// its events. Compared to the TouchBegan, TouchMoved
|
||||
/// and TouchEnded events, sf::Touch can retrieve the
|
||||
|
@ -58,53 +58,53 @@ using VulkanFunctionPointer = void (*)();
|
||||
/// \brief Vulkan helper functions
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_WINDOW_API Vulkan
|
||||
namespace Vulkan
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether or not the system supports Vulkan
|
||||
///
|
||||
/// This function should always be called before using
|
||||
/// the Vulkan features. If it returns false, then
|
||||
/// any attempt to use Vulkan will fail.
|
||||
///
|
||||
/// If only compute is required, set \a requireGraphics
|
||||
/// to false to skip checking for the extensions necessary
|
||||
/// for graphics rendering.
|
||||
///
|
||||
/// \param requireGraphics
|
||||
///
|
||||
/// \return True if Vulkan is supported, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool isAvailable(bool requireGraphics = true);
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether or not the system supports Vulkan
|
||||
///
|
||||
/// This function should always be called before using
|
||||
/// the Vulkan features. If it returns false, then
|
||||
/// any attempt to use Vulkan will fail.
|
||||
///
|
||||
/// If only compute is required, set \a requireGraphics
|
||||
/// to false to skip checking for the extensions necessary
|
||||
/// for graphics rendering.
|
||||
///
|
||||
/// \param requireGraphics
|
||||
///
|
||||
/// \return True if Vulkan is supported, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API bool isAvailable(bool requireGraphics = true);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the address of a Vulkan function
|
||||
///
|
||||
/// \param name Name of the function to get the address of
|
||||
///
|
||||
/// \return Address of the Vulkan function, 0 on failure
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static VulkanFunctionPointer getFunction(const char* name);
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the address of a Vulkan function
|
||||
///
|
||||
/// \param name Name of the function to get the address of
|
||||
///
|
||||
/// \return Address of the Vulkan function, 0 on failure
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API VulkanFunctionPointer getFunction(const char* name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get Vulkan instance extensions required for graphics
|
||||
///
|
||||
/// \return Vulkan instance extensions required for graphics
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static const std::vector<const char*>& getGraphicsRequiredInstanceExtensions();
|
||||
};
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get Vulkan instance extensions required for graphics
|
||||
///
|
||||
/// \return Vulkan instance extensions required for graphics
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
SFML_WINDOW_API const std::vector<const char*>& getGraphicsRequiredInstanceExtensions();
|
||||
} // namespace Vulkan
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Vulkan
|
||||
/// \namespace sf::Vulkan
|
||||
/// \ingroup window
|
||||
///
|
||||
///
|
||||
/// This namespace contains functions to help you use SFML
|
||||
/// for windowing and write your own Vulkan code for graphics
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -6,10 +6,10 @@
|
||||
int main()
|
||||
{
|
||||
// Audio
|
||||
[[maybe_unused]] sf::InputSoundFile inputSoundFile;
|
||||
[[maybe_unused]] sf::Listener listener;
|
||||
[[maybe_unused]] sf::Music music;
|
||||
[[maybe_unused]] sf::Sound sound;
|
||||
[[maybe_unused]] sf::InputSoundFile inputSoundFile;
|
||||
[[maybe_unused]] sf::SoundBufferRecorder soundBufferRecorder;
|
||||
[[maybe_unused]] sf::Music music;
|
||||
[[maybe_unused]] sf::Sound sound;
|
||||
|
||||
// Graphics
|
||||
[[maybe_unused]] sf::Color color;
|
||||
|
Loading…
Reference in New Issue
Block a user