25 virtual void draw()
const = 0;
28 virtual void setPos(
double x,
double y);
31 template <
class Vect>
void setPos(Vect p) {
38 virtual void setCenter(
double x,
double y);
40 template <
class Vect>
void setCenter(Vect c) {
46 void setLeft(
double x);
50 void setTop(
double y);
54 void setRight(
double x);
58 void setBottom(
double y);
75 void drawBoundingBox()
const;
Contains jngl::Vec2 class.
Base class for drawable objects with a position and a rectangle size.
double getBottom() const
Returns the distance from the bottom of the screen.
virtual void draw() const =0
Called when drawing a frame.
double getTop() const
Returns the distance from the top of the screen.
virtual void setPos(double x, double y)
Sets the position of the top-left of the Drawable.
bool contains(jngl::Vec2 point) const
Returns whether point is inside the bounding box.
virtual void step()=0
Advance object's state.
float getWidth() const
Returns the width in screen coordinates.
double getRight() const
Returns the distance from the right side of the screen.
jngl::Vec2 getCenter() const
Returns the position of the center of the Drawable.
float getHeight() const
Returns the height in screen coordinates.
Vec2 getSize() const
Returns {width, height} in screen coordinates.
void setPos(Vect p)
Sets the position of the top-left of the Drawable.
double getLeft() const
Returns the distance from the left side of the screen.