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 | |
bool | doodle::create_window () noexcept |
Create a default window. More... | |
bool | doodle::create_window (const std::string &title) noexcept |
Create a default window with a custom window title. More... | |
bool | doodle::create_window (int desired_width, int desired_height) noexcept |
Create a window with a desired screen size. More... | |
bool | doodle::create_window (const std::string &title, int desired_width, int desired_height) noexcept |
Create a window with a custom window title and a desired screen size. More... | |
bool | doodle::create_window (const std::string &title, int desired_width, int desired_height, int screen_x, int screen_y) noexcept |
Create a window with a custom window title and a desired screen size. More... | |
bool | doodle::is_window_closed () noexcept |
Is the window closed? More... | |
void | doodle::update_window () noexcept |
Update the doodle application. More... | |
void | doodle::close_window () noexcept |
Programmatically close the window. More... | |
void | doodle::set_window_title (const std::string &new_title) noexcept |
Set a new title for the window. More... | |
bool | doodle::is_full_screen () noexcept |
Is the window a fullscreen window? More... | |
void | doodle::toggle_full_screen () noexcept |
Switch back and forth between fullscreen and windowed mode. More... | |
void | doodle::set_callback_window_resized (std::function< void(int, int)> &&callback) noexcept |
The provided callback function is called whenever the window is resized by the user. More... | |
void | doodle::set_callback_window_closed (std::function< void(void)> &&callback) noexcept |
The provided callback function will be called when the user uses the OS to close the window. More... | |
void | doodle::set_callback_window_focus_changed (std::function< void(bool)> &&callback) noexcept |
THe provided callback function will be called when the window gains or loses focus. More... | |
void | doodle::show_cursor (bool show_it=true) noexcept |
This function will allow you to hide or show the mouse cursor. More... | |
EVENT_HOOK void | on_window_resized (int new_width, int new_height) |
The declaration of the optional on_window_resized function to implement in your doodle program. More... | |
EVENT_HOOK void | on_window_closed () |
The declaration of the optional on_window_closed function to implement in your doodle program. More... | |
EVENT_HOOK void | on_window_focus_changed (bool is_focused) |
The declaration of the optional on_window_focus_changed function to implement in your doodle program. More... | |
Variables | |
int | doodle::FrameCount |
The system variable FrameCount contains the number of frames that have been displayed since the program started. The first call to update_window() will set the value to 1 and subsequent calls increment the value. More... | |
double | doodle::DeltaTime |
The system variable DeltaTime contains the time difference between the beginning of the previous frame and the beginning of the current frame in seconds. More... | |
double | doodle::ElapsedTime |
Returns the number of seconds since starting the program. This information is often used for timing events and animation sequences. More... | |
int | doodle::Width |
System variable that stores the width of the drawing canvas. This value is set by the desired_width parameter of the create_window() function. For example, the function call create_window(320, 240) sets the width variable to the value 320. More... | |
int | doodle::Height |
System variable that stores the height of the drawing canvas. This value is set by the desired_height parameter of the create_window() function. For example, the function call create_window(320, 240) sets the height variable to the value 240. More... | |
bool | doodle::WindowIsFocused |
Confirms if the window a doodle program is in is "focused," meaning that the doodle will accept mouse or keyboard input. This variable is "true" if the window is focused and "false" if not. More... | |
global variables related to the state of the doodle
|
noexcept |
Programmatically close the window.
|
noexcept |
Create a default window.
Creates a window in the middle of the screen, roughly 75% the width & height of the monitor.
On a 1920x1080 monitor:
|
noexcept |
Create a default window with a custom window title.
title | custom title for the window |
On a 1920x1080 monitor:
|
noexcept |
Create a window with a custom window title and a desired screen size.
title | custom title for the window |
desired_width | how wide you'd like the screen space to be |
desired_height | how tall you'd like the screen space to be |
|
noexcept |
Create a window with a custom window title and a desired screen size.
title | custom title for the window |
desired_width | how wide you'd like the screen space to be |
desired_height | how tall you'd like the screen space to be |
screen_x | with respect to the top left of the window, defines where to position the window on the monitor screen |
screen_y | with respect to the top left of the window, defines where to position the window on the monitor screen |
|
noexcept |
Create a window with a desired screen size.
desired_width | how wide you'd like the screen space to be |
desired_height | how tall you'd like the screen space to be |
|
noexcept |
Is the window a fullscreen window?
|
noexcept |
Is the window closed?
Should be used to drive the applications main loop. If the user closes the window through the operating system then you need to end your loop.
EVENT_HOOK void on_window_closed | ( | ) |
The declaration of the optional on_window_closed function to implement in your doodle program.
If you define the function definition of this function then it will be called when the window closes.
Prints the following:
EVENT_HOOK void on_window_focus_changed | ( | bool | is_focused | ) |
The declaration of the optional on_window_focus_changed function to implement in your doodle program.
If you define the function definition of this function then it will be called when the window changes it's focus.
is_focused | true when window has focus and false otherwise |
EVENT_HOOK void on_window_resized | ( | int | new_width, |
int | new_height | ||
) |
The declaration of the optional on_window_resized function to implement in your doodle program.
If you define the function definition of this function then it will be called when the window resizes.
new_width | Width of the new window resolution |
new_height | Height of the new window resolution |
|
noexcept |
The provided callback function will be called when the user uses the OS to close the window.
It takes in a std::function with a signature of something that returns nothing and takes in nothing. Something like
callback | what to call when the window will close |
Prints the following:
|
noexcept |
THe provided callback function will be called when the window gains or loses focus.
It takes in a std::function with a signature of something that returns nothing and takes in a boolean. Something like
callback | what to call when the window has lost or gained focus |
|
noexcept |
The provided callback function is called whenever the window is resized by the user.
It takes in a std::function with a signature of something that returns nothing and takes in two integers. Something like
callback | what to call when the window is resized |
|
noexcept |
Set a new title for the window.
new_title | a new title for the window |
|
noexcept |
This function will allow you to hide or show the mouse cursor.
show_it | should the cursor be visible or not |
|
noexcept |
Switch back and forth between fullscreen and windowed mode.
|
noexcept |
Update the doodle application.
This needs to be called once every frame of the main loop. This is where events and drawing logic is updated.
|
extern |
The system variable DeltaTime contains the time difference between the beginning of the previous frame and the beginning of the current frame in seconds.
This variable is useful for creating time sensitive animation or physics calculation that should stay constant regardless of frame rate.
|
extern |
Returns the number of seconds since starting the program. This information is often used for timing events and animation sequences.
|
extern |
The system variable FrameCount contains the number of frames that have been displayed since the program started. The first call to update_window() will set the value to 1 and subsequent calls increment the value.
|
extern |
System variable that stores the height of the drawing canvas. This value is set by the desired_height parameter of the create_window() function. For example, the function call create_window(320, 240) sets the height variable to the value 240.
|
extern |
System variable that stores the width of the drawing canvas. This value is set by the desired_width parameter of the create_window() function. For example, the function call create_window(320, 240) sets the width variable to the value 320.
|
extern |
Confirms if the window a doodle program is in is "focused," meaning that the doodle will accept mouse or keyboard input. This variable is "true" if the window is focused and "false" if not.