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/Config.hpp>
|
||||||
#include <SFML/Window/Joystick.hpp>
|
#include <SFML/Window/Joystick.hpp>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
@ -43,14 +42,8 @@ namespace priv
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct JoystickCaps
|
struct JoystickCaps
|
||||||
{
|
{
|
||||||
JoystickCaps()
|
unsigned int buttonCount{0}; //!< Number of buttons supported by the joystick
|
||||||
{
|
bool axes[Joystick::AxisCount]{}; //!< Support for each axis
|
||||||
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
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -60,16 +53,9 @@ struct JoystickCaps
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
struct JoystickState
|
struct JoystickState
|
||||||
{
|
{
|
||||||
JoystickState()
|
bool connected{false}; //!< Is the joystick currently connected?
|
||||||
{
|
float axes[Joystick::AxisCount]{}; //!< Position of each axis, in range [-100, 100]
|
||||||
connected = false;
|
bool buttons[Joystick::ButtonCount]{}; //!< Status of each button (true = pressed)
|
||||||
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)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
Loading…
Reference in New Issue
Block a user