36 lines
570 B
C++
36 lines
570 B
C++
#ifndef ELEMENT_HPP
|
|
#define ELEMENT_HPP
|
|
|
|
#include <vector>
|
|
#include "point.hpp"
|
|
|
|
struct Head {
|
|
Head();
|
|
Point m_head;
|
|
Point m_previous_head;
|
|
void get_new_pos();
|
|
};
|
|
|
|
struct Tail {
|
|
Point m_tail_pos;
|
|
Point m_previous_tail_pos;
|
|
};
|
|
|
|
struct Body {
|
|
Body();
|
|
std::vector<Tail> m_body;
|
|
int m_score;
|
|
bool m_collision;
|
|
void check_new_tail();
|
|
void check_collision(Head &head);
|
|
void get_new_points(Head &head);
|
|
};
|
|
|
|
struct Fruit {
|
|
Fruit();
|
|
Point m_point;
|
|
void get_new_pos(std::array<std::array<char, COL>, ROW> &board, Head &head, int &score);
|
|
};
|
|
|
|
#endif // ELEMENT_HPP
|