doodle
0.2
Intended to support teaching C++, doodle is a simple library that helps make a window and makes it easy to do some drawing.
|
Functions | |
int | doodle::get_mouse_x () noexcept |
Get the mouse's X position relative to the currently set doodle::FrameOfReference. More... | |
int | doodle::get_mouse_y () noexcept |
Get the mouse's Y position relative to the currently set doodle::FrameOfReference. More... | |
int | doodle::get_previous_mouse_x () noexcept |
Get the previous mouse's X position relative to the currently set doodle::FrameOfReference. More... | |
int | doodle::get_previous_mouse_y () noexcept |
Get the previous mouse's Y position relative to the currently set doodle::FrameOfReference. More... | |
void | doodle::set_callback_key_pressed (std::function< void(KeyboardButtons)> &&callback) noexcept |
The provided callback function is called once every time a key is pressed. More... | |
void | doodle::set_callback_key_released (std::function< void(KeyboardButtons)> &&callback) noexcept |
The provided callback function is called once every time a key is released. More... | |
void | doodle::set_callback_mouse_moved (std::function< void(int, int)> &&callback) noexcept |
The provided callback function is called every time the mouse moves. More... | |
void | doodle::set_callback_mouse_pressed (std::function< void(MouseButtons)> &&callback) noexcept |
The provided callback is called whenever a mouse button is pressed. More... | |
void | doodle::set_callback_mouse_released (std::function< void(MouseButtons)> &&callback) noexcept |
The provided callback is called whenever a mouse button is released. More... | |
void | doodle::set_callback_mouse_wheel (std::function< void(int)> &&callback) noexcept |
The provided callback is called whenever the mouse wheel is scrolled. More... | |
EVENT_HOOK void | on_key_pressed (doodle::KeyboardButtons button) |
The declaration of the optional on_key_pressed function to implement in your doodle program. More... | |
EVENT_HOOK void | on_key_released (doodle::KeyboardButtons button) |
The declaration of the optional on_key_released function to implement in your doodle program. More... | |
EVENT_HOOK void | on_mouse_moved (int mouse_x, int mouse_y) |
The declaration of the optional on_mouse_moved function to implement in your doodle program. More... | |
EVENT_HOOK void | on_mouse_pressed (doodle::MouseButtons button) |
The declaration of the optional on_mouse_pressed function to implement in your doodle program. More... | |
EVENT_HOOK void | on_mouse_released (doodle::MouseButtons button) |
The declaration of the optional on_mouse_released function to implement in your doodle program. More... | |
EVENT_HOOK void | on_mouse_wheel (int scroll_amount) |
The declaration of the optional on_mouse_wheel function to implement in your doodle program. More... | |
Variables | |
bool | doodle::MouseIsPressed |
The boolean system variable MouseIsPressed is true if the mouse is pressed and false if not. More... | |
bool | doodle::KeyIsPressed |
The boolean system variable KeyIsPressed is true if any key is pressed and false if no keys are pressed. More... | |
KeyboardButtons | doodle::Key |
The system variable key always contains the value of the most recent key on the keyboard that was typed. More... | |
MouseButtons | doodle::MouseButton |
doodle automatically tracks if the mouse button is pressed and which button is pressed. The value of the system variable MouseButton is either LEFT, RIGHT, or CENTER depending on which button was pressed last. More... | |
global variables related to input Events
You can register callback functions so you can immediately respond to input events. Also provides helper functions to get the mouse position.
|
noexcept |
Get the mouse's X position relative to the currently set doodle::FrameOfReference.
|
noexcept |
Get the mouse's Y position relative to the currently set doodle::FrameOfReference.
|
noexcept |
Get the previous mouse's X position relative to the currently set doodle::FrameOfReference.
|
noexcept |
Get the previous mouse's Y position relative to the currently set doodle::FrameOfReference.
EVENT_HOOK void on_key_pressed | ( | doodle::KeyboardButtons | button | ) |
The declaration of the optional on_key_pressed function to implement in your doodle program.
If you define the function definition of this function then it will be called when a keyboard button is pressed.
button | which button is being pressed |
EVENT_HOOK void on_key_released | ( | doodle::KeyboardButtons | button | ) |
The declaration of the optional on_key_released function to implement in your doodle program.
If you define the function definition of this function then it will be called when a keyboard button is released.
button | which button was released |
EVENT_HOOK void on_mouse_moved | ( | int | mouse_x, |
int | mouse_y | ||
) |
The declaration of the optional on_mouse_moved function to implement in your doodle program.
If you define the function definition of this function then it will be called whenever the mouse moves to a new position.
mouse_x | mouse x position relative to the current doodle::FrameOfReference |
mouse_y | mouse y position relative to the current doodle::FrameOfReference |
EVENT_HOOK void on_mouse_pressed | ( | doodle::MouseButtons | button | ) |
The declaration of the optional on_mouse_pressed function to implement in your doodle program.
If you define the function definition of this function then it will be called whenever a mouse button is pressed.
button | which button is being pressed |
EVENT_HOOK void on_mouse_released | ( | doodle::MouseButtons | button | ) |
The declaration of the optional on_mouse_released function to implement in your doodle program.
If you define the function definition of this function then it will be called whenever a mouse button was released.
button | which button was released |
EVENT_HOOK void on_mouse_wheel | ( | int | scroll_amount | ) |
The declaration of the optional on_mouse_wheel function to implement in your doodle program.
If you define the function definition of this function then it will be called whenever the mouse wheel scrolls.
scroll_amount | Positive for scroll up and negative for scroll down. |
|
noexcept |
The provided callback function is called once every time a key is pressed.
It takes in a std::function with a signature of something that returns nothing and takes in a doodle::KeyboardButtons. Something like
callback | what to call when a key is pressed |
|
noexcept |
The provided callback function is called once every time a key is released.
It takes in a std::function with a signature of something that returns nothing and takes in a doodle::KeyboardButtons. Something like
callback | what to call when a key is released |
|
noexcept |
The provided callback function is called every time the mouse moves.
It takes in a std::function with a signature of something that returns nothing and takes in a two integers. Something like
callback | what to call when the mouse moves |
|
noexcept |
The provided callback is called whenever a mouse button is pressed.
It takes in a std::function with a signature of something that returns nothing and takes in a doodle::MouseButtons. Something like
callback | what to call when the mouse is pressed |
|
noexcept |
The provided callback is called whenever a mouse button is released.
It takes in a std::function with a signature of something that returns nothing and takes in a doodle::MouseButtons. Something like
callback | what to call when the mouse is released |
|
noexcept |
The provided callback is called whenever the mouse wheel is scrolled.
It takes in a std::function with a signature of something that returns nothing and takes in an integer. Something like
callback | what to call when the mouse wheel is scrolled |
|
extern |
The system variable key always contains the value of the most recent key on the keyboard that was typed.
|
extern |
The boolean system variable KeyIsPressed is true if any key is pressed and false if no keys are pressed.
|
extern |
doodle automatically tracks if the mouse button is pressed and which button is pressed. The value of the system variable MouseButton is either LEFT, RIGHT, or CENTER depending on which button was pressed last.
|
extern |
The boolean system variable MouseIsPressed is true if the mouse is pressed and false if not.