Mouse transition support

This commit is contained in:
ArthurSonzogni
2023-11-05 11:38:10 +01:00
parent 7f26b823ff
commit 4bf4c36519
14 changed files with 84 additions and 18 deletions

View File

@@ -23,6 +23,11 @@ struct Mouse {
Pressed = 1,
};
// Utility function to check the variations of the mouse state.
bool IsPressed(Button button = Left) const;
bool IsHeld(Button button = Left) const;
bool IsReleased(Button button = Left) const;
// Button
Button button = Button::None;
@@ -37,6 +42,9 @@ struct Mouse {
// Coordinates:
int x = 0;
int y = 0;
// Previous mouse event, if any.
Mouse* previous = nullptr;
};
} // namespace ftxui

View File

@@ -112,6 +112,7 @@ class ScreenInteractive : public Screen {
bool frame_valid_ = false;
Mouse latest_mouse_event_;
friend class Loop;
public: