final commit for the time being

This commit is contained in:
DarthMooMancer
2025-08-30 13:26:31 -04:00
parent b0393c65f2
commit cfa0e52705
4 changed files with 7 additions and 9 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ struct Body {
bool m_collision; bool m_collision;
void check_new_tail(); void check_new_tail();
void check_collision(Head &head); void check_collision(Head &head);
void get_new_points(Head &head); void get_new_pos(Head &head);
}; };
struct Fruit { struct Fruit {
+2 -4
View File
@@ -1,9 +1,7 @@
#ifndef GLOBALS_HPP #ifndef GLOBALS_HPP
#define GLOBALS_HPP #define GLOBALS_HPP
#include <cstdint> constexpr unsigned int ROW = 11;
constexpr unsigned int COL = 11;
constexpr uint16_t ROW = 11;
constexpr uint16_t COL = 11;
#endif // GLOBALS_HPP #endif // GLOBALS_HPP
+1 -1
View File
@@ -56,7 +56,7 @@ void Body::check_new_tail() {
} }
} }
void Body::get_new_points(Head &head) { void Body::get_new_pos(Head &head) {
for (int i = 0; i < m_body.size(); i++) { for (int i = 0; i < m_body.size(); i++) {
m_body.front().m_previous_tail_pos.set_new_point( m_body.front().m_previous_tail_pos.set_new_point(
head.m_previous_head.m_row, head.m_previous_head.m_row,
+3 -3
View File
@@ -28,10 +28,10 @@ int main () {
running = false; running = false;
} }
head.get_new_pos(); head.get_new_pos();
body.get_new_points(head);
head.m_previous_head.set_new_point(head.m_head.m_row, head.m_head.m_col, head.m_head.m_direction);
fruit.get_new_pos(window.m_board, head, body.m_score); fruit.get_new_pos(window.m_board, head, body.m_score);
body.get_new_pos(head);
head.m_previous_head.set_new_point(head.m_head.m_row, head.m_head.m_col, head.m_head.m_direction);
window.update_display(fruit, head, body); window.update_display(fruit, head, body);
} }