Always initialize keyboard input

This commit is contained in:
german 2021-01-10 08:36:31 -06:00
parent 8495e1bd83
commit b483f2d010
5 changed files with 20 additions and 25 deletions

View file

@ -28,12 +28,11 @@ private:
public:
explicit Device(std::weak_ptr<TouchState>&& touch_state) : touch_state(touch_state) {}
Input::TouchStatus GetStatus() const override {
Input::TouchStatus touch_status{};
if (auto state = touch_state.lock()) {
std::lock_guard guard{state->mutex};
touch_status = state->status;
return state->status;
}
return touch_status;
return {};
}
private:

View file

@ -117,12 +117,13 @@ public:
* Signal that a touch pressed event has occurred (e.g. mouse click pressed)
* @param framebuffer_x Framebuffer x-coordinate that was pressed
* @param framebuffer_y Framebuffer y-coordinate that was pressed
* @param id Touch event id
* @param id Touch event ID
*/
void TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y, std::size_t id);
/** Signal that a touch released event has occurred (e.g. mouse click released)
*@param id Touch event id
/**
* Signal that a touch released event has occurred (e.g. mouse click released)
* @param id Touch event ID
*/
void TouchReleased(std::size_t id);
@ -130,7 +131,7 @@ public:
* Signal that a touch movement event has occurred (e.g. mouse was moved over the emu window)
* @param framebuffer_x Framebuffer x-coordinate
* @param framebuffer_y Framebuffer y-coordinate
* @param id Touch event id
* @param id Touch event ID
*/
void TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y, std::size_t id);