aboutsummaryrefslogtreecommitdiff
path: root/graphics.hpp
blob: f9dc4f74b04b423172ca8198d268c8d1b60d28e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef __GRAPHIC_H__
#define __GRAPHIC_H__

#include <string>
#include <deque>
#include <SDL2/SDL.h>

typedef std::pair<SDL_Rect, SDL_Rect> PipePair;

class Graphics
{
	public:
	Graphics();
	void run();
	~Graphics();

	private:
	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);
};

#endif