Simple Graphics Library
0.9.5
SGL API
|
Public Member Functions | |
ProceduralWindow (const std::string &title, double x, double y, double width, double height) | |
void | paint () override |
void | mouse_pressed (double x, double y, MouseButton b) override |
void | mouse_released (double x, double y, MouseButton b) override |
void | mouse_moved (double x, double y) override |
void | mouse_dragged (double x, double y) override |
void | key_pressed (int k, double x, double y) override |
![]() | |
ObjectWindow (const std::string &title, int left, int top, int width, int height, double min_x, double max_x, double min_y, double max_y) | |
ObjectWindow (const std::string &title, int width, int height) | |
ObjectWindow (const std::string &title, double min_x, double max_x, double min_y, double max_y) | |
ObjectWindow () | |
~ObjectWindow () | |
void | prepaint () override |
void | postpaint () override |
void | internal_add (GraphicalObject *obj) |
template<typename T , typename... Args> | |
T * | add (Args &&... args) |
void | remove (GraphicalObject *obj) |
void | remove_all () |
GraphicalObject * | hit (double x, double y) const |
std::vector< GraphicalObject * >::iterator | begin () |
std::vector< GraphicalObject * >::iterator | end () |
![]() | |
Window (const std::string &title, int left, int top, int width, int height, double min_x, double max_x, double min_y, double max_y) | |
Window (const std::string &title, int width, int height) | |
Window (const std::string &title, double min_x, double max_x, double min_y, double max_y) | |
Window () | |
virtual | ~Window () |
virtual void | clear () |
virtual void | set_title (const std::string &str) |
virtual void | set_background_color (const Color &color) |
virtual void | set_position (int x, int y) |
virtual void | set_size (int width, int height) |
virtual void | set_viewport (double left, double right, double bottom, double top) |
virtual void | set_visible (bool visible) |
virtual CursorShape | set_cursor (CursorShape cursor) |
virtual CursorShape | get_cursor () |
virtual void | run () |
virtual void | repaint () |
virtual void | paint_all () |
virtual int | get_x () const |
virtual int | get_y () const |
virtual int | get_width () const |
virtual int | get_height () const |
virtual void | set_window_size (int w, int h) |
virtual void | resized (int w, int h) |
virtual double | get_min_x () const |
virtual double | get_max_x () const |
virtual double | get_min_y () const |
virtual double | get_max_y () const |
virtual void | draw_axes (double x_inc, double y_inc) const |
virtual void | mouse_entered () |
virtual void | mouse_exited () |
KeyModifier | get_key_modifiers () const |
void | set_key_modifiers (KeyModifier mod) |
virtual void | start_timer (int msec) |
virtual void | timer_expired () |
Public Attributes | |
std::function< void()> | paint_function |
std::function< void(double, double, MouseButton)> | mouse_pressed_function |
std::function< void(double, double, MouseButton)> | mouse_released_function |
std::function< void(double, double)> | mouse_moved_function |
std::function< void(double, double)> | mouse_dragged_function |
std::function< void(int, double, double)> | key_pressed_function |
Additional Inherited Members | |
![]() | |
void | initialize (const std::string &title, int left, int top, int width, int height, double min_x, double max_x, double min_y, double max_y) |
![]() | |
std::vector< GraphicalObject * > | object_list |
GraphicalObject * | active_object |
![]() | |
double | min_x |
double | max_x |
double | min_y |
double | max_y |
CursorShape | normal_cursor |
KeyModifier | key_mods |
|
inlineoverridevirtual |
Called by the event manager when the user types a key when the window has keyboard focus. The key pressed and the location of the mouse pointer in viewport coordinates is reported.
k | the key typed by the user |
x | the x coordinate in viewport coordinates of the location of the mouse pointer within the window |
y | the y coordinate in viewport coordinates of the location of the mouse pointer within the window |
Reimplemented from sgl::ObjectWindow.
|
inlineoverridevirtual |
Called by the event manager when the user drags the mouse (moves the mouse while holding down a mouse button) when the mouse pointer is within the window. The location reported is given in viewport coordinates.
x | the x coordinate in viewport coordinates of the location of the mouse pointer within the window during the most recent mouse event. |
y | the y coordinate in viewport coordinates of the location of the mouse pointer within the window during the most recent mouse event. |
Reimplemented from sgl::ObjectWindow.
|
inlineoverridevirtual |
Called by the event manager when the user moves the mouse when the mouse pointer is within the window. The location reported is given in viewport coordinates.
x | the x coordinate in viewport coordinates of the location of the mouse pointer within the window during the most recent mouse event. |
y | the y coordinate in viewport coordinates of the location of the mouse pointer within the window during the most recent mouse event. |
Reimplemented from sgl::ObjectWindow.
|
inlineoverridevirtual |
Called by the event loop when the user depresses any mouse button when the mouse pointer is within the window.
x | the x coordinate in viewport coordinates of the mouse pointer location within the window during the current mouse event. |
y | the y coordinate in viewport coordinates of the mouse pointer location within the window during the current mouse event. |
button | the button that was depressed, left (LEFT_BUTTON) or right (RIGHT_BUTTON) during the current mouse event. |
Reimplemented from sgl::ObjectWindow.
|
inlineoverridevirtual |
Called by the event manager when the user releases any mouse button when the mouse pointer is within the window.
x | the x coordinate in viewport coordinates of the mouse pointer location within the window during the current mouse event. |
y | the y coordinate in viewport coordinates of the mouse pointer location within the window during the current mouse event. |
button | the button that was released, left (LEFT_BUTTON) or right (RIGHT_BUTTON) during the current mouse event. |
Reimplemented from sgl::ObjectWindow.
|
inlineoverridevirtual |
Responsible for rendering the image in the window's viewport. This method is abstract, so concrete derived classes must provide a concrete implementation.
Implements sgl::Window.