![]() |
TinyLib 0.1.1
|
#include <Drawable.h>
Public Member Functions | |
Drawable (Vec4i bounds={0, 0, 0, 0}) | |
Creates a new drawable object with it's position and size. | |
~Drawable () | |
Nothing to clean up for now. | |
void | setPosition (Vec2i) |
Set position of this drawable object. | |
void | setSize (Vec2i) |
Set size of this drawable object. | |
Vec2i | getPosition () const |
Get the current position of this drawable object. | |
Vec2i | getSize () const |
Get the current size of this drawable object. | |
Color | getColor () const |
Get the current color of this drawable object. | |
void | move (Vec2i) |
Move this drawable object from current position. | |
void | setColor (Color) |
Set the color of this drawable object. | |
bit | intersects (Drawable &) const |
Check if this drawable is intersecting with another. | |
bit | intersects (Window &) const |
Check if this drawable is inside the window. | |
Protected Attributes | |
s32 | posX |
s32 | posY |
s32 | sizeX |
s32 | sizeY |
u8 | r = 0 |
u8 | g = 0 |
u8 | b = 0 |
u8 | a = 0 |
Definition at line 11 of file Drawable.h.
tl::Drawable::Drawable | ( | Vec4i | bounds = {0, 0, 0, 0} | ) |
Creates a new drawable object with it's position and size.
bounds | Boundaries of this drawable, (width, height, left, top). |
Definition at line 9 of file Drawable.cpp.
tl::Drawable::~Drawable | ( | ) |
Nothing to clean up for now.
Definition at line 17 of file Drawable.cpp.
Color tl::Drawable::getColor | ( | ) | const |
Get the current color of this drawable object.
Definition at line 75 of file Drawable.cpp.
Vec2i tl::Drawable::getPosition | ( | ) | const |
Get the current position of this drawable object.
Definition at line 41 of file Drawable.cpp.
Vec2i tl::Drawable::getSize | ( | ) | const |
Get the current size of this drawable object.
Definition at line 49 of file Drawable.cpp.
Check if this drawable is intersecting with another.
other | The drawable object to compare with this one. |
Compares the boundaries of both drawable objects. Using position and size, if they overlap anywhere, then this is true for an intersection.
Definition at line 87 of file Drawable.cpp.
Check if this drawable is inside the window.
window | The window to compare with. |
If this drawable is fully outside window (not visible), then it will return false. Helpful for rendering only on-screen objects.
Definition at line 102 of file Drawable.cpp.
void tl::Drawable::move | ( | Vec2i | pos | ) |
Move this drawable object from current position.
pos | How far to move the x, y of this Drawable. |
Sets position relative to current position offset by x and y parameters.
Definition at line 59 of file Drawable.cpp.
void tl::Drawable::setColor | ( | Color | color | ) |
Set the color of this drawable object.
color | New color for this object. |
Definition at line 67 of file Drawable.cpp.
void tl::Drawable::setPosition | ( | Vec2i | pos | ) |
Set position of this drawable object.
pos | New x, y position for this drawable. |
Definition at line 25 of file Drawable.cpp.
void tl::Drawable::setSize | ( | Vec2i | size | ) |
Set size of this drawable object.
size | Set the width, height of this drawable. |
Definition at line 33 of file Drawable.cpp.
|
protected |
Definition at line 28 of file Drawable.h.
|
protected |
Definition at line 28 of file Drawable.h.
|
protected |
Definition at line 28 of file Drawable.h.
|
protected |
Definition at line 27 of file Drawable.h.
|
protected |
Definition at line 27 of file Drawable.h.
|
protected |
Definition at line 28 of file Drawable.h.
|
protected |
Definition at line 27 of file Drawable.h.
|
protected |
Definition at line 27 of file Drawable.h.