Use list-initialization to zero-initialize 'JoystickImpl.hpp' structures
This commit is contained in:
parent
dd14d7c57f
commit
0f9e13a2bb
@ -30,7 +30,6 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
#include <SFML/Window/Joystick.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -43,14 +42,8 @@ namespace priv
|
||||
////////////////////////////////////////////////////////////
|
||||
struct JoystickCaps
|
||||
{
|
||||
JoystickCaps()
|
||||
{
|
||||
buttonCount = 0;
|
||||
std::fill(axes, axes + Joystick::AxisCount, false);
|
||||
}
|
||||
|
||||
unsigned int buttonCount; //!< Number of buttons supported by the joystick
|
||||
bool axes[Joystick::AxisCount]; //!< Support for each axis
|
||||
unsigned int buttonCount{0}; //!< Number of buttons supported by the joystick
|
||||
bool axes[Joystick::AxisCount]{}; //!< Support for each axis
|
||||
};
|
||||
|
||||
|
||||
@ -60,16 +53,9 @@ struct JoystickCaps
|
||||
////////////////////////////////////////////////////////////
|
||||
struct JoystickState
|
||||
{
|
||||
JoystickState()
|
||||
{
|
||||
connected = false;
|
||||
std::fill(axes, axes + Joystick::AxisCount, 0.f);
|
||||
std::fill(buttons, buttons + Joystick::ButtonCount, false);
|
||||
}
|
||||
|
||||
bool connected; //!< Is the joystick currently connected?
|
||||
float axes[Joystick::AxisCount]; //!< Position of each axis, in range [-100, 100]
|
||||
bool buttons[Joystick::ButtonCount]; //!< Status of each button (true = pressed)
|
||||
bool connected{false}; //!< Is the joystick currently connected?
|
||||
float axes[Joystick::AxisCount]{}; //!< Position of each axis, in range [-100, 100]
|
||||
bool buttons[Joystick::ButtonCount]{}; //!< Status of each button (true = pressed)
|
||||
};
|
||||
|
||||
} // namespace priv
|
||||
|
Loading…
Reference in New Issue
Block a user