diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-11-09 14:48:33 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-11-09 14:48:33 +0100 |
| commit | bd6b5006f814daca16afd3a15eebd02ef696624b (patch) | |
| tree | 867cf7232ac221d48f3b007e856f150a3089424a /graphics.hpp | |
| parent | cfebccb7a5a4e19090f2259efd18a8e97b318c96 (diff) | |
| download | flappybird-bd6b5006f814daca16afd3a15eebd02ef696624b.tar.gz flappybird-bd6b5006f814daca16afd3a15eebd02ef696624b.tar.bz2 flappybird-bd6b5006f814daca16afd3a15eebd02ef696624b.zip | |
Bird falls, game over if he touches the floor or a pipe.
Pipes are randomly generated.
Diffstat (limited to 'graphics.hpp')
| -rw-r--r-- | graphics.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/graphics.hpp b/graphics.hpp index 75d273c..f9dc4f7 100644 --- a/graphics.hpp +++ b/graphics.hpp @@ -2,8 +2,11 @@ #define __GRAPHIC_H__ #include <string> +#include <deque> #include <SDL2/SDL.h> +typedef std::pair<SDL_Rect, SDL_Rect> PipePair; + class Graphics { public: @@ -15,7 +18,15 @@ class Graphics SDL_Renderer *renderer; SDL_Window *window; bool running; + SDL_Rect bird; + std::deque<SDL_Rect> pipes; + void update(); + void draw_bird(); + void draw_pipes(); + bool is_gameover(); + void handle_pipes(); + PipePair generate_pipe_pair(); void event_handler(); void error_quit(std::string msg); }; |
