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.
|
Enumerations | |
enum class | doodle::EllipseMode { doodle::Center , doodle::Corner } |
With set_ellipse_mode(), modifies the location from which ellipses are drawn by changing the way in which parameters given to draw_ellipse() are interpreted. More... | |
enum class | doodle::RectMode { doodle::Corner , doodle::Center } |
With set_rectangle_mode(), modifies the location from which rectangles are drawn by changing the way in which parameters given to draw_rectangle() are interpreted. More... | |
enum class | doodle::FrameOfReference { doodle::RightHanded_OriginCenter , doodle::RightHanded_OriginBottomLeft , doodle::LeftHanded_OriginTopLeft } |
Used to define the coordinate system you would like to reference. More... | |
Functions | |
void | doodle::draw_ellipse (double x, double y, double width, double height=0) noexcept |
Draws an ellipse (oval) to the screen. More... | |
void | doodle::draw_line (double x1, double y1, double x2, double y2) noexcept |
Draws a line (a direct path between two points) to the screen. More... | |
void | doodle::draw_quad (double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) noexcept |
Draw a quad. More... | |
void | doodle::draw_rectangle (double x, double y, double width, double height=0) noexcept |
Draws a rectangle to the screen. More... | |
void | doodle::draw_triangle (double x1, double y1, double x2, double y2, double x3, double y3) noexcept |
Draw a triangle to the screen. More... | |
void | doodle::set_ellipse_mode (EllipseMode mode) noexcept |
Modifies the location from which ellipses are drawn by changing the way in which parameters given to draw_ellipse() are interpreted. More... | |
void | doodle::set_rectangle_mode (RectMode mode) noexcept |
Modifies the location from which rectangles are drawn by changing the way in which parameters given to draw_rectangle() are interpreted. More... | |
void | doodle::set_frame_of_reference (FrameOfReference frame_of_reference) noexcept |
Change the coordinate system you would like to use when describing your primitives. More... | |
void | doodle::smooth_drawing () noexcept |
Draws all geometry with smooth (anti-aliased) edges. More... | |
void | doodle::no_smoothing () noexcept |
Draws all geometry with jagged (aliased) edges. More... | |
void | doodle::set_outline_width (double line_width) noexcept |
Sets the width of the outline used for lines and the border around shapes. All widths are set in units of pixels. More... | |
void | doodle::push_settings () noexcept |
The push_settings() function saves the current drawing style settings and transformations, while pop_settings() restores these settings. More... | |
void | doodle::pop_settings () noexcept |
The pop_settings() function restores to the previous style settings and transformations, while push_settings() saves a new set these settings. More... | |
|
strong |
With set_ellipse_mode(), modifies the location from which ellipses are drawn by changing the way in which parameters given to draw_ellipse() are interpreted.
Enumerator | |
---|---|
Center | Interprets the first two parameters of draw_ellipse() as the shape's center point. |
Corner | Interprets the first two parameters of draw_ellipse() as the upper-left or bottom-left corner of the shape in a left handed doodle::FrameOfReference and right handed doodle::FrameOfReference respectively. |
Definition at line 661 of file drawing.hpp.
|
strong |
Used to define the coordinate system you would like to reference.
Definition at line 777 of file drawing.hpp.
|
strong |
With set_rectangle_mode(), modifies the location from which rectangles are drawn by changing the way in which parameters given to draw_rectangle() are interpreted.
Enumerator | |
---|---|
Corner | The default mode is RectMode::CORNER, which interprets the first two parameters of draw_rectangle() as the upper-left or bottom-left corner of the shape in a left handed doodle::FrameOfReference and right handed doodle::FrameOfReference respectively. |
Center | RectMode::CENTER interprets the first two parameters of draw_rectangle() as the shape's center point. |
Definition at line 718 of file drawing.hpp.
|
noexcept |
Draws an ellipse (oval) to the screen.
An ellipse with equal width and height is a circle. By default, the first two parameters set the location, and the third and fourth parameters set the shape's width and height. If no height is specified, the value of width is used for both the width and height. The origin may be changed with the set_ellipse_mode() function. By default the (x,y) location is in the center of the ellipse.
x | x-coordinate of the ellipse. |
y | y-coordinate of the ellipse. |
width | width of the ellipse. |
height | height of the ellipse. |
|
noexcept |
Draws a line (a direct path between two points) to the screen.
To color a line, use the set_outline_color() function. A line cannot be filled, therefore the set_fill_color() function will not affect the color of a line. Lines are drawn with a width of one pixel by default, but this can be changed with the set_outline_width() function.
x1 | the x-coordinate of the first point |
y1 | the y-coordinate of the first point |
x2 | the x-coordinate of the second point |
y2 | the y-coordinate of the second point |
|
noexcept |
Draw a quad.
A quad is a quadrilateral, a four sided polygon. It is similar to a rectangle, but the angles between its edges are not constrained to ninety degrees. The first pair of parameters (x1,y1) sets the first vertex and the subsequent pairs should proceed clockwise or counter-clockwise around the defined shape.
x1 | the x-coordinate of the first point |
y1 | the y-coordinate of the first point |
x2 | the x-coordinate of the second point |
y2 | the y-coordinate of the second point |
x3 | the x-coordinate of the third point |
y3 | the y-coordinate of the third point |
x4 | the x-coordinate of the fourth point |
y4 | the y-coordinate of the forth point |
|
noexcept |
Draws a rectangle to the screen.
A rectangle is a four-sided shape with every angle at ninety degrees. By default, the first two parameters set the location of a corner, the third sets the width, and the fourth sets the height. The way these parameters are interpreted, however, may be changed with the set_rectangle_mode() function. If the height is omitted then the height will be set to the width, thus creating a square.
x | x-coordinate of the rectangle. |
y | y-coordinate of the rectangle. |
width | width of the rectangle. |
height | height of the rectangle. |
|
noexcept |
Draw a triangle to the screen.
A triangle is a plane created by connecting three points. The first two arguments specify the first point, the middle two arguments specify the second point, and the last two arguments specify the third point.
x1 | the x-coordinate of the first point |
y1 | the y-coordinate of the first point |
x2 | the x-coordinate of the second point |
y2 | the y-coordinate of the second point |
x3 | the x-coordinate of the third point |
y3 | the y-coordinate of the third point |
|
noexcept |
Draws all geometry with jagged (aliased) edges.
Note that smooth_drawing() is active by default in; no_smoothing() can be used to disable smoothing of geometry, images, and fonts.
|
noexcept |
The pop_settings() function restores to the previous style settings and transformations, while push_settings() saves a new set these settings.
Note that these functions are always used together. They allow you to change the style and transformation settings and later return to what you had. When a new state is started with push_settings(), it builds on the current style and transform information. The push_settings() and pop_settings() functions can be embedded to provide more control.
push_settings() stores information related to the current transformation (apply_scale(), apply_rotate(), apply_translate(), apply_matrix()) state and style settings controlled by the following functions: set_fill_color(), no_fill(), set_outline_color(), no_outline(), set_ellipse_mode(), set_rectangle_mode(), smooth_drawing(), no_smoothing(), set_outline_width(), set_tint_color(), no_tint(), set_image_mode(), set_font(), set_frame_of_reference()
|
noexcept |
The push_settings() function saves the current drawing style settings and transformations, while pop_settings() restores these settings.
Note that these functions are always used together. They allow you to change the style and transformation settings and later return to what you had. When a new state is started with push_settings(), it builds on the current style and transform information. The push_settings() and pop_settings() functions can be embedded to provide more control.
push_settings() stores information related to the current transformation (apply_scale(), apply_rotate(), apply_translate(), apply_matrix()) state and style settings controlled by the following functions: set_fill_color(), no_fill(), set_outline_color(), no_outline(), set_ellipse_mode(), set_rectangle_mode(), smooth_drawing(), no_smoothing(), set_outline_width(), set_tint_color(), no_tint(), set_image_mode(), set_font(), set_frame_of_reference()
|
noexcept |
Modifies the location from which ellipses are drawn by changing the way in which parameters given to draw_ellipse() are interpreted.
The default mode is EllipseMode::CENTER, which interprets the first two parameters of draw_ellipse() as the shape's center point, while the third and fourth parameters are its width and height.
EllipseMode::CORNER interprets the first two parameters of draw_ellipse() as the upper-left or bottom-left corner of the shape in a left handed doodle::FrameOfReference and right handed doodle::FrameOfReference respectively, while the third and fourth parameters are its width and height.
mode | either CENTER or CORNER |
|
noexcept |
Change the coordinate system you would like to use when describing your primitives.
frame_of_reference | The coordinate system you would like to use. |
|
noexcept |
Sets the width of the outline used for lines and the border around shapes. All widths are set in units of pixels.
line_width | how thick to make lines |
|
noexcept |
Modifies the location from which rectangles are drawn by changing the way in which parameters given to draw_rectangle() are interpreted.
The default mode is RectMode::CORNER, which interprets the first two parameters of draw_rectangle() as upper-left or bottom-left corner of the shape in a left handed doodle::FrameOfReference and right handed doodle::FrameOfReference respectively, while the third and fourth parameters are its width and height.
RectMode::CENTER interprets the first two parameters of draw_rectangle() as the shape's center point, while the third and fourth parameters are its width and height.
mode | either CORNER or CENTER |
|
noexcept |
Draws all geometry with smooth (anti-aliased) edges.
Note that smooth_drawing() is active by default in; no_smoothing() can be used to disable smoothing of geometry, images, and fonts.