lxgui
|
The base class for input source implementation. More...
#include <input_source.hpp>
Classes | |
struct | key_state |
struct | mouse_state |
Public Member Functions | |
source ()=default | |
Constructor. | |
virtual | ~source ()=default |
Destructor. | |
source (const source &)=delete | |
source (source &&)=delete | |
source & | operator= (const source &)=delete |
source & | operator= (source &&)=delete |
const key_state & | get_key_state () const |
Returns the keyboard state of this input source. | |
const mouse_state & | get_mouse_state () const |
Returns the mouse state of this input source. | |
const gui::vector2ui & | get_window_dimensions () const |
Get the window size (in pixels) | |
virtual utils::ustring | get_clipboard_content ()=0 |
Retrieve a copy of the clipboard content. | |
virtual void | set_clipboard_content (const utils::ustring &content)=0 |
Replace the content of the clipboard. | |
virtual void | set_mouse_cursor (const std::string &file_name, const gui::vector2i &hot_spot)=0 |
Sets the mouse cursor to a given image on disk. | |
virtual void | reset_mouse_cursor ()=0 |
Sets the mouse cursor back to the default (arrow). | |
virtual float | get_interface_scaling_factor_hint () const |
Return the interface scaling factor suggested by the operating system. | |
Public Attributes | |
utils::signal< void(const gui::vector2f &, const gui::vector2f &)> | on_mouse_moved |
Signal triggered when the mouse moves. | |
utils::signal< void(float, const gui::vector2f &)> | on_mouse_wheel |
Signal triggered when the mouse wheel is moved. | |
utils::signal< void(input::mouse_button, const gui::vector2f &)> | on_mouse_pressed |
Signal triggered when a mouse button is pressed. | |
utils::signal< void(input::mouse_button, const gui::vector2f &)> | on_mouse_released |
Signal triggered when a mouse button is released. | |
utils::signal< void(input::key)> | on_key_pressed |
Signal triggered when a keyboard key is pressed. | |
utils::signal< void(input::key)> | on_key_pressed_repeat |
Signal triggered when a keyboard key is long-pressed and repeats. | |
utils::signal< void(input::key)> | on_key_released |
Signal triggered when a keyboard key is released. | |
utils::signal< void(std::uint32_t)> | on_text_entered |
Signal triggered when text is entered. | |
utils::signal< void(const gui::vector2ui &)> | on_window_resized |
Signal triggered whenever the window is resized or changes resolution. | |
Protected Attributes | |
key_state | keyboard_ |
mouse_state | mouse_ |
gui::vector2ui | window_dimensions_ |
The base class for input source implementation.
The implementation is responsible for generating the following low-level events:
These events are "raw", straight from the input implementation. They are meant to be consumed by the input::dispatcher, which takes care of transforming them (apply scaling factors, etc.), and generating more complex events (drag, double-click, etc.). Therefore, do not use these events directly unless you are really after the raw input events, and prefer using input::dispatcher instead.
Definition at line 39 of file input_source.hpp.
|
default |
Constructor.
|
virtualdefault |
Destructor.
|
delete |
|
delete |
|
pure virtual |
Retrieve a copy of the clipboard content.
Implemented in lxgui::input::sdl::source, and lxgui::input::sfml::source.
|
virtual |
Return the interface scaling factor suggested by the operating system.
Reimplemented in lxgui::input::sdl::source.
Definition at line 17 of file input_source.cpp.
const source::key_state & lxgui::input::source::get_key_state | ( | ) | const |
Returns the keyboard state of this input source.
Definition at line 5 of file input_source.cpp.
const source::mouse_state & lxgui::input::source::get_mouse_state | ( | ) | const |
Returns the mouse state of this input source.
Definition at line 9 of file input_source.cpp.
const gui::vector2ui & lxgui::input::source::get_window_dimensions | ( | ) | const |
Get the window size (in pixels)
Definition at line 13 of file input_source.cpp.
|
pure virtual |
Sets the mouse cursor back to the default (arrow).
Implemented in lxgui::input::sdl::source, and lxgui::input::sfml::source.
|
pure virtual |
Replace the content of the clipboard.
content | The new clipboard content |
Implemented in lxgui::input::sdl::source, and lxgui::input::sfml::source.
|
pure virtual |
Sets the mouse cursor to a given image on disk.
file_name | The cursor image |
hot_spot | The pixel position of the tip of the pointer in the image |
Implemented in lxgui::input::sdl::source, and lxgui::input::sfml::source.
|
protected |
Definition at line 178 of file input_source.hpp.
|
protected |
Definition at line 179 of file input_source.hpp.
utils::signal<void(input::key)> lxgui::input::source::on_key_pressed |
Signal triggered when a keyboard key is pressed.
Arguments:
Definition at line 146 of file input_source.hpp.
utils::signal<void(input::key)> lxgui::input::source::on_key_pressed_repeat |
Signal triggered when a keyboard key is long-pressed and repeats.
Arguments:
Definition at line 153 of file input_source.hpp.
utils::signal<void(input::key)> lxgui::input::source::on_key_released |
Signal triggered when a keyboard key is released.
Arguments:
Definition at line 160 of file input_source.hpp.
utils::signal<void(const gui::vector2f&, const gui::vector2f&)> lxgui::input::source::on_mouse_moved |
Signal triggered when the mouse moves.
Arguments:
Definition at line 115 of file input_source.hpp.
utils::signal<void(input::mouse_button, const gui::vector2f&)> lxgui::input::source::on_mouse_pressed |
Signal triggered when a mouse button is pressed.
Arguments:
Definition at line 131 of file input_source.hpp.
utils::signal<void(input::mouse_button, const gui::vector2f&)> lxgui::input::source::on_mouse_released |
Signal triggered when a mouse button is released.
Arguments:
Definition at line 139 of file input_source.hpp.
utils::signal<void(float, const gui::vector2f&)> lxgui::input::source::on_mouse_wheel |
Signal triggered when the mouse wheel is moved.
Arguments:
Definition at line 123 of file input_source.hpp.
utils::signal<void(std::uint32_t)> lxgui::input::source::on_text_entered |
Signal triggered when text is entered.
Arguments:
Definition at line 168 of file input_source.hpp.
utils::signal<void(const gui::vector2ui&)> lxgui::input::source::on_window_resized |
Signal triggered whenever the window is resized or changes resolution.
Arguments:
Definition at line 175 of file input_source.hpp.
|
protected |
Definition at line 181 of file input_source.hpp.