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


Public Member Functions | |
| DoubleDigit (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 |
| void | set_leading_zero (bool flag) |
| void | set_visible (bool flag) |
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 | tens |
| SevenSegmentDigit | ones |
| bool | leading_zero |
| bool | visible |
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 representing a two-digit seven-segment display.
| sgl::DoubleDigit::DoubleDigit | ( | Color | color, |
| double | x, | ||
| double | y, | ||
| double | height | ||
| ) |
The constructor sets the digit's color, position, and height. The digit's value is initially zero.
| color | the color of the digit |
| x | the x coordinate of the tens digit's lower-left corner |
| y | the y coordinate of the tens digit's lower-left corner |
| height | the height of the digits |
| void sgl::DoubleDigit::decrement | ( | ) |
Decreases the digit's value by 1, modulo 100.
| int sgl::DoubleDigit::get_value | ( | ) | const |
Returns the current value.
| void sgl::DoubleDigit::increment | ( | ) |
Increases the digit's value by 1, modulo 100.
|
overridevirtual |
Moves the digits to a new location. The digits' sizes are unaffected.
| x | the new x coordinate of the tens digit's lower-left corner. |
| y | the new y coordinate of the tens digit's lower-left corner. |
Reimplemented from sgl::GraphicalObject.
|
overridevirtual |
Draws the digits.
Implements sgl::GraphicalObject.
| void sgl::DoubleDigit::resize | ( | double | inc | ) |
Changes the height of the digits by a given amount. The digits' width changes proportionally.
| the | change in the height of the digits |
| void sgl::DoubleDigit::set_leading_zero | ( | bool | flag | ) |
Turns on or off the display of a leading zero.
| flag | if true, a leading zero is displayed; otherwise, a leading zero is not displayed. |
| void sgl::DoubleDigit::set_value | ( | int | value | ) |
Set's the value of the digits. The assigned value is modulo 100.
| value | value to assign, modulo 100 |
| void sgl::DoubleDigit::set_visible | ( | bool | flag | ) |
Makes the display visible or invisible.
| flag | if true, the digits are visible otherwise, the digits are invisible. |
|
protected |
If true, a leading zero is visible; otherwise, a leading zero is not displayed.
|
protected |
The ones digit.
|
protected |
The tens digit.
|
protected |
If true, the display is visible; otherwise, it is invisible.
1.8.13