mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Upgrade to clang-format-17
This commit is contained in:
parent
7a8d75b7ac
commit
c38b98c653
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@ -269,17 +269,17 @@ jobs:
|
|||||||
|
|
||||||
format:
|
format:
|
||||||
name: Formatting
|
name: Formatting
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -529,7 +529,7 @@ if(SFML_BUILD_TEST_SUITE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
sfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 14")
|
sfml_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)
|
||||||
|
@ -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
|
||||||
|
@ -316,10 +316,10 @@ private:
|
|||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
sf::RenderWindow m_window{sf::VideoMode({800u, 600u}), "SFML Event Handling", sf::Style::Titlebar | sf::Style::Close};
|
sf::RenderWindow m_window{sf::VideoMode({800u, 600u}), "SFML Event Handling", sf::Style::Titlebar | sf::Style::Close};
|
||||||
const sf::Font m_font{"resources/tuffy.ttf"};
|
const sf::Font m_font{"resources/tuffy.ttf"};
|
||||||
sf::Text m_logText{m_font, "", 20};
|
sf::Text m_logText{m_font, "", 20};
|
||||||
sf::Text m_handlerText{m_font, "Current Handler: Classic", 24};
|
sf::Text m_handlerText{m_font, "Current Handler: Classic", 24};
|
||||||
sf::Text m_instructions{m_font, "Press Enter to change handler type", 24};
|
sf::Text m_instructions{m_font, "Press Enter to change handler type", 24};
|
||||||
std::vector<std::string> m_log;
|
std::vector<std::string> m_log;
|
||||||
HandlerType m_handlerType{HandlerType::Classic};
|
HandlerType m_handlerType{HandlerType::Classic};
|
||||||
};
|
};
|
||||||
|
@ -285,12 +285,12 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
std::unique_ptr<SoundFileReader> m_reader; //!< Reader that handles I/O on the file's format
|
std::unique_ptr<SoundFileReader> m_reader; //!< Reader that handles I/O on the file's format
|
||||||
std::unique_ptr<InputStream, StreamDeleter> m_stream{nullptr, false}; //!< Input stream used to access the file's data
|
std::unique_ptr<InputStream, StreamDeleter> m_stream{nullptr, false}; //!< Input stream used to access the file's data
|
||||||
std::uint64_t m_sampleOffset{}; //!< Sample Read Position
|
std::uint64_t m_sampleOffset{}; //!< Sample Read Position
|
||||||
std::uint64_t m_sampleCount{}; //!< Total number of samples in the file
|
std::uint64_t m_sampleCount{}; //!< Total number of samples in the file
|
||||||
unsigned int m_sampleRate{}; //!< Number of samples per second
|
unsigned int m_sampleRate{}; //!< Number of samples per second
|
||||||
std::vector<SoundChannel> m_channelMap; //!< The map of position in sample frame to sound channel
|
std::vector<SoundChannel> m_channelMap; //!< The map of position in sample frame to sound channel
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
@ -365,8 +365,8 @@ private:
|
|||||||
std::vector<std::int16_t> m_samples; //!< Samples buffer
|
std::vector<std::int16_t> m_samples; //!< Samples buffer
|
||||||
unsigned int m_sampleRate{44100}; //!< Number of samples per second
|
unsigned int m_sampleRate{44100}; //!< Number of samples per second
|
||||||
std::vector<SoundChannel> m_channelMap{SoundChannel::Mono}; //!< The map of position in sample frame to sound channel
|
std::vector<SoundChannel> m_channelMap{SoundChannel::Mono}; //!< The map of position in sample frame to sound channel
|
||||||
Time m_duration; //!< Sound duration
|
Time m_duration; //!< Sound duration
|
||||||
mutable SoundList m_sounds; //!< List of sounds that are using this buffer
|
mutable SoundList m_sounds; //!< List of sounds that are using this buffer
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
@ -110,7 +110,7 @@ struct SFML_GRAPHICS_API StencilMode
|
|||||||
StencilUpdateOperation::Keep}; //!< The update operation to perform if the stencil test passes
|
StencilUpdateOperation::Keep}; //!< The update operation to perform if the stencil test passes
|
||||||
StencilValue stencilReference{0}; //!< The reference value we're performing the stencil test with
|
StencilValue stencilReference{0}; //!< The reference value we're performing the stencil test with
|
||||||
StencilValue stencilMask{~0u}; //!< The mask to apply to both the reference value and the value in the stencil buffer
|
StencilValue stencilMask{~0u}; //!< The mask to apply to both the reference value and the value in the stencil buffer
|
||||||
bool stencilOnly{}; //!< Whether we should update the color buffer in addition to the stencil buffer
|
bool stencilOnly{}; //!< Whether we should update the color buffer in addition to the stencil buffer
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -214,10 +214,10 @@ public:
|
|||||||
NotModified = 304, //!< For conditional requests, means the requested page hasn't changed and doesn't need to be refreshed
|
NotModified = 304, //!< For conditional requests, means the requested page hasn't changed and doesn't need to be refreshed
|
||||||
|
|
||||||
// 4xx: client error
|
// 4xx: client error
|
||||||
BadRequest = 400, //!< The server couldn't understand the request (syntax error)
|
BadRequest = 400, //!< The server couldn't understand the request (syntax error)
|
||||||
Unauthorized = 401, //!< The requested page needs an authentication to be accessed
|
Unauthorized = 401, //!< The requested page needs an authentication to be accessed
|
||||||
Forbidden = 403, //!< The requested page cannot be accessed at all, even with authentication
|
Forbidden = 403, //!< The requested page cannot be accessed at all, even with authentication
|
||||||
NotFound = 404, //!< The requested page doesn't exist
|
NotFound = 404, //!< The requested page doesn't exist
|
||||||
RangeNotSatisfiable = 407, //!< The server can't satisfy the partial GET request (with a "Range" header field)
|
RangeNotSatisfiable = 407, //!< The server can't satisfy the partial GET request (with a "Range" header field)
|
||||||
|
|
||||||
// 5xx: server error
|
// 5xx: server error
|
||||||
|
@ -123,8 +123,8 @@ public:
|
|||||||
struct MouseWheelScrolled
|
struct MouseWheelScrolled
|
||||||
{
|
{
|
||||||
Mouse::Wheel wheel{}; //!< Which wheel (for mice with multiple ones)
|
Mouse::Wheel wheel{}; //!< Which wheel (for mice with multiple ones)
|
||||||
float delta{}; //!< Wheel offset (positive is up/left, negative is down/right). High-precision mice may use non-integral offsets.
|
float delta{}; //!< Wheel offset (positive is up/left, negative is down/right). High-precision mice may use non-integral offsets.
|
||||||
Vector2i position; //!< Position of the mouse pointer, relative to the top left of the owner window
|
Vector2i position; //!< Position of the mouse pointer, relative to the top left of the owner window
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -92,12 +92,12 @@ struct SoundBase
|
|||||||
};
|
};
|
||||||
|
|
||||||
ma_data_source_base dataSourceBase{}; //!< The struct that makes this object a miniaudio data source (must be first member)
|
ma_data_source_base dataSourceBase{}; //!< The struct that makes this object a miniaudio data source (must be first member)
|
||||||
ma_node_vtable effectNodeVTable{}; //!< Vtable of the effect node
|
ma_node_vtable effectNodeVTable{}; //!< Vtable of the effect node
|
||||||
EffectNode effectNode; //!< The engine node that performs effect processing
|
EffectNode effectNode; //!< The engine node that performs effect processing
|
||||||
std::vector<ma_channel> soundChannelMap; //!< The map of position in sample frame to sound channel (miniaudio channels)
|
std::vector<ma_channel> soundChannelMap; //!< The map of position in sample frame to sound channel (miniaudio channels)
|
||||||
ma_sound sound{}; //!< The sound
|
ma_sound sound{}; //!< The sound
|
||||||
SoundSource::Status status{SoundSource::Status::Stopped}; //!< The status
|
SoundSource::Status status{SoundSource::Status::Stopped}; //!< The status
|
||||||
SoundSource::EffectProcessor effectProcessor; //!< The effect processor
|
SoundSource::EffectProcessor effectProcessor; //!< The effect processor
|
||||||
AudioDevice::ResourceEntryIter resourceEntryIter; //!< Iterator to the resource entry registered with the AudioDevice
|
AudioDevice::ResourceEntryIter resourceEntryIter; //!< Iterator to the resource entry registered with the AudioDevice
|
||||||
MiniaudioUtils::SavedSettings savedSettings; //!< Saved settings used to restore ma_sound state in case we need to recreate it
|
MiniaudioUtils::SavedSettings savedSettings; //!< Saved settings used to restore ma_sound state in case we need to recreate it
|
||||||
};
|
};
|
||||||
|
@ -211,15 +211,15 @@ struct SoundStream::Impl : priv::MiniaudioUtils::SoundBase
|
|||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
static constexpr ma_data_source_vtable vtable{read, seek, getFormat, getCursor, getLength, setLooping, /* flags */ 0};
|
static constexpr ma_data_source_vtable vtable{read, seek, getFormat, getCursor, getLength, setLooping, /* flags */ 0};
|
||||||
SoundStream* owner; //!< Owning SoundStream object
|
SoundStream* owner; //!< Owning SoundStream object
|
||||||
std::vector<std::int16_t> sampleBuffer; //!< Our temporary sample buffer
|
std::vector<std::int16_t> sampleBuffer; //!< Our temporary sample buffer
|
||||||
std::size_t sampleBufferCursor{}; //!< The current read position in the temporary sample buffer
|
std::size_t sampleBufferCursor{}; //!< The current read position in the temporary sample buffer
|
||||||
std::uint64_t samplesProcessed{}; //!< Number of samples processed since beginning of the stream
|
std::uint64_t samplesProcessed{}; //!< Number of samples processed since beginning of the stream
|
||||||
unsigned int channelCount{}; //!< Number of channels (1 = mono, 2 = stereo, ...)
|
unsigned int channelCount{}; //!< Number of channels (1 = mono, 2 = stereo, ...)
|
||||||
unsigned int sampleRate{}; //!< Frequency (samples / second)
|
unsigned int sampleRate{}; //!< Frequency (samples / second)
|
||||||
std::vector<SoundChannel> channelMap; //!< The map of position in sample frame to sound channel
|
std::vector<SoundChannel> channelMap; //!< The map of position in sample frame to sound channel
|
||||||
bool loop{}; //!< Loop flag (`true` to loop, `false` to play once)
|
bool loop{}; //!< Loop flag (`true` to loop, `false` to play once)
|
||||||
bool streaming{true}; //!< `true` if we are still streaming samples from the source
|
bool streaming{true}; //!< `true` if we are still streaming samples from the source
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ bool Image::copy(const Image& source, Vector2u dest, const IntRect& sourceRect,
|
|||||||
const unsigned int dstStride = m_size.x * 4;
|
const unsigned int dstStride = m_size.x * 4;
|
||||||
|
|
||||||
const std::uint8_t* srcPixels = source.m_pixels.data() + (srcRect.position.x + srcRect.position.y * source.m_size.x) * 4;
|
const std::uint8_t* srcPixels = source.m_pixels.data() + (srcRect.position.x + srcRect.position.y * source.m_size.x) * 4;
|
||||||
std::uint8_t* dstPixels = m_pixels.data() + (dest.x + dest.y * m_size.x) * 4;
|
std::uint8_t* dstPixels = m_pixels.data() + (dest.x + dest.y * m_size.x) * 4;
|
||||||
|
|
||||||
// Copy the pixels
|
// Copy the pixels
|
||||||
if (applyAlpha)
|
if (applyAlpha)
|
||||||
|
@ -890,7 +890,7 @@ void RenderTarget::drawPrimitives(PrimitiveType type, std::size_t firstVertex, s
|
|||||||
{
|
{
|
||||||
// Find the OpenGL primitive type
|
// Find the OpenGL primitive type
|
||||||
static constexpr GLenum modes[] = {GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN};
|
static constexpr GLenum modes[] = {GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN};
|
||||||
const GLenum mode = modes[static_cast<std::size_t>(type)];
|
const GLenum mode = modes[static_cast<std::size_t>(type)];
|
||||||
|
|
||||||
// Draw the primitives
|
// Draw the primitives
|
||||||
glCheck(glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount)));
|
glCheck(glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount)));
|
||||||
|
@ -515,10 +515,10 @@ Image Texture::copyToImage() const
|
|||||||
glCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, allPixels.data()));
|
glCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, allPixels.data()));
|
||||||
|
|
||||||
// Then we copy the useful pixels from the temporary array to the final one
|
// Then we copy the useful pixels from the temporary array to the final one
|
||||||
const std::uint8_t* src = allPixels.data();
|
const std::uint8_t* src = allPixels.data();
|
||||||
std::uint8_t* dst = pixels.data();
|
std::uint8_t* dst = pixels.data();
|
||||||
int srcPitch = static_cast<int>(m_actualSize.x * 4);
|
int srcPitch = static_cast<int>(m_actualSize.x * 4);
|
||||||
const unsigned int dstPitch = m_size.x * 4;
|
const unsigned int dstPitch = m_size.x * 4;
|
||||||
|
|
||||||
// Handle the case where source pixels are flipped vertically
|
// Handle the case where source pixels are flipped vertically
|
||||||
if (m_pixelsFlipped)
|
if (m_pixelsFlipped)
|
||||||
|
@ -171,7 +171,7 @@ void goToFullscreenMode(ANativeActivity& activity)
|
|||||||
// API Level 19
|
// API Level 19
|
||||||
if (apiLevel >= 19)
|
if (apiLevel >= 19)
|
||||||
{
|
{
|
||||||
jfieldID fieldSystemUiFlagImmersiveSticky = lJNIEnv->GetStaticFieldID(classView,
|
jfieldID fieldSystemUiFlagImmersiveSticky = lJNIEnv->GetStaticFieldID(classView,
|
||||||
"SYSTEM_UI_FLAG_IMMERSIVE_STICKY",
|
"SYSTEM_UI_FLAG_IMMERSIVE_STICKY",
|
||||||
"I");
|
"I");
|
||||||
const jint systemUiFlagImmersiveSticky = lJNIEnv->GetStaticIntField(classView, fieldSystemUiFlagImmersiveSticky);
|
const jint systemUiFlagImmersiveSticky = lJNIEnv->GetStaticIntField(classView, fieldSystemUiFlagImmersiveSticky);
|
||||||
|
@ -441,7 +441,7 @@ Packet& Packet::operator<<(std::int64_t data)
|
|||||||
static_cast<std::uint8_t>((data >> 24) & 0xFF),
|
static_cast<std::uint8_t>((data >> 24) & 0xFF),
|
||||||
static_cast<std::uint8_t>((data >> 16) & 0xFF),
|
static_cast<std::uint8_t>((data >> 16) & 0xFF),
|
||||||
static_cast<std::uint8_t>((data >> 8) & 0xFF),
|
static_cast<std::uint8_t>((data >> 8) & 0xFF),
|
||||||
static_cast<std::uint8_t>((data)&0xFF)};
|
static_cast<std::uint8_t>((data) & 0xFF)};
|
||||||
|
|
||||||
append(&toWrite, sizeof(toWrite));
|
append(&toWrite, sizeof(toWrite));
|
||||||
return *this;
|
return *this;
|
||||||
@ -461,7 +461,7 @@ Packet& Packet::operator<<(std::uint64_t data)
|
|||||||
static_cast<std::uint8_t>((data >> 24) & 0xFF),
|
static_cast<std::uint8_t>((data >> 24) & 0xFF),
|
||||||
static_cast<std::uint8_t>((data >> 16) & 0xFF),
|
static_cast<std::uint8_t>((data >> 16) & 0xFF),
|
||||||
static_cast<std::uint8_t>((data >> 8) & 0xFF),
|
static_cast<std::uint8_t>((data >> 8) & 0xFF),
|
||||||
static_cast<std::uint8_t>((data)&0xFF)};
|
static_cast<std::uint8_t>((data) & 0xFF)};
|
||||||
|
|
||||||
append(&toWrite, sizeof(toWrite));
|
append(&toWrite, sizeof(toWrite));
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -413,7 +413,7 @@ XVisualInfo EglContext::selectBestVisual(::Display* xDisplay, unsigned int bitsP
|
|||||||
vTemplate.visualid = static_cast<VisualID>(nativeVisualId);
|
vTemplate.visualid = static_cast<VisualID>(nativeVisualId);
|
||||||
|
|
||||||
// Get X11 visuals compatible with this EGL config
|
// Get X11 visuals compatible with this EGL config
|
||||||
int visualCount = 0;
|
int visualCount = 0;
|
||||||
const auto availableVisuals = X11Ptr<XVisualInfo[]>(XGetVisualInfo(xDisplay, VisualIDMask, &vTemplate, &visualCount));
|
const auto availableVisuals = X11Ptr<XVisualInfo[]>(XGetVisualInfo(xDisplay, VisualIDMask, &vTemplate, &visualCount));
|
||||||
|
|
||||||
if (visualCount == 0)
|
if (visualCount == 0)
|
||||||
|
@ -1046,7 +1046,7 @@ void GlContext::initialize(const ContextSettings& requestedSettings)
|
|||||||
void GlContext::checkSettings(const ContextSettings& requestedSettings) const
|
void GlContext::checkSettings(const ContextSettings& requestedSettings) const
|
||||||
{
|
{
|
||||||
// Perform checks to inform the user if they are getting a context they might not have expected
|
// Perform checks to inform the user if they are getting a context they might not have expected
|
||||||
const int version = static_cast<int>(m_settings.majorVersion * 10u + m_settings.minorVersion);
|
const int version = static_cast<int>(m_settings.majorVersion * 10u + m_settings.minorVersion);
|
||||||
const int requestedVersion = static_cast<int>(requestedSettings.majorVersion * 10u + requestedSettings.minorVersion);
|
const int requestedVersion = static_cast<int>(requestedSettings.majorVersion * 10u + requestedSettings.minorVersion);
|
||||||
|
|
||||||
if ((m_settings.attributeFlags != requestedSettings.attributeFlags) || (version < requestedVersion) ||
|
if ((m_settings.attributeFlags != requestedSettings.attributeFlags) || (version < requestedVersion) ||
|
||||||
|
@ -80,8 +80,8 @@ bool CursorImpl::loadFromPixelsARGB(const std::uint8_t* pixels, Vector2u size, V
|
|||||||
{
|
{
|
||||||
// Create cursor image, convert from RGBA to ARGB.
|
// Create cursor image, convert from RGBA to ARGB.
|
||||||
const auto cursorImage = X11Ptr<XcursorImage>(XcursorImageCreate(static_cast<int>(size.x), static_cast<int>(size.y)));
|
const auto cursorImage = X11Ptr<XcursorImage>(XcursorImageCreate(static_cast<int>(size.x), static_cast<int>(size.y)));
|
||||||
cursorImage->xhot = hotspot.x;
|
cursorImage->xhot = hotspot.x;
|
||||||
cursorImage->yhot = hotspot.y;
|
cursorImage->yhot = hotspot.y;
|
||||||
|
|
||||||
const std::size_t numPixels = std::size_t{size.x} * std::size_t{size.y};
|
const std::size_t numPixels = std::size_t{size.x} * std::size_t{size.y};
|
||||||
for (std::size_t pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex)
|
for (std::size_t pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex)
|
||||||
|
@ -565,7 +565,7 @@ JoystickCaps JoystickImpl::getCapabilities() const
|
|||||||
{
|
{
|
||||||
switch (m_mapping[static_cast<std::size_t>(i)])
|
switch (m_mapping[static_cast<std::size_t>(i)])
|
||||||
{
|
{
|
||||||
// clang-format off
|
// clang-format off
|
||||||
case ABS_X: caps.axes[Joystick::Axis::X] = true; break;
|
case ABS_X: caps.axes[Joystick::Axis::X] = true; break;
|
||||||
case ABS_Y: caps.axes[Joystick::Axis::Y] = true; break;
|
case ABS_Y: caps.axes[Joystick::Axis::Y] = true; break;
|
||||||
case ABS_Z:
|
case ABS_Z:
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
const KeyCode nullKeyCode = 0;
|
const KeyCode nullKeyCode = 0;
|
||||||
const int maxKeyCode = 256;
|
const int maxKeyCode = 256;
|
||||||
sf::priv::EnumArray<sf::Keyboard::Scancode, KeyCode, sf::Keyboard::ScancodeCount> scancodeToKeycode; ///< Mapping of SFML scancode to X11 KeyCode
|
sf::priv::EnumArray<sf::Keyboard::Scancode, KeyCode, sf::Keyboard::ScancodeCount> scancodeToKeycode; ///< Mapping of SFML scancode to X11 KeyCode
|
||||||
std::array<sf::Keyboard::Scancode, maxKeyCode> keycodeToScancode; ///< Mapping of X11 KeyCode to SFML scancode
|
std::array<sf::Keyboard::Scancode, maxKeyCode> keycodeToScancode; ///< Mapping of X11 KeyCode to SFML scancode
|
||||||
|
|
||||||
|
@ -327,15 +327,15 @@ private:
|
|||||||
RRCrtc m_oldRRCrtc{}; ///< RRCrtc in use before we switch to fullscreen
|
RRCrtc m_oldRRCrtc{}; ///< RRCrtc in use before we switch to fullscreen
|
||||||
::Cursor m_hiddenCursor{}; ///< As X11 doesn't provide cursor hiding, we must create a transparent one
|
::Cursor m_hiddenCursor{}; ///< As X11 doesn't provide cursor hiding, we must create a transparent one
|
||||||
::Cursor m_lastCursor{None}; ///< Last cursor used -- this data is not owned by the window and is required to be always valid
|
::Cursor m_lastCursor{None}; ///< Last cursor used -- this data is not owned by the window and is required to be always valid
|
||||||
bool m_keyRepeat{true}; ///< Is the KeyRepeat feature enabled?
|
bool m_keyRepeat{true}; ///< Is the KeyRepeat feature enabled?
|
||||||
Vector2i m_previousSize{-1, -1}; ///< Previous size of the window, to find if a ConfigureNotify event is a resize event (could be a move event only)
|
Vector2i m_previousSize{-1, -1}; ///< Previous size of the window, to find if a ConfigureNotify event is a resize event (could be a move event only)
|
||||||
bool m_useSizeHints{}; ///< Is the size of the window fixed with size hints?
|
bool m_useSizeHints{}; ///< Is the size of the window fixed with size hints?
|
||||||
bool m_fullscreen{}; ///< Is the window in fullscreen?
|
bool m_fullscreen{}; ///< Is the window in fullscreen?
|
||||||
bool m_cursorGrabbed{}; ///< Is the mouse cursor trapped?
|
bool m_cursorGrabbed{}; ///< Is the mouse cursor trapped?
|
||||||
bool m_windowMapped{}; ///< Has the window been mapped by the window manager?
|
bool m_windowMapped{}; ///< Has the window been mapped by the window manager?
|
||||||
Pixmap m_iconPixmap{}; ///< The current icon pixmap if in use
|
Pixmap m_iconPixmap{}; ///< The current icon pixmap if in use
|
||||||
Pixmap m_iconMaskPixmap{}; ///< The current icon mask pixmap if in use
|
Pixmap m_iconMaskPixmap{}; ///< The current icon mask pixmap if in use
|
||||||
::Time m_lastInputTime{}; ///< Last time we received user input
|
::Time m_lastInputTime{}; ///< Last time we received user input
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf::priv
|
} // namespace sf::priv
|
||||||
|
@ -213,10 +213,10 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int m_index{}; //!< Index of the joystick
|
unsigned int m_index{}; //!< Index of the joystick
|
||||||
JOYCAPS m_caps{}; //!< Joystick capabilities
|
JOYCAPS m_caps{}; //!< Joystick capabilities
|
||||||
IDirectInputDevice8W* m_device{}; //!< DirectInput 8.x device
|
IDirectInputDevice8W* m_device{}; //!< DirectInput 8.x device
|
||||||
DIDEVCAPS m_deviceCaps{}; //!< DirectInput device capabilities
|
DIDEVCAPS m_deviceCaps{}; //!< DirectInput device capabilities
|
||||||
EnumArray<Joystick::Axis, int, Joystick::AxisCount> m_axes{}; //!< Offsets to the bytes containing the axes states, -1 if not available
|
EnumArray<Joystick::Axis, int, Joystick::AxisCount> m_axes{}; //!< Offsets to the bytes containing the axes states, -1 if not available
|
||||||
int m_buttons[Joystick::ButtonCount]{}; //!< Offsets to the bytes containing the button states, -1 if not available
|
int m_buttons[Joystick::ButtonCount]{}; //!< Offsets to the bytes containing the button states, -1 if not available
|
||||||
Joystick::Identification m_identification; //!< Joystick identification
|
Joystick::Identification m_identification; //!< Joystick identification
|
||||||
|
@ -305,9 +305,9 @@ private:
|
|||||||
Vector2u m_lastSize; //!< The last handled size of the window
|
Vector2u m_lastSize; //!< The last handled size of the window
|
||||||
bool m_resizing{}; //!< Is the window being resized?
|
bool m_resizing{}; //!< Is the window being resized?
|
||||||
std::uint16_t m_surrogate{}; //!< First half of the surrogate pair, in case we're receiving a Unicode character in two events
|
std::uint16_t m_surrogate{}; //!< First half of the surrogate pair, in case we're receiving a Unicode character in two events
|
||||||
bool m_mouseInside{}; //!< Mouse is inside the window?
|
bool m_mouseInside{}; //!< Mouse is inside the window?
|
||||||
bool m_fullscreen{}; //!< Is the window fullscreen?
|
bool m_fullscreen{}; //!< Is the window fullscreen?
|
||||||
bool m_cursorGrabbed{}; //!< Is the mouse cursor trapped?
|
bool m_cursorGrabbed{}; //!< Is the mouse cursor trapped?
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -86,7 +86,7 @@ void ensureInit()
|
|||||||
sf::priv::EaglContext::getFunction("glRenderbufferStorageOES"));
|
sf::priv::EaglContext::getFunction("glRenderbufferStorageOES"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
namespace sf::priv
|
namespace sf::priv
|
||||||
|
@ -138,4 +138,4 @@ Vector2i getTouchPosition(unsigned int finger, const WindowBase& /* relativeTo *
|
|||||||
return getTouchPosition(finger);
|
return getTouchPosition(finger);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sf::priv
|
} // namespace sf::priv::InputImpl
|
||||||
|
@ -38,7 +38,7 @@ SFAppDelegate* delegateInstance = nullptr;
|
|||||||
|
|
||||||
// Current touches positions
|
// Current touches positions
|
||||||
std::vector<sf::Vector2i> touchPositions;
|
std::vector<sf::Vector2i> touchPositions;
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
@interface SFAppDelegate ()
|
@interface SFAppDelegate ()
|
||||||
|
@ -45,7 +45,7 @@ NSCursor* loadFromSelector(SEL selector)
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
namespace sf::priv
|
namespace sf::priv
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ namespace
|
|||||||
{
|
{
|
||||||
const std::uint8_t unknownVirtualCode = 0xff;
|
const std::uint8_t unknownVirtualCode = 0xff;
|
||||||
const bool isIsoKeyboard = (KBGetLayoutType(LMGetKbdType()) == kKeyboardISO);
|
const bool isIsoKeyboard = (KBGetLayoutType(LMGetKbdType()) == kKeyboardISO);
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
namespace sf::priv
|
namespace sf::priv
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ SFOpenGLView* getSFOpenGLViewFromSFMLWindow(const sf::WindowBase& window)
|
|||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
namespace sf::priv::InputImpl
|
namespace sf::priv::InputImpl
|
||||||
{
|
{
|
||||||
@ -263,4 +263,4 @@ Vector2i getTouchPosition(unsigned int /*finger*/, const WindowBase& /*relativeT
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sf::priv
|
} // namespace sf::priv::InputImpl
|
||||||
|
@ -131,7 +131,7 @@ void processLeftRightModifiers(
|
|||||||
processOneModifier(modifiers, leftMask, leftWasDown, leftKey, leftCode, requester);
|
processOneModifier(modifiers, leftMask, leftWasDown, leftKey, leftCode, requester);
|
||||||
processOneModifier(modifiers, rightMask, rightWasDown, rightKey, rightCode, requester);
|
processOneModifier(modifiers, rightMask, rightWasDown, rightKey, rightCode, requester);
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
@ -93,7 +93,7 @@ void showMouseCursor()
|
|||||||
isCursorHidden = false;
|
isCursorHidden = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
#pragma mark
|
#pragma mark
|
||||||
#pragma mark WindowImplCocoa's ctor/dtor
|
#pragma mark WindowImplCocoa's ctor/dtor
|
||||||
|
Loading…
Reference in New Issue
Block a user