geekbrains_gof/SBomber/include/GameObject.h

43 lines
687 B
C
Raw Normal View History

2021-12-20 22:22:05 +00:00
#pragma once
#include <cstdint>
2021-12-25 05:46:23 +00:00
class GameObject
{
2021-12-20 22:22:05 +00:00
public:
2021-12-25 05:46:23 +00:00
GameObject() : x(0.0), y(0.0), width(0)
{
}
virtual ~GameObject() = default;
2021-12-20 22:22:05 +00:00
2021-12-25 05:46:23 +00:00
virtual void Draw() const = 0;
2021-12-20 22:22:05 +00:00
2021-12-25 05:46:23 +00:00
virtual inline void SetPos(double nx, double ny)
{
x = nx;
y = ny;
}
2021-12-20 22:22:05 +00:00
2021-12-25 05:46:23 +00:00
virtual inline double GetY() const
{
return y;
}
virtual inline double GetX() const
{
return x;
}
2021-12-20 22:22:05 +00:00
2021-12-25 05:46:23 +00:00
virtual inline void SetWidth(uint16_t widthN)
{
width = widthN;
}
virtual inline uint16_t GetWidth() const
{
return width;
}
2021-12-20 22:22:05 +00:00
protected:
2021-12-25 05:46:23 +00:00
double x, y;
uint16_t width;
2021-12-20 22:22:05 +00:00
};