mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Add cppcoreguidelines-pro-type-member-init
clang-tidy check
This marks another good step towards systematically rooting out undefined behavior in the form of reading uninitialized memory.
This commit is contained in:
parent
63eff96581
commit
bb1a465e50
@ -42,7 +42,6 @@ Checks: >
|
|||||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||||
-cppcoreguidelines-pro-type-const-cast,
|
-cppcoreguidelines-pro-type-const-cast,
|
||||||
-cppcoreguidelines-pro-type-member-init,
|
|
||||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||||
-cppcoreguidelines-pro-type-static-cast-downcast,
|
-cppcoreguidelines-pro-type-static-cast-downcast,
|
||||||
-cppcoreguidelines-pro-type-union-access,
|
-cppcoreguidelines-pro-type-union-access,
|
||||||
|
@ -2595,7 +2595,7 @@ private:
|
|||||||
VkImageView depthImageView{};
|
VkImageView depthImageView{};
|
||||||
VkShaderModule vertexShaderModule{};
|
VkShaderModule vertexShaderModule{};
|
||||||
VkShaderModule fragmentShaderModule{};
|
VkShaderModule fragmentShaderModule{};
|
||||||
VkPipelineShaderStageCreateInfo shaderStages[2];
|
VkPipelineShaderStageCreateInfo shaderStages[2]{};
|
||||||
VkDescriptorSetLayout descriptorSetLayout{};
|
VkDescriptorSetLayout descriptorSetLayout{};
|
||||||
VkPipelineLayout pipelineLayout{};
|
VkPipelineLayout pipelineLayout{};
|
||||||
VkRenderPass renderPass{};
|
VkRenderPass renderPass{};
|
||||||
|
@ -51,9 +51,7 @@ void SoundFileFactory::registerReader()
|
|||||||
unregisterReader<T>();
|
unregisterReader<T>();
|
||||||
|
|
||||||
// Create a new factory with the functions provided by the class
|
// Create a new factory with the functions provided by the class
|
||||||
ReaderFactory factory;
|
const ReaderFactory factory{&T::check, &priv::createReader<T>};
|
||||||
factory.check = &T::check;
|
|
||||||
factory.create = &priv::createReader<T>;
|
|
||||||
|
|
||||||
// Add it
|
// Add it
|
||||||
s_readers.push_back(factory);
|
s_readers.push_back(factory);
|
||||||
@ -82,9 +80,7 @@ void SoundFileFactory::registerWriter()
|
|||||||
unregisterWriter<T>();
|
unregisterWriter<T>();
|
||||||
|
|
||||||
// Create a new factory with the functions provided by the class
|
// Create a new factory with the functions provided by the class
|
||||||
WriterFactory factory;
|
const WriterFactory factory{&T::check, &priv::createWriter<T>};
|
||||||
factory.check = &T::check;
|
|
||||||
factory.create = &priv::createWriter<T>;
|
|
||||||
|
|
||||||
// Add it
|
// Add it
|
||||||
s_writers.push_back(factory);
|
s_writers.push_back(factory);
|
||||||
|
@ -290,7 +290,7 @@ protected:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int m_source; //!< OpenAL source identifier
|
unsigned int m_source{}; //!< OpenAL source identifier
|
||||||
};
|
};
|
||||||
|
|
||||||
// NOLINTEND(readability-make-member-function-const)
|
// NOLINTEND(readability-make-member-function-const)
|
||||||
|
@ -81,7 +81,7 @@ struct Matrix
|
|||||||
copyMatrix(transform, *this);
|
copyMatrix(transform, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
float array[Columns * Rows]; //!< Array holding matrix data
|
float array[Columns * Rows]{}; //!< Array holding matrix data
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
@ -180,8 +180,8 @@ public:
|
|||||||
FieldTable m_fields; //!< Fields of the header associated to their value
|
FieldTable m_fields; //!< Fields of the header associated to their value
|
||||||
Method m_method; //!< Method to use for the request
|
Method m_method; //!< Method to use for the request
|
||||||
std::string m_uri; //!< Target URI of the request
|
std::string m_uri; //!< Target URI of the request
|
||||||
unsigned int m_majorVersion; //!< Major HTTP version
|
unsigned int m_majorVersion{1}; //!< Major HTTP version
|
||||||
unsigned int m_minorVersion; //!< Minor HTTP version
|
unsigned int m_minorVersion{}; //!< Minor HTTP version
|
||||||
std::string m_body; //!< Body of the request
|
std::string m_body; //!< Body of the request
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#include <SFML/Window/Sensor.hpp>
|
#include <SFML/Window/Sensor.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-pro-type-member-init)
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -200,7 +202,7 @@ struct Event
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EventType type; //!< Type of the event
|
EventType type{}; //!< Type of the event
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
@ -220,6 +222,8 @@ struct Event
|
|||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-pro-type-member-init)
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \class sf::Event
|
/// \class sf::Event
|
||||||
|
@ -59,7 +59,7 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
GLint m_textureBinding; //!< Texture binding to restore
|
GLint m_textureBinding{}; //!< Texture binding to restore
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf::priv
|
} // namespace sf::priv
|
||||||
|
@ -39,11 +39,9 @@
|
|||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Http::Request::Request(const std::string& uri, Method method, const std::string& body)
|
Http::Request::Request(const std::string& uri, Method method, const std::string& body) : m_method(method)
|
||||||
{
|
{
|
||||||
setMethod(method);
|
|
||||||
setUri(uri);
|
setUri(uri);
|
||||||
setHttpVersion(1, 0);
|
|
||||||
setBody(body);
|
setBody(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ std::optional<IpAddress> IpAddress::resolve(std::string_view address)
|
|||||||
addrinfo* result = nullptr;
|
addrinfo* result = nullptr;
|
||||||
if (getaddrinfo(address.data(), nullptr, &hints, &result) == 0 && result != nullptr)
|
if (getaddrinfo(address.data(), nullptr, &hints, &result) == 0 && result != nullptr)
|
||||||
{
|
{
|
||||||
sockaddr_in sin;
|
sockaddr_in sin{};
|
||||||
std::memcpy(&sin, result->ai_addr, sizeof(*result->ai_addr));
|
std::memcpy(&sin, result->ai_addr, sizeof(*result->ai_addr));
|
||||||
|
|
||||||
const std::uint32_t ip = sin.sin_addr.s_addr;
|
const std::uint32_t ip = sin.sin_addr.s_addr;
|
||||||
@ -102,7 +102,7 @@ IpAddress::IpAddress(std::uint32_t address) : m_address(htonl(address))
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
std::string IpAddress::toString() const
|
std::string IpAddress::toString() const
|
||||||
{
|
{
|
||||||
in_addr address;
|
in_addr address{};
|
||||||
address.s_addr = m_address;
|
address.s_addr = m_address;
|
||||||
|
|
||||||
return inet_ntoa(address);
|
return inet_ntoa(address);
|
||||||
|
@ -171,7 +171,7 @@ void SocketSelector::clear()
|
|||||||
bool SocketSelector::wait(Time timeout)
|
bool SocketSelector::wait(Time timeout)
|
||||||
{
|
{
|
||||||
// Setup the timeout
|
// Setup the timeout
|
||||||
timeval time;
|
timeval time{};
|
||||||
time.tv_sec = static_cast<long>(timeout.asMicroseconds() / 1000000);
|
time.tv_sec = static_cast<long>(timeout.asMicroseconds() / 1000000);
|
||||||
time.tv_usec = static_cast<int>(timeout.asMicroseconds() % 1000000);
|
time.tv_usec = static_cast<int>(timeout.asMicroseconds() % 1000000);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ unsigned short TcpListener::getLocalPort() const
|
|||||||
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
||||||
{
|
{
|
||||||
// Retrieve information about the local end of the socket
|
// Retrieve information about the local end of the socket
|
||||||
sockaddr_in address;
|
sockaddr_in address{};
|
||||||
priv::SocketImpl::AddrLength size = sizeof(address);
|
priv::SocketImpl::AddrLength size = sizeof(address);
|
||||||
if (getsockname(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
|
if (getsockname(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
|
||||||
{
|
{
|
||||||
@ -114,7 +114,7 @@ Socket::Status TcpListener::accept(TcpSocket& socket)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Accept a new connection
|
// Accept a new connection
|
||||||
sockaddr_in address;
|
sockaddr_in address{};
|
||||||
priv::SocketImpl::AddrLength length = sizeof(address);
|
priv::SocketImpl::AddrLength length = sizeof(address);
|
||||||
const SocketHandle remote = ::accept(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &length);
|
const SocketHandle remote = ::accept(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &length);
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ unsigned short TcpSocket::getLocalPort() const
|
|||||||
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
||||||
{
|
{
|
||||||
// Retrieve information about the local end of the socket
|
// Retrieve information about the local end of the socket
|
||||||
sockaddr_in address;
|
sockaddr_in address{};
|
||||||
priv::SocketImpl::AddrLength size = sizeof(address);
|
priv::SocketImpl::AddrLength size = sizeof(address);
|
||||||
if (getsockname(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
|
if (getsockname(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ std::optional<IpAddress> TcpSocket::getRemoteAddress() const
|
|||||||
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
||||||
{
|
{
|
||||||
// Retrieve information about the remote end of the socket
|
// Retrieve information about the remote end of the socket
|
||||||
sockaddr_in address;
|
sockaddr_in address{};
|
||||||
priv::SocketImpl::AddrLength size = sizeof(address);
|
priv::SocketImpl::AddrLength size = sizeof(address);
|
||||||
if (getpeername(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
|
if (getpeername(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
|
||||||
{
|
{
|
||||||
@ -104,7 +104,7 @@ unsigned short TcpSocket::getRemotePort() const
|
|||||||
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
||||||
{
|
{
|
||||||
// Retrieve information about the remote end of the socket
|
// Retrieve information about the remote end of the socket
|
||||||
sockaddr_in address;
|
sockaddr_in address{};
|
||||||
priv::SocketImpl::AddrLength size = sizeof(address);
|
priv::SocketImpl::AddrLength size = sizeof(address);
|
||||||
if (getpeername(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
|
if (getpeername(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
|
||||||
{
|
{
|
||||||
@ -175,7 +175,7 @@ Socket::Status TcpSocket::connect(const IpAddress& remoteAddress, unsigned short
|
|||||||
FD_SET(getNativeHandle(), &selector);
|
FD_SET(getNativeHandle(), &selector);
|
||||||
|
|
||||||
// Setup the timeout
|
// Setup the timeout
|
||||||
timeval time;
|
timeval time{};
|
||||||
time.tv_sec = static_cast<long>(timeout.asMicroseconds() / 1000000);
|
time.tv_sec = static_cast<long>(timeout.asMicroseconds() / 1000000);
|
||||||
time.tv_usec = static_cast<int>(timeout.asMicroseconds() % 1000000);
|
time.tv_usec = static_cast<int>(timeout.asMicroseconds() % 1000000);
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ unsigned short UdpSocket::getLocalPort() const
|
|||||||
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
if (getNativeHandle() != priv::SocketImpl::invalidSocket())
|
||||||
{
|
{
|
||||||
// Retrieve information about the local end of the socket
|
// Retrieve information about the local end of the socket
|
||||||
sockaddr_in address;
|
sockaddr_in address{};
|
||||||
priv::SocketImpl::AddrLength size = sizeof(address);
|
priv::SocketImpl::AddrLength size = sizeof(address);
|
||||||
if (getsockname(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
|
if (getsockname(getNativeHandle(), reinterpret_cast<sockaddr*>(&address), &size) != -1)
|
||||||
{
|
{
|
||||||
|
@ -61,31 +61,31 @@ struct ActivityStates
|
|||||||
AInputQueue* inputQueue{};
|
AInputQueue* inputQueue{};
|
||||||
AConfiguration* config{};
|
AConfiguration* config{};
|
||||||
|
|
||||||
EGLDisplay display;
|
EGLDisplay display{};
|
||||||
EglContext* context;
|
EglContext* context{};
|
||||||
|
|
||||||
void* savedState;
|
void* savedState{};
|
||||||
std::size_t savedStateSize;
|
std::size_t savedStateSize{};
|
||||||
|
|
||||||
std::recursive_mutex mutex;
|
std::recursive_mutex mutex;
|
||||||
|
|
||||||
void (*forwardEvent)(const Event& event);
|
void (*forwardEvent)(const Event& event){};
|
||||||
int (*processEvent)(int fd, int events, void* data);
|
int (*processEvent)(int fd, int events, void* data){};
|
||||||
|
|
||||||
std::unordered_map<int, Vector2i> touchEvents;
|
std::unordered_map<int, Vector2i> touchEvents;
|
||||||
Vector2i mousePosition;
|
Vector2i mousePosition;
|
||||||
bool isButtonPressed[Mouse::ButtonCount];
|
bool isButtonPressed[Mouse::ButtonCount]{};
|
||||||
|
|
||||||
bool mainOver;
|
bool mainOver{};
|
||||||
|
|
||||||
Vector2i screenSize;
|
Vector2i screenSize;
|
||||||
|
|
||||||
bool initialized;
|
bool initialized{};
|
||||||
bool terminated;
|
bool terminated{};
|
||||||
|
|
||||||
bool fullscreen;
|
bool fullscreen{};
|
||||||
|
|
||||||
bool updated;
|
bool updated{};
|
||||||
|
|
||||||
LogcatStream logcat;
|
LogcatStream logcat;
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,7 @@ namespace sf
|
|||||||
|
|
||||||
SuspendAwareClock::time_point SuspendAwareClock::now() noexcept
|
SuspendAwareClock::time_point SuspendAwareClock::now() noexcept
|
||||||
{
|
{
|
||||||
::timespec ts;
|
::timespec ts{};
|
||||||
#ifdef CLOCK_BOOTTIME
|
#ifdef CLOCK_BOOTTIME
|
||||||
clock_gettime(CLOCK_BOOTTIME, &ts);
|
clock_gettime(CLOCK_BOOTTIME, &ts);
|
||||||
#else
|
#else
|
||||||
|
@ -40,7 +40,7 @@ void sleepImpl(Time time)
|
|||||||
const std::int64_t usecs = time.asMicroseconds();
|
const std::int64_t usecs = time.asMicroseconds();
|
||||||
|
|
||||||
// Construct the time to wait
|
// Construct the time to wait
|
||||||
timespec ti;
|
timespec ti{};
|
||||||
ti.tv_sec = static_cast<time_t>(usecs / 1000000);
|
ti.tv_sec = static_cast<time_t>(usecs / 1000000);
|
||||||
ti.tv_nsec = static_cast<long>((usecs % 1000000) * 1000);
|
ti.tv_nsec = static_cast<long>((usecs % 1000000) * 1000);
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ bool eventProcess(sf::Event& event)
|
|||||||
// Check all the open file descriptors for the next event
|
// Check all the open file descriptors for the next event
|
||||||
for (auto& fileDescriptor : fileDescriptors)
|
for (auto& fileDescriptor : fileDescriptors)
|
||||||
{
|
{
|
||||||
input_event inputEvent;
|
input_event inputEvent{};
|
||||||
bytesRead = read(fileDescriptor, &inputEvent, sizeof(inputEvent));
|
bytesRead = read(fileDescriptor, &inputEvent, sizeof(inputEvent));
|
||||||
|
|
||||||
while (bytesRead > 0)
|
while (bytesRead > 0)
|
||||||
@ -509,7 +509,7 @@ bool eventProcess(sf::Event& event)
|
|||||||
newTerminalConfig.c_lflag &= ~static_cast<tcflag_t>(ICANON);
|
newTerminalConfig.c_lflag &= ~static_cast<tcflag_t>(ICANON);
|
||||||
tcsetattr(STDIN_FILENO, TCSANOW, &newTerminalConfig);
|
tcsetattr(STDIN_FILENO, TCSANOW, &newTerminalConfig);
|
||||||
|
|
||||||
timeval timeout;
|
timeval timeout{};
|
||||||
timeout.tv_sec = 0;
|
timeout.tv_sec = 0;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
|
@ -186,9 +186,9 @@ bool WindowImplDRM::hasFocus() const
|
|||||||
|
|
||||||
void WindowImplDRM::processEvents()
|
void WindowImplDRM::processEvents()
|
||||||
{
|
{
|
||||||
sf::Event ev;
|
sf::Event event;
|
||||||
while (sf::priv::InputImpl::checkEvent(ev))
|
while (sf::priv::InputImpl::checkEvent(event))
|
||||||
pushEvent(ev);
|
pushEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sf::priv
|
} // namespace sf::priv
|
||||||
|
@ -124,9 +124,9 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct Item
|
struct Item
|
||||||
{
|
{
|
||||||
bool available; //!< Is the sensor available on this device?
|
bool available{}; //!< Is the sensor available on this device?
|
||||||
bool enabled; //!< Current enable state of the sensor
|
bool enabled{}; //!< Current enable state of the sensor
|
||||||
SensorImpl sensor; //!< Sensor implementation
|
SensorImpl sensor{}; //!< Sensor implementation
|
||||||
Vector3f value; //!< The current sensor value
|
Vector3f value; //!< The current sensor value
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ struct JoystickRecord
|
|||||||
{
|
{
|
||||||
std::string deviceNode;
|
std::string deviceNode;
|
||||||
std::string systemPath;
|
std::string systemPath;
|
||||||
bool plugged;
|
bool plugged{};
|
||||||
};
|
};
|
||||||
|
|
||||||
using JoystickList = std::vector<JoystickRecord>;
|
using JoystickList = std::vector<JoystickRecord>;
|
||||||
@ -639,7 +639,7 @@ JoystickState JoystickImpl::JoystickImpl::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pop events from the joystick file
|
// pop events from the joystick file
|
||||||
js_event joyState;
|
js_event joyState{};
|
||||||
ssize_t result = read(m_file, &joyState, sizeof(joyState));
|
ssize_t result = read(m_file, &joyState, sizeof(joyState));
|
||||||
while (result > 0)
|
while (result > 0)
|
||||||
{
|
{
|
||||||
|
@ -790,8 +790,7 @@ bool JoystickImpl::openDInput(unsigned int index)
|
|||||||
{
|
{
|
||||||
if (m_identification.vendorId && m_identification.productId)
|
if (m_identification.vendorId && m_identification.productId)
|
||||||
{
|
{
|
||||||
JoystickBlacklistEntry entry;
|
JoystickBlacklistEntry entry{};
|
||||||
|
|
||||||
entry.vendorId = m_identification.vendorId;
|
entry.vendorId = m_identification.vendorId;
|
||||||
entry.productId = m_identification.productId;
|
entry.productId = m_identification.productId;
|
||||||
|
|
||||||
|
@ -212,15 +212,15 @@ 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
|
||||||
int m_axes[Joystick::AxisCount]; //!< Offsets to the bytes containing the axes states, -1 if not available
|
int m_axes[Joystick::AxisCount]{}; //!< 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
|
||||||
JoystickState m_state; //!< Buffered joystick state
|
JoystickState m_state; //!< Buffered joystick state
|
||||||
bool m_buffered; //!< true if the device uses buffering, false if the device uses polling
|
bool m_buffered{}; //!< true if the device uses buffering, false if the device uses polling
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf::priv
|
} // namespace sf::priv
|
||||||
|
@ -334,7 +334,7 @@ private:
|
|||||||
std::unique_ptr<JoystickStatesImpl> m_joystickStatesImpl; //!< Previous state of the joysticks (PImpl)
|
std::unique_ptr<JoystickStatesImpl> m_joystickStatesImpl; //!< Previous state of the joysticks (PImpl)
|
||||||
Vector3f m_sensorValue[Sensor::Count]; //!< Previous value of the sensors
|
Vector3f m_sensorValue[Sensor::Count]; //!< Previous value of the sensors
|
||||||
float m_joystickThreshold{0.1f}; //!< Joystick threshold (minimum motion for "move" event to be generated)
|
float m_joystickThreshold{0.1f}; //!< Joystick threshold (minimum motion for "move" event to be generated)
|
||||||
float m_previousAxes[Joystick::Count][Joystick::AxisCount]; //!< Position of each axis last time a move event triggered, in range [-100, 100]
|
float m_previousAxes[Joystick::Count][Joystick::AxisCount]{}; //!< Position of each axis last time a move event triggered, in range [-100, 100]
|
||||||
std::optional<Vector2u> m_minimumSize; //!< Minimum window size
|
std::optional<Vector2u> m_minimumSize; //!< Minimum window size
|
||||||
std::optional<Vector2u> m_maximumSize; //!< Maximum window size
|
std::optional<Vector2u> m_maximumSize; //!< Maximum window size
|
||||||
};
|
};
|
||||||
|
@ -232,11 +232,11 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
UIWindow* m_window; ///< Pointer to the internal UIKit window
|
UIWindow* m_window{}; ///< Pointer to the internal UIKit window
|
||||||
SFView* m_view; ///< OpenGL view of the window
|
SFView* m_view{}; ///< OpenGL view of the window
|
||||||
SFViewController* m_viewController; ///< Controller attached to the view
|
SFViewController* m_viewController{}; ///< Controller attached to the view
|
||||||
bool m_hasFocus; ///< Current focus state of the window
|
bool m_hasFocus{}; ///< Current focus state of the window
|
||||||
float m_backingScale; ///< Converts from points to pixels and vice versa
|
float m_backingScale{}; ///< Converts from points to pixels and vice versa
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf::priv
|
} // namespace sf::priv
|
||||||
|
@ -288,8 +288,8 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
IOHIDManagerRef m_manager{}; ///< Underlying HID Manager
|
IOHIDManagerRef m_manager{}; ///< Underlying HID Manager
|
||||||
IOHIDElements m_keys[static_cast<std::size_t>(Keyboard::Scan::ScancodeCount)]; ///< All the keys on any connected keyboard
|
IOHIDElements m_keys[static_cast<std::size_t>(Keyboard::Scan::ScancodeCount)]; ///< All the keys on any connected keyboard
|
||||||
Keyboard::Scancode m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode
|
Keyboard::Scancode m_keyToScancodeMapping[Keyboard::KeyCount]{}; ///< Mapping from Key to Scancode
|
||||||
Keyboard::Key m_scancodeToKeyMapping[static_cast<std::size_t>(Keyboard::Scan::ScancodeCount)]; ///< Mapping from Scancode to Key
|
Keyboard::Key m_scancodeToKeyMapping[static_cast<std::size_t>(Keyboard::Scan::ScancodeCount)]{}; ///< Mapping from Scancode to Key
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// m_keys' index corresponds to sf::Keyboard::Scancode enum.
|
/// m_keys' index corresponds to sf::Keyboard::Scancode enum.
|
||||||
|
@ -115,9 +115,9 @@ private:
|
|||||||
using ButtonsVector = std::vector<IOHIDElementRef>;
|
using ButtonsVector = std::vector<IOHIDElementRef>;
|
||||||
|
|
||||||
AxisMap m_axis; ///< Axes (but not POV/Hat) of the joystick
|
AxisMap m_axis; ///< Axes (but not POV/Hat) of the joystick
|
||||||
IOHIDElementRef m_hat; ///< POV/Hat axis of the joystick
|
IOHIDElementRef m_hat{}; ///< POV/Hat axis of the joystick
|
||||||
ButtonsVector m_buttons; ///< Buttons of the joystick
|
ButtonsVector m_buttons; ///< Buttons of the joystick
|
||||||
unsigned int m_index; ///< SFML index
|
unsigned int m_index{}; ///< SFML index
|
||||||
Joystick::Identification m_identification; ///< Joystick identification
|
Joystick::Identification m_identification; ///< Joystick identification
|
||||||
|
|
||||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||||
|
@ -153,7 +153,7 @@ void initialiseKeyboardHelper()
|
|||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
sf::Event::KeyEvent keyEventWithModifiers(NSUInteger modifiers, sf::Keyboard::Key key, sf::Keyboard::Scancode code)
|
sf::Event::KeyEvent keyEventWithModifiers(NSUInteger modifiers, sf::Keyboard::Key key, sf::Keyboard::Scancode code)
|
||||||
{
|
{
|
||||||
sf::Event::KeyEvent event;
|
sf::Event::KeyEvent event{};
|
||||||
event.code = key;
|
event.code = key;
|
||||||
event.scancode = code;
|
event.scancode = code;
|
||||||
event.alt = modifiers & NSAlternateKeyMask;
|
event.alt = modifiers & NSAlternateKeyMask;
|
||||||
|
@ -61,7 +61,7 @@ TEST_CASE("[Graphics] sf::Image")
|
|||||||
SECTION("create(Vector2, std::uint8_t*)")
|
SECTION("create(Vector2, std::uint8_t*)")
|
||||||
{
|
{
|
||||||
// 10 x 10, with 4 colour channels array
|
// 10 x 10, with 4 colour channels array
|
||||||
std::array<std::uint8_t, 400> pixels;
|
std::array<std::uint8_t, 400> pixels{};
|
||||||
for (std::size_t i = 0; i < pixels.size(); i += 4)
|
for (std::size_t i = 0; i < pixels.size(); i += 4)
|
||||||
{
|
{
|
||||||
pixels[i] = 255; // r
|
pixels[i] = 255; // r
|
||||||
|
Loading…
Reference in New Issue
Block a user