aboutsummaryrefslogtreecommitdiff
path: root/graphics.hpp
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-11-09 14:48:33 +0100
committerCharles <sircharlesaze@gmail.com>2019-11-09 14:48:33 +0100
commitbd6b5006f814daca16afd3a15eebd02ef696624b (patch)
tree867cf7232ac221d48f3b007e856f150a3089424a /graphics.hpp
parentcfebccb7a5a4e19090f2259efd18a8e97b318c96 (diff)
downloadflappybird-master.tar.gz
flappybird-master.tar.bz2
flappybird-master.zip
Basic GameHEADmaster
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.hpp11
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);
};