49 lines
747 B
C++
49 lines
747 B
C++
#pragma once
|
|
|
|
#include <vector>
|
|
|
|
#include "Point.h"
|
|
#include "PaintDevice.h"
|
|
|
|
class Figure
|
|
{
|
|
protected:
|
|
Point m_Position;
|
|
|
|
Point m_PositionBackup;
|
|
|
|
double m_TimeFromLastUpdate = 0;
|
|
double m_TimeForUpdate = 500;
|
|
|
|
std::vector<std::vector<Point>> m_Body;
|
|
|
|
size_t m_CurrentRotate = 0;
|
|
size_t m_CurrentRotateBackup = 0;
|
|
|
|
public:
|
|
explicit Figure(Point position);
|
|
|
|
virtual ~Figure() = default;
|
|
|
|
void update(double dt);
|
|
|
|
void render(PaintDevice& paintDevice);
|
|
|
|
void move_left();
|
|
|
|
void move_right();
|
|
|
|
void boost();
|
|
|
|
void rotate();
|
|
|
|
void backup();
|
|
|
|
void restore();
|
|
|
|
Point get_position() const;
|
|
|
|
void set_position(Point position);
|
|
|
|
const std::vector<Point>& get_body() const;
|
|
}; |