Newer
Older
ESP32-RetroPlay / main / tasks / game / jump_bird_game.h
#ifndef JUMP_BIRD_GAME_H
#define JUMP_BIRD_GAME_H

#include "freertos/FreeRTOS.h"
#include "freertos/queue.h" // For QueueHandle_t
#include "ssd1306.h"        // Needed for SSD1306_t in jump_bird_draw_game
#include <stdbool.h>        // For bool type

/**
 * @brief Initializes the game state (bird position, obstacles, score).
 * This should be called once before starting the game loop.
 */
void jump_bird_init_game();

/**
 * @brief Handles player input for the game.
 * Reads jump signals from the input queue and applies to bird.
 */
void jump_bird_handle_input(); // No longer takes a bool, reads from queue internally

/**
 * @brief Updates the game state for one frame (bird physics, obstacle movement, collision detection, scoring).
 * @return true if the game is over, false otherwise.
 */
bool jump_bird_update_game_state();

/**
 * @brief Draws the current game state to the OLED internal buffer.
 * Does not call ssd1306_show_buffer().
 * @param dev Pointer to the SSD1306 device structure.
 */
void jump_bird_draw_game(SSD1306_t *dev);

/**
 * @brief Gets the current score.
 * @return The current game score.
 */
int jump_bird_get_score();

/**
 * @brief Sets whether the game should be active.
 * Used to start/stop the game loop in the display manager.
 * @param active True to make the game active, false otherwise.
 */
void jump_bird_set_active(bool active);

/**
 * @brief Checks if the game is currently active.
 * @return True if the game is active, false otherwise.
 */
bool jump_bird_is_active();

void draw_filled_rect(SSD1306_t * dev, int x1, int y1, int x2, int y2, bool color) ;

#endif // JUMP_BIRD_GAME_H