|
Simple Graphics Library
0.9.5
SGL API
|
#include <sgl.h>


Public Member Functions | |
| DisplayDigit (Color color, double x, double y, double height) | |
| void | paint () const override |
| void | set_value (int value) |
| int | get_value () const |
| void | increment () |
| void | decrement () |
| void | resize (double inc) |
| void | mouse_dragged (double x, double y) override |
Public Member Functions inherited from sgl::GraphicalObject | |
| GraphicalObject (double left, double bottom, double width, double height) | |
| GraphicalObject (const GraphicalObject &other) | |
| GraphicalObject & | operator= (const GraphicalObject &other) |
| virtual | ~GraphicalObject () |
| virtual double | get_left () const |
| virtual double | get_bottom () const |
| virtual double | get_width () const |
| virtual double | get_height () const |
| virtual void | set (double x, double y, double width, double height) |
| virtual void | move_to (double left, double bottom) |
| virtual void | mouse_pressed (double x, double y, MouseButton button) |
| virtual void | mouse_released (double x, double y, MouseButton button) |
| virtual void | mouse_moved (double x, double y) |
| virtual void | key_pressed (int k, double x, double y) |
| virtual bool | hit (double x, double y) |
| virtual Window * | set_window (ObjectWindow *win) |
| virtual Window * | get_window () const |
| virtual void | set_mouse_over (bool flag) |
| virtual CursorShape | set_cursor (CursorShape cursor) |
| virtual CursorShape | get_cursor () |
Protected Attributes | |
| SevenSegmentDigit | led |
Protected Attributes inherited from sgl::GraphicalObject | |
| ObjectWindow * | window |
| double | x_hit_offset |
| double | y_hit_offset |
| double | left |
| double | bottom |
| double | width |
| double | height |
| CursorShape | cursor |
| bool | mouse_over |
Additional Inherited Members | |
Public Attributes inherited from sgl::GraphicalObject | |
| const unsigned | id |
A graphical object wrapper for a seven-segment digit display.
| sgl::DisplayDigit::DisplayDigit | ( | Color | color, |
| double | x, | ||
| double | y, | ||
| double | height | ||
| ) |
The constructor sets the digit's color, position, and height.
| color | the color of the digit |
| x | the x coordinate of the digit's lower-left corner |
| y | the y coordinate of the digit's lower-left corner |
| height | the height of the digit |
| void sgl::DisplayDigit::decrement | ( | ) |
Decreases the digit's value by 1, modulo 10.
| int sgl::DisplayDigit::get_value | ( | ) | const |
Returns the digit's current value.
| void sgl::DisplayDigit::increment | ( | ) |
Increases the digit's value by 1, modulo 10.
|
overridevirtual |
Moves the digit to a new location. The digit's size is unaffected.
| x | the new x coordinate of the digit's lower-left corner. |
| y | the new y coordinate of the digit's lower-left corner. |
Reimplemented from sgl::GraphicalObject.
|
overridevirtual |
Draws the digit.
Implements sgl::GraphicalObject.
| void sgl::DisplayDigit::resize | ( | double | inc | ) |
Changes the height of the digit by a given amount. The digit's width changes proportionally.
| the | change in the height of the digit |
| void sgl::DisplayDigit::set_value | ( | int | value | ) |
Set's the value of the digit. The assigned value is modulo ten.
| value | value to assign, modulo 10 |
|
protected |
The wrapper seven-segment digit display.
1.8.13