mirror of
https://github.com/SFML/SFML.git
synced 2025-01-31 13:45:13 +08:00
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,33 +31,29 @@
|
||||
|
||||
#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
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Constants related to joysticks capabilities
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum
|
||||
{
|
||||
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
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Axes supported by SFML joysticks
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Axis
|
||||
{
|
||||
X, //!< The X axis
|
||||
Y, //!< The Y axis
|
||||
Z, //!< The Z axis
|
||||
@ -66,115 +62,112 @@ public:
|
||||
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
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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();
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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,21 +30,18 @@
|
||||
#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
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Key codes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Key
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Key codes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Key
|
||||
{
|
||||
Unknown = -1, //!< Unhandled key
|
||||
A = 0, //!< The A key
|
||||
B, //!< The B key
|
||||
@ -149,46 +146,43 @@ public:
|
||||
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);
|
||||
};
|
||||
|
||||
} // 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,15 +40,14 @@ class WindowBase;
|
||||
/// \brief Give access to the real-time state of the mouse
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_WINDOW_API Mouse
|
||||
namespace Mouse
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Mouse buttons
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Button
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Mouse buttons
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Button
|
||||
{
|
||||
Left, //!< The left mouse button
|
||||
Right, //!< The right mouse button
|
||||
Middle, //!< The middle (wheel) mouse button
|
||||
@ -56,91 +55,90 @@ public:
|
||||
XButton2, //!< The second extra mouse button
|
||||
|
||||
ButtonCount //!< Keep last -- the total number of mouse buttons
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Mouse wheels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Wheel
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \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,22 +31,18 @@
|
||||
|
||||
#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
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Sensor type
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum Type
|
||||
{
|
||||
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)
|
||||
@ -55,56 +51,53 @@ public:
|
||||
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);
|
||||
};
|
||||
|
||||
} // 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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -7,7 +7,7 @@ int main()
|
||||
{
|
||||
// Audio
|
||||
[[maybe_unused]] sf::InputSoundFile inputSoundFile;
|
||||
[[maybe_unused]] sf::Listener listener;
|
||||
[[maybe_unused]] sf::SoundBufferRecorder soundBufferRecorder;
|
||||
[[maybe_unused]] sf::Music music;
|
||||
[[maybe_unused]] sf::Sound sound;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user