trase
|
Public Member Functions | |
void | init (const vfloat2_t &pixels, const char *name) |
Initialise this backend. More... | |
void | finalise () |
Finalise this backend. Call after all drawing finished. | |
vfloat2_t | begin_frame () |
Begin a new frame. More... | |
void | end_frame () |
End the current frame. More... | |
bool | is_interactive () |
Return true if this backend has mouse interaction. | |
bool | should_close () |
Returns true if the current window should close (e.g. More... | |
float | get_time () |
Get the current time. | |
vfloat2_t | get_mouse_pos () |
Get the current position of the mouse in pixel units. | |
bool | mouse_dragging () |
Returns true if the mouse button is clicked and the mouse is dragging. | |
vfloat2_t | mouse_drag_delta () |
Current delta position of the dragging mouse. | |
void | mouse_drag_reset_delta () |
Reset drag delta to zero. | |
void | scissor (const bfloat2_t &x) |
All subsequent drawing calls will be masked to only show within the bounding box x . | |
void | reset_scissor () |
Remove a previously call to scissor() | |
void | rotate (const float angle) |
Apply a rotation of angle to the current drawing transform. | |
void | translate (const vfloat2_t &v) |
Apply a translation of v to the current drawing transform. | |
void | reset_transform () |
Reset the drawing transform to the identity matrix. | |
void | begin_path () |
Begin a path. More... | |
void | move_to (const vfloat2_t &x) |
Extends the current path. More... | |
void | line_to (const vfloat2_t &x) |
Extends the current path. More... | |
void | stroke () |
Draw a line along the completed path. More... | |
void | fill () |
Draw a line along the completed path and fill it in. More... | |
void | stroke_width (const float lw) |
Set the current stroke width. More... | |
void | stroke_color (const RGBA &color) |
Set the current stroke color. More... | |
void | fill_color (const RGBA &color) |
Set the current fill color. More... | |
void | rounded_rect (const bfloat2_t &x, const float r) |
Draw a rectangle with rounded corners. More... | |
void | rect (const bfloat2_t &x) |
Draw a rectangle. More... | |
void | circle (const vfloat2_t ¢re, float radius) |
Draw a circle with a given centre and radius . | |
void | text (const vfloat2_t &x, const char *string, const char *end) |
Draw the given text to the screen. More... | |
bfloat2_t | text_bounds (const vfloat2_t &x, const char *string) |
Returns the bounding box covering the given text. More... | |
void | font_size (float size) |
Sets the current font height in pixels. More... | |
void | font_face (const char *face) |
Sets the current font name. More... | |
void | font_blur (const float blur) |
Sets the amount of blur to apply to the drawn text. More... | |
void | text_align (const int align) |
Sets the alignment of the text to its position. More... | |
![]() | |
virtual void | accept (Drawable &drawable, float time)=0 |
Static Public Member Functions | |
static void | set_mouse_down (const vfloat2_t &mouse_pos) |
static void | set_mouse_up () |
vfloat2_t trase::BackendGL::begin_frame | ( | ) |
Begin a new frame.
All drawing calls must be between begin_frame() and end_frame()
void trase::BackendGL::begin_path | ( | ) |
void trase::BackendGL::end_frame | ( | ) |
End the current frame.
All drawing calls must be between begin_frame() and end_frame()
void trase::BackendGL::fill | ( | ) |
Draw a line along the completed path and fill it in.
void trase::BackendGL::font_blur | ( | const float | blur | ) |
Sets the amount of blur to apply to the drawn text.
void trase::BackendGL::font_face | ( | const char * | face | ) |
Sets the current font name.
void trase::BackendGL::font_size | ( | float | size | ) |
Sets the current font height in pixels.
void trase::BackendGL::init | ( | const vfloat2_t & | pixels, |
const char * | name | ||
) |
Initialise this backend.
Call before any drawing
pixels | the size of the window in pixels |
name | the name of the window |
void trase::BackendGL::line_to | ( | const vfloat2_t & | x | ) |
Extends the current path.
Draws a straight line from the current "pen" position to x
void trase::BackendGL::move_to | ( | const vfloat2_t & | x | ) |
void trase::BackendGL::rect | ( | const bfloat2_t & | x | ) |
Draw a rectangle.
x | the bounding box describing the rectangle |
void trase::BackendGL::rounded_rect | ( | const bfloat2_t & | x, |
const float | r | ||
) |
Draw a rectangle with rounded corners.
x | the bounding box describing the rectangle |
r | the radius of the rounded corners |
bool trase::BackendGL::should_close | ( | ) |
Returns true if the current window should close (e.g.
due to user interaction)
void trase::BackendGL::stroke | ( | ) |
Draw a line along the completed path.
void trase::BackendGL::stroke_color | ( | const RGBA & | color | ) |
Set the current stroke color.
void trase::BackendGL::stroke_width | ( | const float | lw | ) |
Set the current stroke width.
void trase::BackendGL::text | ( | const vfloat2_t & | x, |
const char * | string, | ||
const char * | end | ||
) |
Draw the given text to the screen.
x | the position to draw the text |
a | pointer to the text |
end | the end of the text to draw (use nullptr to draw entire string) |
void trase::BackendGL::text_align | ( | const int | align | ) |
Sets the alignment of the text to its position.
Returns the bounding box covering the given text.
x | the drawing position of the text |
string | pointer to the text |