#ifndef SNAKE_H_ #define SNAKE_H_ #include "SDL3/SDL_rect.h" #include #include #include #include class Snake { public: Snake(int screenWidth, int screenHeight, int segmentSize); void HandleInput(SDL_Keycode key); void Update(); void Render(SDL_Renderer* renderer); void Grow(); void Reset(int screenWidth, int screenHeight); void RandomizeDirection(); bool CheckCollision(int screenWidth, int screenHeight); SDL_Point GetHeadPos() const; std::deque GetBody() const; private: // Using SDL_Point to store {x, y} coordinates std::deque body; SDL_Point direction; int segmentSize; // Size of each block in pixels bool growing = false; // Flag to skip pop_back when eating food }; #endif