Changed to namespace

This commit is contained in:
Jim-Marsden 2022-12-27 10:14:15 -08:00 committed by Chris Thrasher
parent bf9f59d3e3
commit 34b6323929
9 changed files with 606 additions and 639 deletions

View File

@ -32,16 +32,13 @@
#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
///
@ -54,7 +51,7 @@ public:
/// \see getGlobalVolume
///
////////////////////////////////////////////////////////////
static void setGlobalVolume(float volume);
SFML_AUDIO_API void setGlobalVolume(float volume);
////////////////////////////////////////////////////////////
/// \brief Get the current value of the global volume
@ -64,7 +61,7 @@ public:
/// \see setGlobalVolume
///
////////////////////////////////////////////////////////////
static float getGlobalVolume();
SFML_AUDIO_API float getGlobalVolume();
////////////////////////////////////////////////////////////
/// \brief Set the position of the listener in the scene
@ -76,7 +73,7 @@ public:
/// \see getPosition, setDirection
///
////////////////////////////////////////////////////////////
static void setPosition(const Vector3f& position);
SFML_AUDIO_API void setPosition(const Vector3f& position);
////////////////////////////////////////////////////////////
/// \brief Get the current position of the listener in the scene
@ -86,7 +83,7 @@ public:
/// \see setPosition
///
////////////////////////////////////////////////////////////
static Vector3f getPosition();
SFML_AUDIO_API Vector3f getPosition();
////////////////////////////////////////////////////////////
/// \brief Set the forward vector of the listener in the scene
@ -103,7 +100,7 @@ public:
/// \see getDirection, setUpVector, setPosition
///
////////////////////////////////////////////////////////////
static void setDirection(const Vector3f& direction);
SFML_AUDIO_API void setDirection(const Vector3f& direction);
////////////////////////////////////////////////////////////
/// \brief Get the current forward vector of the listener in the scene
@ -113,7 +110,7 @@ public:
/// \see setDirection
///
////////////////////////////////////////////////////////////
static Vector3f getDirection();
SFML_AUDIO_API Vector3f getDirection();
////////////////////////////////////////////////////////////
/// \brief Set the upward vector of the listener in the scene
@ -130,7 +127,7 @@ public:
/// \see getUpVector, setDirection, setPosition
///
////////////////////////////////////////////////////////////
static void setUpVector(const Vector3f& upVector);
SFML_AUDIO_API void setUpVector(const Vector3f& upVector);
////////////////////////////////////////////////////////////
/// \brief Get the current upward vector of the listener in the scene
@ -140,14 +137,12 @@ public:
/// \see setUpVector
///
////////////////////////////////////////////////////////////
static Vector3f getUpVector();
};
} // namespace sf
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)

View File

@ -38,9 +38,8 @@ 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
///
@ -51,7 +50,7 @@ public:
/// \return Clipboard contents as sf::String object
///
////////////////////////////////////////////////////////////
static String getString();
SFML_WINDOW_API String getString();
////////////////////////////////////////////////////////////
/// \brief Set the content of the clipboard as string data
@ -68,14 +67,14 @@ public:
/// to the clipboard
///
////////////////////////////////////////////////////////////
static void setString(const String& text);
};
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

View File

@ -31,16 +31,12 @@
#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
///
@ -87,7 +83,7 @@ public:
/// \return True if the joystick is connected, false otherwise
///
////////////////////////////////////////////////////////////
static bool isConnected(unsigned int joystick);
SFML_WINDOW_API bool isConnected(unsigned int joystick);
////////////////////////////////////////////////////////////
/// \brief Return the number of buttons supported by a joystick
@ -99,7 +95,7 @@ public:
/// \return Number of buttons supported by the joystick
///
////////////////////////////////////////////////////////////
static unsigned int getButtonCount(unsigned int joystick);
SFML_WINDOW_API unsigned int getButtonCount(unsigned int joystick);
////////////////////////////////////////////////////////////
/// \brief Check if a joystick supports a given axis
@ -112,7 +108,7 @@ public:
/// \return True if the joystick supports the axis, false otherwise
///
////////////////////////////////////////////////////////////
static bool hasAxis(unsigned int joystick, Axis axis);
SFML_WINDOW_API bool hasAxis(unsigned int joystick, Axis axis);
////////////////////////////////////////////////////////////
/// \brief Check if a joystick button is pressed
@ -125,7 +121,7 @@ public:
/// \return True if the button is pressed, false otherwise
///
////////////////////////////////////////////////////////////
static bool isButtonPressed(unsigned int joystick, unsigned int button);
SFML_WINDOW_API bool isButtonPressed(unsigned int joystick, unsigned int button);
////////////////////////////////////////////////////////////
/// \brief Get the current position of a joystick axis
@ -138,7 +134,7 @@ public:
/// \return Current position of the axis, in range [-100 .. 100]
///
////////////////////////////////////////////////////////////
static float getAxisPosition(unsigned int joystick, Axis axis);
SFML_WINDOW_API float getAxisPosition(unsigned int joystick, Axis axis);
////////////////////////////////////////////////////////////
/// \brief Get the joystick information
@ -148,7 +144,7 @@ public:
/// \return Structure containing joystick information.
///
////////////////////////////////////////////////////////////
static Identification getIdentification(unsigned int joystick);
SFML_WINDOW_API Identification getIdentification(unsigned int joystick);
////////////////////////////////////////////////////////////
/// \brief Update the states of all joysticks
@ -159,22 +155,19 @@ public:
/// in this case the joystick states are not updated automatically.
///
////////////////////////////////////////////////////////////
static void update();
};
} // namespace sf
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

View File

@ -30,15 +30,12 @@
#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
///
@ -159,7 +156,7 @@ public:
/// \return True if the key is pressed, false otherwise
///
////////////////////////////////////////////////////////////
static bool isKeyPressed(Key key);
SFML_WINDOW_API bool isKeyPressed(Key key);
////////////////////////////////////////////////////////////
/// \brief Show or hide the virtual keyboard
@ -174,21 +171,18 @@ public:
/// \param visible True to show, false to hide
///
////////////////////////////////////////////////////////////
static void setVirtualKeyboardVisible(bool visible);
};
} // namespace sf
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

View File

@ -40,9 +40,8 @@ class WindowBase;
/// \brief Give access to the real-time state of the mouse
///
////////////////////////////////////////////////////////////
class SFML_WINDOW_API Mouse
namespace Mouse
{
public:
////////////////////////////////////////////////////////////
/// \brief Mouse buttons
///
@ -79,7 +78,7 @@ public:
/// \return True if the button is pressed, false otherwise
///
////////////////////////////////////////////////////////////
static bool isButtonPressed(Button button);
SFML_WINDOW_API bool isButtonPressed(Button button);
////////////////////////////////////////////////////////////
/// \brief Get the current position of the mouse in desktop coordinates
@ -90,7 +89,7 @@ public:
/// \return Current position of the mouse
///
////////////////////////////////////////////////////////////
static Vector2i getPosition();
SFML_WINDOW_API Vector2i getPosition();
////////////////////////////////////////////////////////////
/// \brief Get the current position of the mouse in window coordinates
@ -103,7 +102,7 @@ public:
/// \return Current position of the mouse
///
////////////////////////////////////////////////////////////
static Vector2i getPosition(const WindowBase& relativeTo);
SFML_WINDOW_API Vector2i getPosition(const WindowBase& relativeTo);
////////////////////////////////////////////////////////////
/// \brief Set the current position of the mouse in desktop coordinates
@ -114,7 +113,7 @@ public:
/// \param position New position of the mouse
///
////////////////////////////////////////////////////////////
static void setPosition(const Vector2i& position);
SFML_WINDOW_API void setPosition(const Vector2i& position);
////////////////////////////////////////////////////////////
/// \brief Set the current position of the mouse in window coordinates
@ -126,21 +125,20 @@ public:
/// \param relativeTo Reference window
///
////////////////////////////////////////////////////////////
static void setPosition(const Vector2i& position, const WindowBase& relativeTo);
};
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

View File

@ -31,16 +31,12 @@
#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
///
@ -65,7 +61,7 @@ public:
/// \return True if the sensor is available, false otherwise
///
////////////////////////////////////////////////////////////
static bool isAvailable(Type sensor);
SFML_WINDOW_API bool isAvailable(Type sensor);
////////////////////////////////////////////////////////////
/// \brief Enable or disable a sensor
@ -80,7 +76,7 @@ public:
/// \param enabled True to enable, false to disable
///
////////////////////////////////////////////////////////////
static void setEnabled(Type sensor, bool enabled);
SFML_WINDOW_API void setEnabled(Type sensor, bool enabled);
////////////////////////////////////////////////////////////
/// \brief Get the current sensor value
@ -90,21 +86,18 @@ public:
/// \return The current sensor value
///
////////////////////////////////////////////////////////////
static Vector3f getValue(Type sensor);
};
} // namespace sf
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

View File

@ -40,9 +40,8 @@ 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
///
@ -51,7 +50,7 @@ public:
/// \return True if \a finger is currently touching the screen, false otherwise
///
////////////////////////////////////////////////////////////
static bool isDown(unsigned int finger);
SFML_WINDOW_API bool isDown(unsigned int finger);
////////////////////////////////////////////////////////////
/// \brief Get the current position of a touch in desktop coordinates
@ -64,7 +63,7 @@ public:
/// \return Current position of \a finger, or undefined if it's not down
///
////////////////////////////////////////////////////////////
static Vector2i getPosition(unsigned int finger);
SFML_WINDOW_API Vector2i getPosition(unsigned int finger);
////////////////////////////////////////////////////////////
/// \brief Get the current position of a touch in window coordinates
@ -78,21 +77,20 @@ public:
/// \return Current position of \a finger, or undefined if it's not down
///
////////////////////////////////////////////////////////////
static Vector2i getPosition(unsigned int finger, const WindowBase& relativeTo);
};
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

View File

@ -58,9 +58,8 @@ using VulkanFunctionPointer = void (*)();
/// \brief Vulkan helper functions
///
////////////////////////////////////////////////////////////
class SFML_WINDOW_API Vulkan
namespace Vulkan
{
public:
////////////////////////////////////////////////////////////
/// \brief Tell whether or not the system supports Vulkan
///
@ -77,7 +76,7 @@ public:
/// \return True if Vulkan is supported, false otherwise
///
////////////////////////////////////////////////////////////
static bool isAvailable(bool requireGraphics = true);
SFML_WINDOW_API bool isAvailable(bool requireGraphics = true);
////////////////////////////////////////////////////////////
/// \brief Get the address of a Vulkan function
@ -87,7 +86,7 @@ public:
/// \return Address of the Vulkan function, 0 on failure
///
////////////////////////////////////////////////////////////
static VulkanFunctionPointer getFunction(const char* name);
SFML_WINDOW_API VulkanFunctionPointer getFunction(const char* name);
////////////////////////////////////////////////////////////
/// \brief Get Vulkan instance extensions required for graphics
@ -95,16 +94,17 @@ public:
/// \return Vulkan instance extensions required for graphics
///
////////////////////////////////////////////////////////////
static const std::vector<const char*>& getGraphicsRequiredInstanceExtensions();
};
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
///
////////////////////////////////////////////////////////////

View File

@ -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;