mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-25 05:03:36 +01:00
Compare commits
25
Commits
new_texture_impl
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1229896f3d | ||
|
|
e468aa651b | ||
|
|
14378de263 | ||
|
|
1fa7f3caec | ||
|
|
b99a455873 | ||
|
|
d1708cbd65 | ||
|
|
a14d4322ac | ||
|
|
5385f329c6 | ||
|
|
fd8e6a0364 | ||
|
|
884dcde3c3 | ||
|
|
cc92ca36b7 | ||
|
|
556ca510d4 | ||
|
|
66e7af4993 | ||
|
|
6ce8f95553 | ||
|
|
b626f65ee5 | ||
|
|
f297287951 | ||
|
|
ef81fbd337 | ||
|
|
84f580e207 | ||
|
|
4c818c31ed | ||
|
|
82e4518e93 | ||
|
|
b8860362a3 | ||
|
|
37e78942ed | ||
|
|
c74378bade | ||
|
|
fef1e09542 | ||
|
|
1b082ac255 |
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
github: SFML
|
||||||
|
open_collective: sfml
|
||||||
@@ -74,14 +74,17 @@ jobs:
|
|||||||
|
|
||||||
format:
|
format:
|
||||||
name: Formatting
|
name: Formatting
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install Clang Format
|
||||||
|
run: sudo apt-get install clang-format-17
|
||||||
|
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Format Code
|
- name: Format Code
|
||||||
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-14 -P cmake/Format.cmake
|
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-17 -P cmake/Format.cmake
|
||||||
|
|
||||||
- name: Check Formatting
|
- name: Check Formatting
|
||||||
run: git diff --exit-code
|
run: git diff --exit-code
|
||||||
|
|||||||
+2
-2
@@ -46,7 +46,7 @@ csfml_set_option(CSFML_LINK_SFML_STATICALLY ${LINK_STATICALLY_DEFAULT} BOOL "ON
|
|||||||
|
|
||||||
# define an option for choosing between static and dynamic C runtime (Windows only)
|
# define an option for choosing between static and dynamic C runtime (Windows only)
|
||||||
if(SFML_OS_WINDOWS)
|
if(SFML_OS_WINDOWS)
|
||||||
set(STATIC_STD_LIBS OFF CACHE BOOL "ON to statically link to the standard libraries, OFF to use them as DLLs")
|
csfml_set_option(CSFML_USE_STATIC_STD_LIBS OFF BOOL "ON to statically link to the standard libraries, OFF to use them as DLLs")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# find SFML libraries (C++)
|
# find SFML libraries (C++)
|
||||||
@@ -121,7 +121,7 @@ if(CSFML_BUILD_TEST_SUITE)
|
|||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
csfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 14")
|
csfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 17")
|
||||||
add_custom_target(format
|
add_custom_target(format
|
||||||
COMMAND ${CMAKE_COMMAND} -DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE} -P ./cmake/Format.cmake
|
COMMAND ${CMAKE_COMMAND} -DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE} -P ./cmake/Format.cmake
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} VERBATIM)
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} VERBATIM)
|
||||||
|
|||||||
+2
-2
@@ -13,8 +13,8 @@ endif()
|
|||||||
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} --version OUTPUT_VARIABLE CLANG_FORMAT_VERSION)
|
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} --version OUTPUT_VARIABLE CLANG_FORMAT_VERSION)
|
||||||
string(REGEX MATCH "clang-format version ([0-9]+)" CLANG_FORMAT_VERSION ${CLANG_FORMAT_VERSION})
|
string(REGEX MATCH "clang-format version ([0-9]+)" CLANG_FORMAT_VERSION ${CLANG_FORMAT_VERSION})
|
||||||
unset(CLANG_FORMAT_VERSION)
|
unset(CLANG_FORMAT_VERSION)
|
||||||
if(NOT CMAKE_MATCH_1 EQUAL 14)
|
if(NOT CMAKE_MATCH_1 EQUAL 17)
|
||||||
message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} not supported. Must use version 14")
|
message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} not supported. Must use version 17")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
|
|||||||
+4
-4
@@ -46,7 +46,7 @@ macro(csfml_add_library target)
|
|||||||
set_target_properties(${target} PROPERTIES MINSIZEREL_POSTFIX -s)
|
set_target_properties(${target} PROPERTIES MINSIZEREL_POSTFIX -s)
|
||||||
set_target_properties(${target} PROPERTIES RELWITHDEBINFO_POSTFIX -s)
|
set_target_properties(${target} PROPERTIES RELWITHDEBINFO_POSTFIX -s)
|
||||||
|
|
||||||
if(STATIC_STD_LIBS)
|
if(CSFML_USE_STATIC_STD_LIBS)
|
||||||
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -58,11 +58,11 @@ macro(csfml_add_library target)
|
|||||||
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
# set the target's folder (for IDEs that support it, e.g. Visual Studio)
|
||||||
set_target_properties(${target} PROPERTIES FOLDER "CSFML")
|
set_target_properties(${target} PROPERTIES FOLDER "CSFML")
|
||||||
|
|
||||||
# apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
|
# apply the CSFML_USE_STATIC_STD_LIBS option if it is enabled
|
||||||
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC)
|
if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC)
|
||||||
if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
|
if(CSFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM)
|
||||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||||
elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
|
elseif(NOT CSFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM)
|
||||||
set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++")
|
set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ CSFML_AUDIO_API sfTime sfMusic_getDuration(const sfMusic* music);
|
|||||||
CSFML_AUDIO_API sfTimeSpan sfMusic_getLoopPoints(const sfMusic* music);
|
CSFML_AUDIO_API sfTimeSpan sfMusic_getLoopPoints(const sfMusic* music);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Sets the beginning and end of the sound's looping sequence using sf::Time
|
/// \brief Sets the beginning and end of the sound's looping sequence using sfTime
|
||||||
///
|
///
|
||||||
/// Loop points allow one to specify a pair of positions such that, when the music
|
/// Loop points allow one to specify a pair of positions such that, when the music
|
||||||
/// is enabled for looping, it will seamlessly seek to the beginning whenever it
|
/// is enabled for looping, it will seamlessly seek to the beginning whenever it
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ CSFML_AUDIO_API bool sfSoundRecorder_isAvailable(void);
|
|||||||
/// \return An array of strings containing the names
|
/// \return An array of strings containing the names
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_AUDIO_API const char** sfSoundRecorder_getAvailableDevices(size_t* count);
|
CSFML_AUDIO_API const char* const* sfSoundRecorder_getAvailableDevices(size_t* count);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the name of the default audio capture device
|
/// \brief Get the name of the default audio capture device
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SFML - Simple and Fast Multimedia Library
|
||||||
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
|
// subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented;
|
||||||
|
// you must not claim that you wrote the original software.
|
||||||
|
// If you use this software in a product, an acknowledgment
|
||||||
|
// in the product documentation would be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
|
// and must not be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Types of texture coordinates that can be used for rendering.
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
sfCoordinateTypeNormalized, ///< sfTexture coordinates in range [0 .. 1].
|
||||||
|
sfCoordinateTypePixels ///< sfTexture coordinates in range [0 .. size].
|
||||||
|
} sfCoordinateType;
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Types of primitives that a sf::VertexArray can render
|
/// \brief Types of primitives that an sfVertexArray can render
|
||||||
///
|
///
|
||||||
/// Points and lines have no area, therefore their thickness
|
/// Points and lines have no area, therefore their thickness
|
||||||
/// will always be 1 pixel, regardless the current transform
|
/// will always be 1 pixel, regardless the current transform
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
#include <CSFML/Graphics/Export.h>
|
#include <CSFML/Graphics/Export.h>
|
||||||
|
|
||||||
#include <CSFML/Graphics/BlendMode.h>
|
#include <CSFML/Graphics/BlendMode.h>
|
||||||
|
#include <CSFML/Graphics/CoordinateType.h>
|
||||||
|
#include <CSFML/Graphics/StencilMode.h>
|
||||||
#include <CSFML/Graphics/Transform.h>
|
#include <CSFML/Graphics/Transform.h>
|
||||||
#include <CSFML/Graphics/Types.h>
|
#include <CSFML/Graphics/Types.h>
|
||||||
|
|
||||||
@@ -40,10 +42,12 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
sfBlendMode blendMode; ///< Blending mode
|
sfBlendMode blendMode; ///< Blending mode
|
||||||
sfTransform transform; ///< Transform
|
sfStencilMode stencilMode; //!< Stencil mode
|
||||||
const sfTexture* texture; ///< Texture
|
sfTransform transform; ///< Transform
|
||||||
const sfShader* shader; ///< Shader
|
sfCoordinateType coordinateType; //!< Texture coordinate type
|
||||||
|
const sfTexture* texture; ///< Texture
|
||||||
|
const sfShader* shader; ///< Shader
|
||||||
} sfRenderStates;
|
} sfRenderStates;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <CSFML/Graphics/Export.h>
|
#include <CSFML/Graphics/Export.h>
|
||||||
|
|
||||||
|
#include <CSFML/Graphics/CoordinateType.h>
|
||||||
#include <CSFML/Graphics/Rect.h>
|
#include <CSFML/Graphics/Rect.h>
|
||||||
#include <CSFML/Graphics/Types.h>
|
#include <CSFML/Graphics/Types.h>
|
||||||
#include <CSFML/System/InputStream.h>
|
#include <CSFML/System/InputStream.h>
|
||||||
@@ -37,16 +38,6 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// \brief Types of texture coordinates that can be used for rendering.
|
|
||||||
///
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
sfTextureNormalized, ///< sfTexture coordinates in range [0 .. 1].
|
|
||||||
sfTexturePixels ///< sfTexture coordinates in range [0 .. size].
|
|
||||||
} sfTextureCoordinateType;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Create a new texture
|
/// \brief Create a new texture
|
||||||
///
|
///
|
||||||
@@ -400,7 +391,7 @@ CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* textu
|
|||||||
/// \param type Type of texture coordinates to use
|
/// \param type Type of texture coordinates to use
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture, sfTextureCoordinateType type);
|
CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture, sfCoordinateType type);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the maximum texture size allowed
|
/// \brief Get the maximum texture size allowed
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ typedef enum
|
|||||||
/// \return A new sfVertexBuffer object
|
/// \return A new sfVertexBuffer object
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_create(unsigned int vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage);
|
CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_create(size_t vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Copy an existing vertex buffer
|
/// \brief Copy an existing vertex buffer
|
||||||
@@ -174,7 +174,7 @@ CSFML_GRAPHICS_API unsigned int sfVertexBuffer_getNativeHandle(sfVertexBuffer* v
|
|||||||
/// This function defines how the vertices must be interpreted
|
/// This function defines how the vertices must be interpreted
|
||||||
/// when it's time to draw them.
|
/// when it's time to draw them.
|
||||||
///
|
///
|
||||||
/// The default primitive type is sf::Points.
|
/// The default primitive type is sfPoints.
|
||||||
///
|
///
|
||||||
/// \param vertexBuffer Vertex buffer object
|
/// \param vertexBuffer Vertex buffer object
|
||||||
/// \param type Type of primitive
|
/// \param type Type of primitive
|
||||||
@@ -248,7 +248,7 @@ CSFML_GRAPHICS_API void sfVertexBuffer_bind(const sfVertexBuffer* vertexBuffer);
|
|||||||
///
|
///
|
||||||
/// This function should always be called before using
|
/// This function should always be called before using
|
||||||
/// the vertex buffer features. If it returns false, then
|
/// the vertex buffer features. If it returns false, then
|
||||||
/// any attempt to use sf::VertexBuffer will fail.
|
/// any attempt to use sfVertexBuffer will fail.
|
||||||
///
|
///
|
||||||
/// \return True if vertex buffers are supported, false otherwise
|
/// \return True if vertex buffers are supported, false otherwise
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getMessage(const sfFtpDirec
|
|||||||
///
|
///
|
||||||
/// \param ftpDirectoryResponse Ftp directory response
|
/// \param ftpDirectoryResponse Ftp directory response
|
||||||
///
|
///
|
||||||
/// \return Directory name
|
/// \return Directory name or NULL if it failed
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||||
@@ -239,7 +239,7 @@ CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getDirectory(const sfFtpDir
|
|||||||
///
|
///
|
||||||
/// \param ftpDirectoryResponse Ftp directory response
|
/// \param ftpDirectoryResponse Ftp directory response
|
||||||
///
|
///
|
||||||
/// \return Directory name
|
/// \return Directory name or NULL if it failed
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_NETWORK_API const sfChar32* sfFtpDirectoryResponse_getDirectoryUnicode(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
CSFML_NETWORK_API const sfChar32* sfFtpDirectoryResponse_getDirectoryUnicode(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ CSFML_NETWORK_API void sfTcpSocket_disconnect(sfTcpSocket* socket);
|
|||||||
/// \brief Send raw data to the remote peer of a TCP socket
|
/// \brief Send raw data to the remote peer of a TCP socket
|
||||||
///
|
///
|
||||||
/// To be able to handle partial sends over non-blocking
|
/// To be able to handle partial sends over non-blocking
|
||||||
/// sockets, use the sfTcpSocket_sendPartial(sfTcpSocket*, const void*, std::size_t, size_t*)
|
/// sockets, use the sfTcpSocket_sendPartial(sfTcpSocket*, const void*, size_t, size_t*)
|
||||||
/// overload instead.
|
/// overload instead.
|
||||||
/// This function will fail if the socket is not connected.
|
/// This function will fail if the socket is not connected.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ typedef struct
|
|||||||
/// \brief Predefined "zero" time value
|
/// \brief Predefined "zero" time value
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
CSFML_SYSTEM_API sfTime sfTime_Zero;
|
CSFML_SYSTEM_API const sfTime sfTime_Zero;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Return a time value as a number of seconds
|
/// \brief Return a time value as a number of seconds
|
||||||
|
|||||||
@@ -142,10 +142,12 @@ typedef enum
|
|||||||
sfKeyF14, ///< The F14 key
|
sfKeyF14, ///< The F14 key
|
||||||
sfKeyF15, ///< The F15 key
|
sfKeyF15, ///< The F15 key
|
||||||
sfKeyPause, ///< The Pause key
|
sfKeyPause, ///< The Pause key
|
||||||
|
|
||||||
sfKeyCount, ///< Keep last -- the total number of keyboard keys
|
|
||||||
} sfKeyCode;
|
} sfKeyCode;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
sfKeyCount = sfKeyPause + 1 ///< The total number of keyboard keys
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Scancodes
|
/// \brief Scancodes
|
||||||
@@ -310,10 +312,12 @@ typedef enum
|
|||||||
sfScanLaunchApplication2, //!< Keyboard Launch Application 2 key
|
sfScanLaunchApplication2, //!< Keyboard Launch Application 2 key
|
||||||
sfScanLaunchMail, //!< Keyboard Launch Mail key
|
sfScanLaunchMail, //!< Keyboard Launch Mail key
|
||||||
sfScanLaunchMediaSelect, //!< Keyboard Launch Media Select key
|
sfScanLaunchMediaSelect, //!< Keyboard Launch Media Select key
|
||||||
|
|
||||||
sfScancodeCount //!< Keep last -- the total number of scancodes
|
|
||||||
} sfScancode;
|
} sfScancode;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
sfScancodeCount = sfScanLaunchMediaSelect + 1 //!< The total number of scancodes
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Check if a key is pressed
|
/// \brief Check if a key is pressed
|
||||||
|
|||||||
@@ -39,15 +39,18 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
sfMouseLeft, ///< The left mouse button
|
sfMouseLeft, ///< The left mouse button
|
||||||
sfMouseRight, ///< The right mouse button
|
sfMouseRight, ///< The right mouse button
|
||||||
sfMouseMiddle, ///< The middle (wheel) mouse button
|
sfMouseMiddle, ///< The middle (wheel) mouse button
|
||||||
sfMouseXButton1, ///< The first extra mouse button
|
sfMouseButtonExtra1, ///< The first extra mouse button
|
||||||
sfMouseXButton2, ///< The second extra mouse button
|
sfMouseButtonExtra2, ///< The second extra mouse button
|
||||||
|
|
||||||
sfMouseButtonCount ///< Keep last -- the total number of mouse buttons
|
|
||||||
} sfMouseButton;
|
} sfMouseButton;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
sfMouseButtonCount = sfMouseButtonExtra2 + 1 ///< The total number of mouse buttons
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Mouse wheels
|
/// \brief Mouse wheels
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -45,10 +45,12 @@ typedef enum
|
|||||||
sfSensorGravity, ///< Measures the direction and intensity of gravity, independent of device acceleration (m/s^2)
|
sfSensorGravity, ///< Measures the direction and intensity of gravity, independent of device acceleration (m/s^2)
|
||||||
sfSensorUserAcceleration, ///< Measures the direction and intensity of device acceleration, independent of the gravity (m/s^2)
|
sfSensorUserAcceleration, ///< Measures the direction and intensity of device acceleration, independent of the gravity (m/s^2)
|
||||||
sfSensorOrientation, ///< Measures the absolute 3D orientation (degrees)
|
sfSensorOrientation, ///< Measures the absolute 3D orientation (degrees)
|
||||||
|
|
||||||
sfSensorCount ///< Keep last -- the total number of sensor types
|
|
||||||
} sfSensorType;
|
} sfSensorType;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
sfSensorCount = sfSensorOrientation + 1 ///< The total number of sensor types
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Check if a sensor is available on the underlying platform
|
/// \brief Check if a sensor is available on the underlying platform
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ void sfMusic_destroy(const sfMusic* music)
|
|||||||
void sfMusic_setLooping(sfMusic* music, bool loop)
|
void sfMusic_setLooping(sfMusic* music, bool loop)
|
||||||
{
|
{
|
||||||
assert(music);
|
assert(music);
|
||||||
music->setLooping(loop != 0);
|
music->setLooping(loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -81,18 +81,17 @@ bool sfSoundRecorder_isAvailable()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const char** sfSoundRecorder_getAvailableDevices(size_t* count)
|
const char* const* sfSoundRecorder_getAvailableDevices(size_t* count)
|
||||||
{
|
{
|
||||||
static std::vector<std::string> stringDevices = sf::SoundRecorder::getAvailableDevices();
|
static const auto cstringDevices = []
|
||||||
static std::vector<const char*> cstringDevices;
|
|
||||||
|
|
||||||
if (cstringDevices.empty() && !stringDevices.empty())
|
|
||||||
{
|
{
|
||||||
|
static const std::vector<std::string> stringDevices = sf::SoundRecorder::getAvailableDevices();
|
||||||
|
std::vector<const char*> devices;
|
||||||
|
devices.reserve(stringDevices.size());
|
||||||
for (const auto& stringDevice : stringDevices)
|
for (const auto& stringDevice : stringDevices)
|
||||||
{
|
devices.push_back(stringDevice.c_str());
|
||||||
cstringDevices.push_back(stringDevice.c_str());
|
return devices;
|
||||||
}
|
}();
|
||||||
}
|
|
||||||
|
|
||||||
if (count)
|
if (count)
|
||||||
*count = cstringDevices.size();
|
*count = cstringDevices.size();
|
||||||
@@ -104,7 +103,7 @@ const char** sfSoundRecorder_getAvailableDevices(size_t* count)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const char* sfSoundRecorder_getDefaultDevice()
|
const char* sfSoundRecorder_getDefaultDevice()
|
||||||
{
|
{
|
||||||
static std::string defaultDevice = sf::SoundRecorder::getDefaultDevice();
|
static const std::string defaultDevice = sf::SoundRecorder::getDefaultDevice();
|
||||||
|
|
||||||
return !defaultDevice.empty() ? defaultDevice.c_str() : nullptr;
|
return !defaultDevice.empty() ? defaultDevice.c_str() : nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,181 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// SFML - Simple and Fast Multimedia Library
|
|
||||||
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it freely,
|
|
||||||
// subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented;
|
|
||||||
// you must not claim that you wrote the original software.
|
|
||||||
// If you use this software in a product, an acknowledgment
|
|
||||||
// in the product documentation would be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such,
|
|
||||||
// and must not be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Headers
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
#include <CSFML/System/ConvertVector2.hpp>
|
|
||||||
#include <CSFML/System/ConvertVector3.hpp>
|
|
||||||
#include <CSFML/Window/Event.h>
|
|
||||||
|
|
||||||
#include <SFML/Window/Event.hpp>
|
|
||||||
|
|
||||||
#include <optional>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
// Convert sf::Event to sfEvent
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
[[nodiscard]] inline bool convertEvent(const std::optional<sf::Event>& sfmlEvent, sfEvent* event)
|
|
||||||
{
|
|
||||||
if (!sfmlEvent)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (sfmlEvent->is<sf::Event::Closed>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtClosed;
|
|
||||||
}
|
|
||||||
else if (const auto* resized = sfmlEvent->getIf<sf::Event::Resized>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtResized;
|
|
||||||
event->size.size = convertVector2(resized->size);
|
|
||||||
}
|
|
||||||
else if (sfmlEvent->is<sf::Event::FocusLost>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtFocusLost;
|
|
||||||
}
|
|
||||||
else if (sfmlEvent->is<sf::Event::FocusGained>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtFocusGained;
|
|
||||||
}
|
|
||||||
else if (const auto* textEntered = sfmlEvent->getIf<sf::Event::TextEntered>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtTextEntered;
|
|
||||||
event->text.unicode = textEntered->unicode;
|
|
||||||
}
|
|
||||||
else if (const auto* keyReleased = sfmlEvent->getIf<sf::Event::KeyReleased>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtKeyReleased;
|
|
||||||
event->key.code = static_cast<sfKeyCode>(keyReleased->code);
|
|
||||||
event->key.scancode = static_cast<sfScancode>(keyReleased->scancode);
|
|
||||||
event->key.alt = keyReleased->alt;
|
|
||||||
event->key.control = keyReleased->control;
|
|
||||||
event->key.shift = keyReleased->shift;
|
|
||||||
event->key.system = keyReleased->system;
|
|
||||||
}
|
|
||||||
else if (const auto* keyPressed = sfmlEvent->getIf<sf::Event::KeyPressed>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtKeyPressed;
|
|
||||||
event->key.code = static_cast<sfKeyCode>(keyPressed->code);
|
|
||||||
event->key.scancode = static_cast<sfScancode>(keyPressed->scancode);
|
|
||||||
event->key.alt = keyPressed->alt;
|
|
||||||
event->key.control = keyPressed->control;
|
|
||||||
event->key.shift = keyPressed->shift;
|
|
||||||
event->key.system = keyPressed->system;
|
|
||||||
}
|
|
||||||
else if (const auto* mouseWheelScrolled = sfmlEvent->getIf<sf::Event::MouseWheelScrolled>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtMouseWheelScrolled;
|
|
||||||
event->mouseWheelScroll.wheel = static_cast<sfMouseWheel>(mouseWheelScrolled->wheel);
|
|
||||||
event->mouseWheelScroll.delta = mouseWheelScrolled->delta;
|
|
||||||
event->mouseWheelScroll.position = convertVector2(mouseWheelScrolled->position);
|
|
||||||
}
|
|
||||||
else if (const auto* mouseButtonPressed = sfmlEvent->getIf<sf::Event::MouseButtonPressed>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtMouseButtonPressed;
|
|
||||||
event->mouseButton.button = static_cast<sfMouseButton>(mouseButtonPressed->button);
|
|
||||||
event->mouseButton.position = convertVector2(mouseButtonPressed->position);
|
|
||||||
}
|
|
||||||
else if (const auto* mouseButtonReleased = sfmlEvent->getIf<sf::Event::MouseButtonReleased>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtMouseButtonReleased;
|
|
||||||
event->mouseButton.button = static_cast<sfMouseButton>(mouseButtonReleased->button);
|
|
||||||
event->mouseButton.position = convertVector2(mouseButtonReleased->position);
|
|
||||||
}
|
|
||||||
else if (const auto* mouseMoved = sfmlEvent->getIf<sf::Event::MouseMoved>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtMouseMoved;
|
|
||||||
event->mouseMove.position = convertVector2(mouseMoved->position);
|
|
||||||
}
|
|
||||||
else if (const auto* mouseMovedRaw = sfmlEvent->getIf<sf::Event::MouseMovedRaw>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtMouseMovedRaw;
|
|
||||||
event->mouseMoveRaw.delta = convertVector2(mouseMovedRaw->delta);
|
|
||||||
}
|
|
||||||
else if (sfmlEvent->is<sf::Event::MouseEntered>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtMouseEntered;
|
|
||||||
}
|
|
||||||
else if (sfmlEvent->is<sf::Event::MouseLeft>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtMouseLeft;
|
|
||||||
}
|
|
||||||
else if (const auto* joystickButtonPressed = sfmlEvent->getIf<sf::Event::JoystickButtonPressed>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtJoystickButtonPressed;
|
|
||||||
event->joystickButton.joystickId = joystickButtonPressed->joystickId;
|
|
||||||
event->joystickButton.button = joystickButtonPressed->button;
|
|
||||||
}
|
|
||||||
else if (const auto* joystickButtonReleased = sfmlEvent->getIf<sf::Event::JoystickButtonReleased>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtJoystickButtonReleased;
|
|
||||||
event->joystickButton.joystickId = joystickButtonReleased->joystickId;
|
|
||||||
event->joystickButton.button = joystickButtonReleased->button;
|
|
||||||
}
|
|
||||||
else if (const auto* joystickMoved = sfmlEvent->getIf<sf::Event::JoystickMoved>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtJoystickMoved;
|
|
||||||
event->joystickMove.joystickId = joystickMoved->joystickId;
|
|
||||||
event->joystickMove.axis = static_cast<sfJoystickAxis>(joystickMoved->axis);
|
|
||||||
event->joystickMove.position = joystickMoved->position;
|
|
||||||
}
|
|
||||||
else if (const auto* joystickConnected = sfmlEvent->getIf<sf::Event::JoystickConnected>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtJoystickConnected;
|
|
||||||
event->joystickConnect.joystickId = joystickConnected->joystickId;
|
|
||||||
}
|
|
||||||
else if (const auto* joystickDisconnected = sfmlEvent->getIf<sf::Event::JoystickDisconnected>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtJoystickDisconnected;
|
|
||||||
event->joystickConnect.joystickId = joystickDisconnected->joystickId;
|
|
||||||
}
|
|
||||||
else if (const auto* touchBegan = sfmlEvent->getIf<sf::Event::TouchBegan>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtTouchBegan;
|
|
||||||
event->touch.finger = touchBegan->finger;
|
|
||||||
event->touch.position = convertVector2(touchBegan->position);
|
|
||||||
}
|
|
||||||
else if (const auto* touchMoved = sfmlEvent->getIf<sf::Event::TouchMoved>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtTouchMoved;
|
|
||||||
event->touch.finger = touchMoved->finger;
|
|
||||||
event->touch.position = convertVector2(touchMoved->position);
|
|
||||||
}
|
|
||||||
else if (const auto* touchEnded = sfmlEvent->getIf<sf::Event::TouchEnded>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtTouchEnded;
|
|
||||||
event->touch.finger = touchEnded->finger;
|
|
||||||
event->touch.position = convertVector2(touchEnded->position);
|
|
||||||
}
|
|
||||||
else if (const auto* sensorChanged = sfmlEvent->getIf<sf::Event::SensorChanged>())
|
|
||||||
{
|
|
||||||
event->type = sfEvtSensorChanged;
|
|
||||||
event->sensor.sensorType = static_cast<sfSensorType>(sensorChanged->type);
|
|
||||||
event->sensor.value = convertVector3(sensorChanged->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -19,6 +19,7 @@ set(SRC
|
|||||||
${SRCROOT}/ConvexShape.cpp
|
${SRCROOT}/ConvexShape.cpp
|
||||||
${SRCROOT}/ConvexShapeStruct.hpp
|
${SRCROOT}/ConvexShapeStruct.hpp
|
||||||
${INCROOT}/ConvexShape.h
|
${INCROOT}/ConvexShape.h
|
||||||
|
${INCROOT}/CoordinateType.h
|
||||||
${SRCROOT}/Font.cpp
|
${SRCROOT}/Font.cpp
|
||||||
${SRCROOT}/FontStruct.hpp
|
${SRCROOT}/FontStruct.hpp
|
||||||
${INCROOT}/Font.h
|
${INCROOT}/Font.h
|
||||||
|
|||||||
@@ -45,33 +45,26 @@ const sfColor sfTransparent = sfColor_fromRGBA(0, 0, 0, 0);
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfColor sfColor_fromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
sfColor sfColor_fromRGB(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
{
|
{
|
||||||
return sfColor_fromRGBA(red, green, blue, 255);
|
return {red, green, blue, 255};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfColor sfColor_fromRGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
|
sfColor sfColor_fromRGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
|
||||||
{
|
{
|
||||||
sfColor color;
|
return {red, green, blue, alpha};
|
||||||
|
|
||||||
color.r = red;
|
|
||||||
color.g = green;
|
|
||||||
color.b = blue;
|
|
||||||
color.a = alpha;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfColor sfColor_fromInteger(uint32_t color)
|
sfColor sfColor_fromInteger(uint32_t color)
|
||||||
{
|
{
|
||||||
auto red = static_cast<uint8_t>((color & 0xff000000) >> 24);
|
return {
|
||||||
auto green = static_cast<uint8_t>((color & 0x00ff0000) >> 16);
|
static_cast<uint8_t>((color & 0xff000000) >> 24),
|
||||||
auto blue = static_cast<uint8_t>((color & 0x0000ff00) >> 8);
|
static_cast<uint8_t>((color & 0x00ff0000) >> 16),
|
||||||
auto alpha = static_cast<uint8_t>((color & 0x000000ff) >> 0);
|
static_cast<uint8_t>((color & 0x0000ff00) >> 8),
|
||||||
|
static_cast<uint8_t>((color & 0x000000ff) >> 0),
|
||||||
return sfColor_fromRGBA(red, green, blue, alpha);
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -85,43 +78,34 @@ uint32_t sfColor_toInteger(sfColor color)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfColor sfColor_add(sfColor color1, sfColor color2)
|
sfColor sfColor_add(sfColor color1, sfColor color2)
|
||||||
{
|
{
|
||||||
int red = std::min(color1.r + color2.r, 255);
|
return {
|
||||||
int green = std::min(color1.g + color2.g, 255);
|
static_cast<uint8_t>(std::min(color1.r + color2.r, 255)),
|
||||||
int blue = std::min(color1.b + color2.b, 255);
|
static_cast<uint8_t>(std::min(color1.g + color2.g, 255)),
|
||||||
int alpha = std::min(color1.a + color2.a, 255);
|
static_cast<uint8_t>(std::min(color1.b + color2.b, 255)),
|
||||||
|
static_cast<uint8_t>(std::min(color1.a + color2.a, 255)),
|
||||||
return sfColor_fromRGBA(static_cast<uint8_t>(red),
|
};
|
||||||
static_cast<uint8_t>(green),
|
|
||||||
static_cast<uint8_t>(blue),
|
|
||||||
static_cast<uint8_t>(alpha));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfColor sfColor_subtract(sfColor color1, sfColor color2)
|
sfColor sfColor_subtract(sfColor color1, sfColor color2)
|
||||||
{
|
{
|
||||||
int red = std::max(color1.r - color2.r, 0);
|
return {
|
||||||
int green = std::max(color1.g - color2.g, 0);
|
static_cast<uint8_t>(std::max(color1.r - color2.r, 0)),
|
||||||
int blue = std::max(color1.b - color2.b, 0);
|
static_cast<uint8_t>(std::max(color1.g - color2.g, 0)),
|
||||||
int alpha = std::max(color1.a - color2.a, 0);
|
static_cast<uint8_t>(std::max(color1.b - color2.b, 0)),
|
||||||
|
static_cast<uint8_t>(std::max(color1.a - color2.a, 0)),
|
||||||
return sfColor_fromRGBA(static_cast<uint8_t>(red),
|
};
|
||||||
static_cast<uint8_t>(green),
|
|
||||||
static_cast<uint8_t>(blue),
|
|
||||||
static_cast<uint8_t>(alpha));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfColor sfColor_modulate(sfColor color1, sfColor color2)
|
sfColor sfColor_modulate(sfColor color1, sfColor color2)
|
||||||
{
|
{
|
||||||
int red = color1.r * color2.r / 255;
|
return {
|
||||||
int green = color1.g * color2.g / 255;
|
static_cast<uint8_t>(color1.r * color2.r / 255),
|
||||||
int blue = color1.b * color2.b / 255;
|
static_cast<uint8_t>(color1.g * color2.g / 255),
|
||||||
int alpha = color1.a * color2.a / 255;
|
static_cast<uint8_t>(color1.b * color2.b / 255),
|
||||||
|
static_cast<uint8_t>(color1.a * color2.a / 255),
|
||||||
return sfColor_fromRGBA(static_cast<uint8_t>(red),
|
};
|
||||||
static_cast<uint8_t>(green),
|
|
||||||
static_cast<uint8_t>(blue),
|
|
||||||
static_cast<uint8_t>(alpha));
|
|
||||||
}
|
}
|
||||||
@@ -50,8 +50,15 @@
|
|||||||
renderStates.blendMode.alphaSrcFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.alphaSrcFactor);
|
renderStates.blendMode.alphaSrcFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.alphaSrcFactor);
|
||||||
renderStates.blendMode.alphaDstFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.alphaDstFactor);
|
renderStates.blendMode.alphaDstFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.alphaDstFactor);
|
||||||
renderStates.blendMode.alphaEquation = static_cast<sf::BlendMode::Equation>(states->blendMode.alphaEquation);
|
renderStates.blendMode.alphaEquation = static_cast<sf::BlendMode::Equation>(states->blendMode.alphaEquation);
|
||||||
renderStates.transform = convertTransform(states->transform);
|
renderStates.stencilMode.stencilComparison = static_cast<sf::StencilComparison>(states->stencilMode.stencilComparison);
|
||||||
renderStates.texture = states->texture ? states->texture->This : nullptr;
|
renderStates.stencilMode.stencilUpdateOperation = static_cast<sf::StencilUpdateOperation>(
|
||||||
renderStates.shader = states->shader;
|
states->stencilMode.stencilUpdateOperation);
|
||||||
|
renderStates.stencilMode.stencilReference.value = states->stencilMode.stencilReference.value;
|
||||||
|
renderStates.stencilMode.stencilMask.value = states->stencilMode.stencilMask.value;
|
||||||
|
renderStates.stencilMode.stencilOnly = states->stencilMode.stencilOnly;
|
||||||
|
renderStates.transform = convertTransform(states->transform);
|
||||||
|
renderStates.coordinateType = static_cast<sf::CoordinateType>(states->coordinateType);
|
||||||
|
renderStates.texture = states->texture ? states->texture->This : nullptr;
|
||||||
|
renderStates.shader = states->shader;
|
||||||
return renderStates;
|
return renderStates;
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,9 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const sfRenderStates sfRenderStates_default = {
|
const sfRenderStates sfRenderStates_default = {
|
||||||
sfBlendAlpha,
|
sfBlendAlpha,
|
||||||
|
sfStencilMode_default,
|
||||||
sfTransform_Identity,
|
sfTransform_Identity,
|
||||||
|
sfCoordinateTypePixels,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
};
|
};
|
||||||
@@ -25,7 +25,6 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <CSFML/ConvertEvent.hpp>
|
|
||||||
#include <CSFML/Graphics/CircleShapeStruct.hpp>
|
#include <CSFML/Graphics/CircleShapeStruct.hpp>
|
||||||
#include <CSFML/Graphics/ConvertColor.hpp>
|
#include <CSFML/Graphics/ConvertColor.hpp>
|
||||||
#include <CSFML/Graphics/ConvertRect.hpp>
|
#include <CSFML/Graphics/ConvertRect.hpp>
|
||||||
@@ -43,6 +42,7 @@
|
|||||||
#include <CSFML/Graphics/VertexBufferStruct.hpp>
|
#include <CSFML/Graphics/VertexBufferStruct.hpp>
|
||||||
#include <CSFML/System/ConvertVector2.hpp>
|
#include <CSFML/System/ConvertVector2.hpp>
|
||||||
#include <CSFML/Window/ConvertContextSettings.hpp>
|
#include <CSFML/Window/ConvertContextSettings.hpp>
|
||||||
|
#include <CSFML/Window/ConvertEvent.hpp>
|
||||||
#include <CSFML/Window/ConvertVideoMode.hpp>
|
#include <CSFML/Window/ConvertVideoMode.hpp>
|
||||||
#include <CSFML/Window/CursorStruct.hpp>
|
#include <CSFML/Window/CursorStruct.hpp>
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ bool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, sfEvent* event)
|
|||||||
{
|
{
|
||||||
assert(renderWindow);
|
assert(renderWindow);
|
||||||
assert(event);
|
assert(event);
|
||||||
return convertEvent(renderWindow->pollEvent(), event);
|
return convertEvent(renderWindow->pollEvent(), *event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ bool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfTime timeout, sfEv
|
|||||||
{
|
{
|
||||||
assert(renderWindow);
|
assert(renderWindow);
|
||||||
assert(event);
|
assert(event);
|
||||||
return convertEvent(renderWindow->waitEvent(sf::microseconds(timeout.microseconds)), event);
|
return convertEvent(renderWindow->waitEvent(sf::microseconds(timeout.microseconds)), *event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+86
-113
@@ -37,41 +37,28 @@ sfShader* sfShader_createFromFile(const char* vertexShaderFilename,
|
|||||||
const char* geometryShaderFilename,
|
const char* geometryShaderFilename,
|
||||||
const char* fragmentShaderFilename)
|
const char* fragmentShaderFilename)
|
||||||
{
|
{
|
||||||
|
// At least one shader must be provided
|
||||||
|
if (!(vertexShaderFilename || geometryShaderFilename || fragmentShaderFilename))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
auto shader = std::make_unique<sfShader>();
|
auto shader = std::make_unique<sfShader>();
|
||||||
if (vertexShaderFilename || geometryShaderFilename || fragmentShaderFilename)
|
|
||||||
|
if (!geometryShaderFilename)
|
||||||
{
|
{
|
||||||
if (!geometryShaderFilename)
|
if (!vertexShaderFilename) // fragment shader only
|
||||||
{
|
success = shader->loadFromFile(fragmentShaderFilename, sf::Shader::Type::Fragment);
|
||||||
if (!vertexShaderFilename)
|
else if (!fragmentShaderFilename) // vertex shader only
|
||||||
{
|
success = shader->loadFromFile(vertexShaderFilename, sf::Shader::Type::Vertex);
|
||||||
// fragment shader only
|
else // vertex + fragment shaders
|
||||||
success = shader->loadFromFile(fragmentShaderFilename, sf::Shader::Type::Fragment);
|
success = shader->loadFromFile(vertexShaderFilename, fragmentShaderFilename);
|
||||||
}
|
}
|
||||||
else if (!fragmentShaderFilename)
|
else
|
||||||
{
|
{
|
||||||
// vertex shader only
|
if (!vertexShaderFilename && !fragmentShaderFilename) // geometry shader only
|
||||||
success = shader->loadFromFile(vertexShaderFilename, sf::Shader::Type::Vertex);
|
success = shader->loadFromFile(geometryShaderFilename, sf::Shader::Type::Geometry);
|
||||||
}
|
else // vertex + geometry + fragment shaders
|
||||||
else
|
success = shader->loadFromFile(vertexShaderFilename, geometryShaderFilename, fragmentShaderFilename);
|
||||||
{
|
|
||||||
// vertex + fragment shaders
|
|
||||||
success = shader->loadFromFile(vertexShaderFilename, fragmentShaderFilename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!vertexShaderFilename && !fragmentShaderFilename)
|
|
||||||
{
|
|
||||||
// geometry shader only
|
|
||||||
success = shader->loadFromFile(geometryShaderFilename, sf::Shader::Type::Geometry);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// vertex + geometry + fragment shaders
|
|
||||||
success = shader->loadFromFile(vertexShaderFilename, geometryShaderFilename, fragmentShaderFilename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
@@ -84,41 +71,28 @@ sfShader* sfShader_createFromFile(const char* vertexShaderFilename,
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfShader* sfShader_createFromMemory(const char* vertexShader, const char* geometryShader, const char* fragmentShader)
|
sfShader* sfShader_createFromMemory(const char* vertexShader, const char* geometryShader, const char* fragmentShader)
|
||||||
{
|
{
|
||||||
|
// At least one shader must be provided
|
||||||
|
if (!(vertexShader || geometryShader || fragmentShader))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
auto shader = std::make_unique<sfShader>();
|
auto shader = std::make_unique<sfShader>();
|
||||||
if (vertexShader || geometryShader || fragmentShader)
|
|
||||||
|
if (!geometryShader)
|
||||||
{
|
{
|
||||||
if (!geometryShader)
|
if (!vertexShader) // fragment shader only
|
||||||
{
|
success = shader->loadFromMemory(fragmentShader, sf::Shader::Type::Fragment);
|
||||||
if (!vertexShader)
|
else if (!fragmentShader) // vertex shader only
|
||||||
{
|
success = shader->loadFromMemory(vertexShader, sf::Shader::Type::Vertex);
|
||||||
// fragment shader only
|
else // vertex + fragment shaders
|
||||||
success = shader->loadFromMemory(fragmentShader, sf::Shader::Type::Fragment);
|
success = shader->loadFromMemory(vertexShader, fragmentShader);
|
||||||
}
|
}
|
||||||
else if (!fragmentShader)
|
else
|
||||||
{
|
{
|
||||||
// vertex shader only
|
if (!vertexShader && !fragmentShader) // geometry shader only
|
||||||
success = shader->loadFromMemory(vertexShader, sf::Shader::Type::Vertex);
|
success = shader->loadFromMemory(geometryShader, sf::Shader::Type::Geometry);
|
||||||
}
|
else // vertex + geometry + fragment shaders
|
||||||
else
|
success = shader->loadFromMemory(vertexShader, geometryShader, fragmentShader);
|
||||||
{
|
|
||||||
// vertex + fragment shaders
|
|
||||||
success = shader->loadFromMemory(vertexShader, fragmentShader);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!vertexShader && !fragmentShader)
|
|
||||||
{
|
|
||||||
// geometry shader only
|
|
||||||
success = shader->loadFromMemory(geometryShader, sf::Shader::Type::Geometry);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// vertex + geometry + fragment shaders
|
|
||||||
success = shader->loadFromMemory(vertexShader, geometryShader, fragmentShader);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
@@ -133,47 +107,44 @@ sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream,
|
|||||||
sfInputStream* geometryShaderStream,
|
sfInputStream* geometryShaderStream,
|
||||||
sfInputStream* fragmentShaderStream)
|
sfInputStream* fragmentShaderStream)
|
||||||
{
|
{
|
||||||
|
// At least one shader must be provided
|
||||||
|
if (!(vertexShaderStream || geometryShaderStream || fragmentShaderStream))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
auto shader = std::make_unique<sfShader>();
|
auto shader = std::make_unique<sfShader>();
|
||||||
if (vertexShaderStream || geometryShaderStream || fragmentShaderStream)
|
|
||||||
|
if (!geometryShaderStream)
|
||||||
{
|
{
|
||||||
if (!geometryShaderStream)
|
if (!vertexShaderStream) // fragment shader only
|
||||||
{
|
{
|
||||||
if (!vertexShaderStream)
|
CallbackStream stream(fragmentShaderStream);
|
||||||
{
|
success = shader->loadFromStream(stream, sf::Shader::Type::Fragment);
|
||||||
// fragment shader only
|
|
||||||
CallbackStream stream(fragmentShaderStream);
|
|
||||||
success = shader->loadFromStream(stream, sf::Shader::Type::Fragment);
|
|
||||||
}
|
|
||||||
else if (!fragmentShaderStream)
|
|
||||||
{
|
|
||||||
// vertex shader only
|
|
||||||
CallbackStream stream(vertexShaderStream);
|
|
||||||
success = shader->loadFromStream(stream, sf::Shader::Type::Vertex);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// vertex + fragment shaders
|
|
||||||
CallbackStream vertexStream(vertexShaderStream);
|
|
||||||
CallbackStream fragmentStream(fragmentShaderStream);
|
|
||||||
success = shader->loadFromStream(vertexStream, fragmentStream);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else if (!fragmentShaderStream) // vertex shader only
|
||||||
{
|
{
|
||||||
CallbackStream geometryStream(geometryShaderStream);
|
CallbackStream stream(vertexShaderStream);
|
||||||
if (!vertexShaderStream && !fragmentShaderStream)
|
success = shader->loadFromStream(stream, sf::Shader::Type::Vertex);
|
||||||
{
|
}
|
||||||
// geometry shader only
|
else // vertex + fragment shaders
|
||||||
success = shader->loadFromStream(geometryStream, sf::Shader::Type::Geometry);
|
{
|
||||||
}
|
CallbackStream vertexStream(vertexShaderStream);
|
||||||
else
|
CallbackStream fragmentStream(fragmentShaderStream);
|
||||||
{
|
success = shader->loadFromStream(vertexStream, fragmentStream);
|
||||||
// vertex + geometry + fragment shaders
|
}
|
||||||
CallbackStream vertexStream(vertexShaderStream);
|
}
|
||||||
CallbackStream fragmentStream(fragmentShaderStream);
|
else
|
||||||
success = shader->loadFromStream(vertexStream, geometryStream, fragmentStream);
|
{
|
||||||
}
|
CallbackStream geometryStream(geometryShaderStream);
|
||||||
|
if (!vertexShaderStream && !fragmentShaderStream) // geometry shader only
|
||||||
|
{
|
||||||
|
success = shader->loadFromStream(geometryStream, sf::Shader::Type::Geometry);
|
||||||
|
}
|
||||||
|
else // vertex + geometry + fragment shaders
|
||||||
|
{
|
||||||
|
CallbackStream vertexStream(vertexShaderStream);
|
||||||
|
CallbackStream fragmentStream(fragmentShaderStream);
|
||||||
|
success = shader->loadFromStream(vertexStream, geometryStream, fragmentStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,13 +201,14 @@ void sfShader_setVec4Uniform(sfShader* shader, const char* name, sfGlslVec4 vect
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void sfShader_setColorUniform(sfShader* shader, const char* name, sfColor color)
|
void sfShader_setColorUniform(sfShader* shader, const char* name, sfColor color)
|
||||||
{
|
{
|
||||||
sfGlslVec4 vec4;
|
sfShader_setVec4Uniform(shader,
|
||||||
vec4.x = color.r / 255.f;
|
name,
|
||||||
vec4.y = color.g / 255.f;
|
{
|
||||||
vec4.z = color.b / 255.f;
|
color.r / 255.f,
|
||||||
vec4.w = color.a / 255.f;
|
color.g / 255.f,
|
||||||
|
color.b / 255.f,
|
||||||
sfShader_setVec4Uniform(shader, name, vec4);
|
color.a / 255.f,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -278,13 +250,14 @@ void sfShader_setIvec4Uniform(sfShader* shader, const char* name, sfGlslIvec4 ve
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void sfShader_setIntColorUniform(sfShader* shader, const char* name, sfColor color)
|
void sfShader_setIntColorUniform(sfShader* shader, const char* name, sfColor color)
|
||||||
{
|
{
|
||||||
sfGlslIvec4 ivec4;
|
sfShader_setIvec4Uniform(shader,
|
||||||
ivec4.x = static_cast<int>(color.r);
|
name,
|
||||||
ivec4.y = static_cast<int>(color.g);
|
{
|
||||||
ivec4.z = static_cast<int>(color.b);
|
color.r,
|
||||||
ivec4.w = static_cast<int>(color.a);
|
color.g,
|
||||||
|
color.b,
|
||||||
sfShader_setIvec4Uniform(shader, name, ivec4);
|
color.a,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ unsigned int sfTexture_getNativeHandle(const sfTexture* texture)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void sfTexture_bind(const sfTexture* texture, sfTextureCoordinateType type)
|
void sfTexture_bind(const sfTexture* texture, sfCoordinateType type)
|
||||||
{
|
{
|
||||||
sf::Texture::bind(texture ? texture->This : nullptr, static_cast<sf::CoordinateType>(type));
|
sf::Texture::bind(texture ? texture->This : nullptr, static_cast<sf::CoordinateType>(type));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,13 @@ const sfTransform sfTransform_Identity = {
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfTransform sfTransform_fromMatrix(float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22)
|
sfTransform sfTransform_fromMatrix(float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22)
|
||||||
{
|
{
|
||||||
sfTransform transform = {a00, a01, a02, a10, a11, a12, a20, a21, a22};
|
// clang-format off
|
||||||
return transform;
|
return {
|
||||||
|
a00, a01, a02,
|
||||||
|
a10, a11, a12,
|
||||||
|
a20, a21, a22,
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfTransformable* sfTransformable_create()
|
sfTransformable* sfTransformable_create()
|
||||||
{
|
{
|
||||||
auto* transformable = new sfTransformable;
|
return new sfTransformable;
|
||||||
|
|
||||||
return transformable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,9 @@
|
|||||||
#include <CSFML/Graphics/VertexArrayStruct.hpp>
|
#include <CSFML/Graphics/VertexArrayStruct.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
static_assert(sizeof(sf::Vertex) == sizeof(sfVertex));
|
||||||
|
static_assert(alignof(sf::Vertex) == alignof(sfVertex));
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfVertexArray* sfVertexArray_create()
|
sfVertexArray* sfVertexArray_create()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfVertexBuffer* sfVertexBuffer_create(unsigned int vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage)
|
sfVertexBuffer* sfVertexBuffer_create(size_t vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage)
|
||||||
{
|
{
|
||||||
auto buffer = std::make_unique<sfVertexBuffer>();
|
auto buffer = std::make_unique<sfVertexBuffer>();
|
||||||
if (!buffer->create(vertexCount))
|
if (!buffer->create(vertexCount))
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ static_assert(alignof(sfChar32) == alignof(char32_t));
|
|||||||
{
|
{
|
||||||
const std::size_t byteCount = sizeof(sfChar32) * str.getSize();
|
const std::size_t byteCount = sizeof(sfChar32) * str.getSize();
|
||||||
auto* utf32 = static_cast<sfChar32*>(std::malloc(byteCount + sizeof(sfChar32)));
|
auto* utf32 = static_cast<sfChar32*>(std::malloc(byteCount + sizeof(sfChar32)));
|
||||||
|
if (!utf32)
|
||||||
|
return nullptr;
|
||||||
std::memcpy(utf32, str.getData(), byteCount);
|
std::memcpy(utf32, str.getData(), byteCount);
|
||||||
utf32[str.getSize()] = 0;
|
utf32[str.getSize()] = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -37,21 +37,13 @@ namespace
|
|||||||
// Helper function for converting a SFML address to a CSFML one
|
// Helper function for converting a SFML address to a CSFML one
|
||||||
[[nodiscard]] sfIpAddress fromSFMLAddress(std::optional<sf::IpAddress> address)
|
[[nodiscard]] sfIpAddress fromSFMLAddress(std::optional<sf::IpAddress> address)
|
||||||
{
|
{
|
||||||
sfIpAddress result = {0};
|
if (!address)
|
||||||
|
return sfIpAddress_None;
|
||||||
if (address)
|
|
||||||
{
|
|
||||||
strncpy(result.address, address->toString().c_str(), 15);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
sfIpAddress result{};
|
||||||
|
std::strncpy(result.address, address->toString().c_str(), 15);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function for converting a CSFML address to a SFML one
|
|
||||||
[[nodiscard]] std::optional<sf::IpAddress> toSFMLAddress(sfIpAddress address)
|
|
||||||
{
|
|
||||||
return sf::IpAddress::resolve(address.address);
|
|
||||||
}
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
@@ -97,14 +89,14 @@ sfIpAddress sfIpAddress_fromInteger(uint32_t address)
|
|||||||
void sfIpAddress_toString(sfIpAddress address, char* string)
|
void sfIpAddress_toString(sfIpAddress address, char* string)
|
||||||
{
|
{
|
||||||
if (string)
|
if (string)
|
||||||
strcpy(string, address.address);
|
std::strcpy(string, address.address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
uint32_t sfIpAddress_toInteger(sfIpAddress address)
|
uint32_t sfIpAddress_toInteger(sfIpAddress address)
|
||||||
{
|
{
|
||||||
auto sfmlAddress = toSFMLAddress(address);
|
const auto sfmlAddress = sf::IpAddress::resolve(address.address);
|
||||||
return sfmlAddress ? sfmlAddress->toInteger() : 0;
|
return sfmlAddress ? sfmlAddress->toInteger() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ bool sfPacket_endOfPacket(const sfPacket* packet)
|
|||||||
bool sfPacket_canRead(const sfPacket* packet)
|
bool sfPacket_canRead(const sfPacket* packet)
|
||||||
{
|
{
|
||||||
assert(packet);
|
assert(packet);
|
||||||
return static_cast<bool>(*packet);
|
return bool{*packet};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -173,14 +173,14 @@ double sfPacket_readDouble(sfPacket* packet)
|
|||||||
void sfPacket_readString(sfPacket* packet, char* string)
|
void sfPacket_readString(sfPacket* packet, char* string)
|
||||||
{
|
{
|
||||||
assert(packet);
|
assert(packet);
|
||||||
if (string)
|
assert(string);
|
||||||
*packet >> string;
|
*packet >> string;
|
||||||
}
|
}
|
||||||
void sfPacket_readWideString(sfPacket* packet, wchar_t* string)
|
void sfPacket_readWideString(sfPacket* packet, wchar_t* string)
|
||||||
{
|
{
|
||||||
assert(packet);
|
assert(packet);
|
||||||
if (string)
|
assert(string);
|
||||||
*packet >> string;
|
*packet >> string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -232,12 +232,12 @@ void sfPacket_writeDouble(sfPacket* packet, double value)
|
|||||||
void sfPacket_writeString(sfPacket* packet, const char* string)
|
void sfPacket_writeString(sfPacket* packet, const char* string)
|
||||||
{
|
{
|
||||||
assert(packet);
|
assert(packet);
|
||||||
if (string)
|
assert(string);
|
||||||
*packet << string;
|
*packet << string;
|
||||||
}
|
}
|
||||||
void sfPacket_writeWideString(sfPacket* packet, const wchar_t* string)
|
void sfPacket_writeWideString(sfPacket* packet, const wchar_t* string)
|
||||||
{
|
{
|
||||||
assert(packet);
|
assert(packet);
|
||||||
if (string)
|
assert(string);
|
||||||
*packet << string;
|
*packet << string;
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ sfIpAddress sfTcpSocket_getRemoteAddress(const sfTcpSocket* socket)
|
|||||||
sfIpAddress result = sfIpAddress_None;
|
sfIpAddress result = sfIpAddress_None;
|
||||||
if (address)
|
if (address)
|
||||||
{
|
{
|
||||||
strncpy(result.address, address->toString().c_str(), 15);
|
std::strncpy(result.address, address->toString().c_str(), 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket,
|
|||||||
|
|
||||||
if (address)
|
if (address)
|
||||||
{
|
{
|
||||||
strncpy(remoteAddress->address, address->toString().c_str(), 15);
|
std::strncpy(remoteAddress->address, address->toString().c_str(), 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet,
|
|||||||
|
|
||||||
if (address)
|
if (address)
|
||||||
{
|
{
|
||||||
strncpy(remoteAddress->address, address->toString().c_str(), 15);
|
std::strncpy(remoteAddress->address, address->toString().c_str(), 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,5 +33,5 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void sfFree(void* ptr)
|
void sfFree(void* ptr)
|
||||||
{
|
{
|
||||||
free(ptr);
|
std::free(ptr);
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfTime sfTime_Zero = {0};
|
const sfTime sfTime_Zero = {0};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -56,25 +56,19 @@ int64_t sfTime_asMicroseconds(sfTime time)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfTime sfSeconds(float amount)
|
sfTime sfSeconds(float amount)
|
||||||
{
|
{
|
||||||
sfTime time;
|
return {static_cast<int64_t>(amount * 1000000)};
|
||||||
time.microseconds = static_cast<int64_t>(amount * 1000000);
|
|
||||||
return time;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfTime sfMilliseconds(int32_t amount)
|
sfTime sfMilliseconds(int32_t amount)
|
||||||
{
|
{
|
||||||
sfTime time;
|
return {int64_t{amount} * 1000};
|
||||||
time.microseconds = static_cast<int64_t>(amount) * 1000;
|
|
||||||
return time;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sfTime sfMicroseconds(int64_t amount)
|
sfTime sfMicroseconds(int64_t amount)
|
||||||
{
|
{
|
||||||
sfTime time;
|
return {amount};
|
||||||
time.microseconds = amount;
|
|
||||||
return time;
|
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,7 @@ set(SRC
|
|||||||
${SRCROOT}/ContextStruct.hpp
|
${SRCROOT}/ContextStruct.hpp
|
||||||
${INCROOT}/Context.h
|
${INCROOT}/Context.h
|
||||||
${SRCROOT}/ConvertContextSettings.hpp
|
${SRCROOT}/ConvertContextSettings.hpp
|
||||||
|
${SRCROOT}/ConvertEvent.hpp
|
||||||
${SRCROOT}/ConvertVideoMode.hpp
|
${SRCROOT}/ConvertVideoMode.hpp
|
||||||
${INCROOT}/Event.h
|
${INCROOT}/Event.h
|
||||||
${SRCROOT}/Joystick.cpp
|
${SRCROOT}/Joystick.cpp
|
||||||
|
|||||||
@@ -0,0 +1,181 @@
|
|||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SFML - Simple and Fast Multimedia Library
|
||||||
|
// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
|
||||||
|
//
|
||||||
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
|
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
//
|
||||||
|
// Permission is granted to anyone to use this software for any purpose,
|
||||||
|
// including commercial applications, and to alter it and redistribute it freely,
|
||||||
|
// subject to the following restrictions:
|
||||||
|
//
|
||||||
|
// 1. The origin of this software must not be misrepresented;
|
||||||
|
// you must not claim that you wrote the original software.
|
||||||
|
// If you use this software in a product, an acknowledgment
|
||||||
|
// in the product documentation would be appreciated but is not required.
|
||||||
|
//
|
||||||
|
// 2. Altered source versions must be plainly marked as such,
|
||||||
|
// and must not be misrepresented as being the original software.
|
||||||
|
//
|
||||||
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <CSFML/System/ConvertVector2.hpp>
|
||||||
|
#include <CSFML/System/ConvertVector3.hpp>
|
||||||
|
#include <CSFML/Window/Event.h>
|
||||||
|
|
||||||
|
#include <SFML/Window/Event.hpp>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Convert sf::Event to sfEvent
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
[[nodiscard]] inline bool convertEvent(const std::optional<sf::Event>& sfmlEvent, sfEvent& event)
|
||||||
|
{
|
||||||
|
if (!sfmlEvent)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (sfmlEvent->is<sf::Event::Closed>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtClosed;
|
||||||
|
}
|
||||||
|
else if (const auto* resized = sfmlEvent->getIf<sf::Event::Resized>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtResized;
|
||||||
|
event.size.size = convertVector2(resized->size);
|
||||||
|
}
|
||||||
|
else if (sfmlEvent->is<sf::Event::FocusLost>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtFocusLost;
|
||||||
|
}
|
||||||
|
else if (sfmlEvent->is<sf::Event::FocusGained>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtFocusGained;
|
||||||
|
}
|
||||||
|
else if (const auto* textEntered = sfmlEvent->getIf<sf::Event::TextEntered>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtTextEntered;
|
||||||
|
event.text.unicode = textEntered->unicode;
|
||||||
|
}
|
||||||
|
else if (const auto* keyReleased = sfmlEvent->getIf<sf::Event::KeyReleased>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtKeyReleased;
|
||||||
|
event.key.code = static_cast<sfKeyCode>(keyReleased->code);
|
||||||
|
event.key.scancode = static_cast<sfScancode>(keyReleased->scancode);
|
||||||
|
event.key.alt = keyReleased->alt;
|
||||||
|
event.key.control = keyReleased->control;
|
||||||
|
event.key.shift = keyReleased->shift;
|
||||||
|
event.key.system = keyReleased->system;
|
||||||
|
}
|
||||||
|
else if (const auto* keyPressed = sfmlEvent->getIf<sf::Event::KeyPressed>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtKeyPressed;
|
||||||
|
event.key.code = static_cast<sfKeyCode>(keyPressed->code);
|
||||||
|
event.key.scancode = static_cast<sfScancode>(keyPressed->scancode);
|
||||||
|
event.key.alt = keyPressed->alt;
|
||||||
|
event.key.control = keyPressed->control;
|
||||||
|
event.key.shift = keyPressed->shift;
|
||||||
|
event.key.system = keyPressed->system;
|
||||||
|
}
|
||||||
|
else if (const auto* mouseWheelScrolled = sfmlEvent->getIf<sf::Event::MouseWheelScrolled>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtMouseWheelScrolled;
|
||||||
|
event.mouseWheelScroll.wheel = static_cast<sfMouseWheel>(mouseWheelScrolled->wheel);
|
||||||
|
event.mouseWheelScroll.delta = mouseWheelScrolled->delta;
|
||||||
|
event.mouseWheelScroll.position = convertVector2(mouseWheelScrolled->position);
|
||||||
|
}
|
||||||
|
else if (const auto* mouseButtonPressed = sfmlEvent->getIf<sf::Event::MouseButtonPressed>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtMouseButtonPressed;
|
||||||
|
event.mouseButton.button = static_cast<sfMouseButton>(mouseButtonPressed->button);
|
||||||
|
event.mouseButton.position = convertVector2(mouseButtonPressed->position);
|
||||||
|
}
|
||||||
|
else if (const auto* mouseButtonReleased = sfmlEvent->getIf<sf::Event::MouseButtonReleased>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtMouseButtonReleased;
|
||||||
|
event.mouseButton.button = static_cast<sfMouseButton>(mouseButtonReleased->button);
|
||||||
|
event.mouseButton.position = convertVector2(mouseButtonReleased->position);
|
||||||
|
}
|
||||||
|
else if (const auto* mouseMoved = sfmlEvent->getIf<sf::Event::MouseMoved>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtMouseMoved;
|
||||||
|
event.mouseMove.position = convertVector2(mouseMoved->position);
|
||||||
|
}
|
||||||
|
else if (const auto* mouseMovedRaw = sfmlEvent->getIf<sf::Event::MouseMovedRaw>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtMouseMovedRaw;
|
||||||
|
event.mouseMoveRaw.delta = convertVector2(mouseMovedRaw->delta);
|
||||||
|
}
|
||||||
|
else if (sfmlEvent->is<sf::Event::MouseEntered>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtMouseEntered;
|
||||||
|
}
|
||||||
|
else if (sfmlEvent->is<sf::Event::MouseLeft>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtMouseLeft;
|
||||||
|
}
|
||||||
|
else if (const auto* joystickButtonPressed = sfmlEvent->getIf<sf::Event::JoystickButtonPressed>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtJoystickButtonPressed;
|
||||||
|
event.joystickButton.joystickId = joystickButtonPressed->joystickId;
|
||||||
|
event.joystickButton.button = joystickButtonPressed->button;
|
||||||
|
}
|
||||||
|
else if (const auto* joystickButtonReleased = sfmlEvent->getIf<sf::Event::JoystickButtonReleased>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtJoystickButtonReleased;
|
||||||
|
event.joystickButton.joystickId = joystickButtonReleased->joystickId;
|
||||||
|
event.joystickButton.button = joystickButtonReleased->button;
|
||||||
|
}
|
||||||
|
else if (const auto* joystickMoved = sfmlEvent->getIf<sf::Event::JoystickMoved>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtJoystickMoved;
|
||||||
|
event.joystickMove.joystickId = joystickMoved->joystickId;
|
||||||
|
event.joystickMove.axis = static_cast<sfJoystickAxis>(joystickMoved->axis);
|
||||||
|
event.joystickMove.position = joystickMoved->position;
|
||||||
|
}
|
||||||
|
else if (const auto* joystickConnected = sfmlEvent->getIf<sf::Event::JoystickConnected>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtJoystickConnected;
|
||||||
|
event.joystickConnect.joystickId = joystickConnected->joystickId;
|
||||||
|
}
|
||||||
|
else if (const auto* joystickDisconnected = sfmlEvent->getIf<sf::Event::JoystickDisconnected>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtJoystickDisconnected;
|
||||||
|
event.joystickConnect.joystickId = joystickDisconnected->joystickId;
|
||||||
|
}
|
||||||
|
else if (const auto* touchBegan = sfmlEvent->getIf<sf::Event::TouchBegan>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtTouchBegan;
|
||||||
|
event.touch.finger = touchBegan->finger;
|
||||||
|
event.touch.position = convertVector2(touchBegan->position);
|
||||||
|
}
|
||||||
|
else if (const auto* touchMoved = sfmlEvent->getIf<sf::Event::TouchMoved>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtTouchMoved;
|
||||||
|
event.touch.finger = touchMoved->finger;
|
||||||
|
event.touch.position = convertVector2(touchMoved->position);
|
||||||
|
}
|
||||||
|
else if (const auto* touchEnded = sfmlEvent->getIf<sf::Event::TouchEnded>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtTouchEnded;
|
||||||
|
event.touch.finger = touchEnded->finger;
|
||||||
|
event.touch.position = convertVector2(touchEnded->position);
|
||||||
|
}
|
||||||
|
else if (const auto* sensorChanged = sfmlEvent->getIf<sf::Event::SensorChanged>())
|
||||||
|
{
|
||||||
|
event.type = sfEvtSensorChanged;
|
||||||
|
event.sensor.sensorType = static_cast<sfSensorType>(sensorChanged->type);
|
||||||
|
event.sensor.value = convertVector3(sensorChanged->value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -41,14 +41,13 @@ sfVideoMode sfVideoMode_getDesktopMode()
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const sfVideoMode* sfVideoMode_getFullscreenModes(size_t* count)
|
const sfVideoMode* sfVideoMode_getFullscreenModes(size_t* count)
|
||||||
{
|
{
|
||||||
static std::vector<sfVideoMode> modes;
|
static const auto modes = []
|
||||||
|
|
||||||
// Populate the array on first call
|
|
||||||
if (modes.empty())
|
|
||||||
{
|
{
|
||||||
|
std::vector<sfVideoMode> videomodes;
|
||||||
for (const auto& mode : sf::VideoMode::getFullscreenModes())
|
for (const auto& mode : sf::VideoMode::getFullscreenModes())
|
||||||
modes.push_back(convertVideoMode(mode));
|
videomodes.push_back(convertVideoMode(mode));
|
||||||
}
|
return videomodes;
|
||||||
|
}();
|
||||||
|
|
||||||
if (count)
|
if (count)
|
||||||
*count = modes.size();
|
*count = modes.size();
|
||||||
|
|||||||
@@ -31,9 +31,6 @@
|
|||||||
|
|
||||||
#include <SFML/Window/Vulkan.hpp>
|
#include <SFML/Window/Vulkan.hpp>
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool sfVulkan_isAvailable(bool requireGraphics)
|
bool sfVulkan_isAvailable(bool requireGraphics)
|
||||||
@@ -52,7 +49,7 @@ sfVulkanFunctionPointer sfVulkan_getFunction(const char* name)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const char* const* sfVulkan_getGraphicsRequiredInstanceExtensions(size_t* count)
|
const char* const* sfVulkan_getGraphicsRequiredInstanceExtensions(size_t* count)
|
||||||
{
|
{
|
||||||
static std::vector<const char*> extensions = sf::Vulkan::getGraphicsRequiredInstanceExtensions();
|
static const std::vector<const char*> extensions = sf::Vulkan::getGraphicsRequiredInstanceExtensions();
|
||||||
|
|
||||||
if (count)
|
if (count)
|
||||||
*count = extensions.size();
|
*count = extensions.size();
|
||||||
|
|||||||
@@ -25,9 +25,9 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <CSFML/ConvertEvent.hpp>
|
|
||||||
#include <CSFML/System/ConvertVector2.hpp>
|
#include <CSFML/System/ConvertVector2.hpp>
|
||||||
#include <CSFML/Window/ConvertContextSettings.hpp>
|
#include <CSFML/Window/ConvertContextSettings.hpp>
|
||||||
|
#include <CSFML/Window/ConvertEvent.hpp>
|
||||||
#include <CSFML/Window/ConvertVideoMode.hpp>
|
#include <CSFML/Window/ConvertVideoMode.hpp>
|
||||||
#include <CSFML/Window/CursorStruct.hpp>
|
#include <CSFML/Window/CursorStruct.hpp>
|
||||||
#include <CSFML/Window/Window.h>
|
#include <CSFML/Window/Window.h>
|
||||||
@@ -114,7 +114,7 @@ bool sfWindow_pollEvent(sfWindow* window, sfEvent* event)
|
|||||||
{
|
{
|
||||||
assert(window);
|
assert(window);
|
||||||
assert(event);
|
assert(event);
|
||||||
return convertEvent(window->pollEvent(), event);
|
return convertEvent(window->pollEvent(), *event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ bool sfWindow_waitEvent(sfWindow* window, sfTime timeout, sfEvent* event)
|
|||||||
{
|
{
|
||||||
assert(window);
|
assert(window);
|
||||||
assert(event);
|
assert(event);
|
||||||
return convertEvent(window->waitEvent(sf::microseconds(timeout.microseconds)), event);
|
return convertEvent(window->waitEvent(sf::microseconds(timeout.microseconds)), *event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <CSFML/ConvertEvent.hpp>
|
|
||||||
#include <CSFML/System/ConvertVector2.hpp>
|
#include <CSFML/System/ConvertVector2.hpp>
|
||||||
|
#include <CSFML/Window/ConvertEvent.hpp>
|
||||||
#include <CSFML/Window/ConvertVideoMode.hpp>
|
#include <CSFML/Window/ConvertVideoMode.hpp>
|
||||||
#include <CSFML/Window/CursorStruct.hpp>
|
#include <CSFML/Window/CursorStruct.hpp>
|
||||||
#include <CSFML/Window/WindowBase.h>
|
#include <CSFML/Window/WindowBase.h>
|
||||||
@@ -96,7 +96,7 @@ bool sfWindowBase_pollEvent(sfWindowBase* windowBase, sfEvent* event)
|
|||||||
{
|
{
|
||||||
assert(windowBase);
|
assert(windowBase);
|
||||||
assert(event);
|
assert(event);
|
||||||
return convertEvent(windowBase->pollEvent(), event);
|
return convertEvent(windowBase->pollEvent(), *event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ bool sfWindowBase_waitEvent(sfWindowBase* windowBase, sfTime timeout, sfEvent* e
|
|||||||
{
|
{
|
||||||
assert(windowBase);
|
assert(windowBase);
|
||||||
assert(event);
|
assert(event);
|
||||||
return convertEvent(windowBase->waitEvent(sf::microseconds(timeout.microseconds)), event);
|
return convertEvent(windowBase->waitEvent(sf::microseconds(timeout.microseconds)), *event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,4 +28,7 @@ TEST_CASE("[System] sfTime")
|
|||||||
CHECK(sfSeconds(10).microseconds == 10'000'000);
|
CHECK(sfSeconds(10).microseconds == 10'000'000);
|
||||||
CHECK(sfMilliseconds(10).microseconds == 10'000);
|
CHECK(sfMilliseconds(10).microseconds == 10'000);
|
||||||
CHECK(sfMicroseconds(10).microseconds == 10);
|
CHECK(sfMicroseconds(10).microseconds == 10);
|
||||||
|
|
||||||
|
CHECK(sfMilliseconds(std::numeric_limits<int32_t>::max()).microseconds == 2'147'483'647'000);
|
||||||
|
CHECK(sfMicroseconds(std::numeric_limits<int64_t>::max()).microseconds == std::numeric_limits<int64_t>::max());
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ TEST_CASE("[Window] sfJoystick")
|
|||||||
// no joysticks will be detected. This is how we can ensure these
|
// no joysticks will be detected. This is how we can ensure these
|
||||||
// tests are portable and reliable.
|
// tests are portable and reliable.
|
||||||
|
|
||||||
const auto joystick = GENERATE(range(0u, static_cast<unsigned int>(sfJoystickCount - 1)));
|
const auto joystick = GENERATE(range(0u, unsigned{sfJoystickCount - 1}));
|
||||||
|
|
||||||
SECTION("sfJoystick_isConnected()")
|
SECTION("sfJoystick_isConnected()")
|
||||||
{
|
{
|
||||||
@@ -56,7 +56,7 @@ TEST_CASE("[Window] sfJoystick")
|
|||||||
|
|
||||||
SECTION("sfJoystick_isButtonPressed()")
|
SECTION("sfJoystick_isButtonPressed()")
|
||||||
{
|
{
|
||||||
const auto button = GENERATE(range(0u, static_cast<unsigned int>(sfJoystickButtonCount - 1)));
|
const auto button = GENERATE(range(0u, unsigned{sfJoystickButtonCount - 1}));
|
||||||
CHECK(!sfJoystick_isButtonPressed(joystick, button));
|
CHECK(!sfJoystick_isButtonPressed(joystick, button));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ TEST_CASE("[Window] sfMouse")
|
|||||||
STATIC_CHECK(sfMouseLeft == static_cast<int>(sf::Mouse::Button::Left));
|
STATIC_CHECK(sfMouseLeft == static_cast<int>(sf::Mouse::Button::Left));
|
||||||
STATIC_CHECK(sfMouseRight == static_cast<int>(sf::Mouse::Button::Right));
|
STATIC_CHECK(sfMouseRight == static_cast<int>(sf::Mouse::Button::Right));
|
||||||
STATIC_CHECK(sfMouseMiddle == static_cast<int>(sf::Mouse::Button::Middle));
|
STATIC_CHECK(sfMouseMiddle == static_cast<int>(sf::Mouse::Button::Middle));
|
||||||
STATIC_CHECK(sfMouseXButton1 == static_cast<int>(sf::Mouse::Button::Extra1));
|
STATIC_CHECK(sfMouseButtonExtra1 == static_cast<int>(sf::Mouse::Button::Extra1));
|
||||||
STATIC_CHECK(sfMouseXButton2 == static_cast<int>(sf::Mouse::Button::Extra2));
|
STATIC_CHECK(sfMouseButtonExtra2 == static_cast<int>(sf::Mouse::Button::Extra2));
|
||||||
STATIC_CHECK(sfMouseButtonCount == sf::Mouse::ButtonCount);
|
STATIC_CHECK(sfMouseButtonCount == sf::Mouse::ButtonCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ cmake `
|
|||||||
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=$CSFMLLibDir" `
|
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=$CSFMLLibDir" `
|
||||||
`
|
`
|
||||||
'-DCMAKE_SYSTEM_VERSION=8.1' `
|
'-DCMAKE_SYSTEM_VERSION=8.1' `
|
||||||
'-DSTATIC_STD_LIBS=OFF' `
|
'-DCSFML_USE_STATIC_STD_LIBS=OFF' `
|
||||||
`
|
`
|
||||||
'-DBUILD_SHARED_LIBS=ON' `
|
'-DBUILD_SHARED_LIBS=ON' `
|
||||||
'-DCMAKE_BUILD_TYPE=Release' `
|
'-DCMAKE_BUILD_TYPE=Release' `
|
||||||
|
|||||||
Reference in new issue
Block a user