master
ブランチ master
BrickBreaker / src / render.hh
1 KB、53行 生 Blame 履歴
1#ifndef RENDER_H
2#define RENDER_H
3
4#include <SDL2/SDL.h>
5#include <SDL2/SDL_ttf.h>
6#include <SDL2/SDL_mixer.h>
7#include <iostream>
8
9class Player;
10class Ball;
11class Brick;
12
13class Render {
14 public:
15 bool running, gameover, winner;
16 int frameCount, timerFPS, lastFrame, fps = 0;
17
18 int width = 620;
19 int height = 720;
20 int fontsize = 16;
21 int xpos = 9;
22 int level = 1;
23
24 // 色
25 int c1r, c1g, c1b;
26 int c2r, c2g, c2b;
27 int c3r, c3g, c3b;
28 int c4r, c4g, c4b;
29 int c5r, c5g, c5b;
30 int c6r, c6g, c6b;
31
32 SDL_Window *window;
33 SDL_Renderer *renderer;
34 TTF_Font* font;
35 Mix_Music* music;
36
37 void update(Render &r, Player &p, Ball &bl, Brick &br);
38 void input(Render &r, Player &p, Ball &bl, Brick &br);
39 void render(Player &p, Ball &bl, Brick &br);
40
41 Render() {
42 winner = false;
43 gameover = false;
44 running = true;
45 }
46
47 private:
48 void gameOver(Player &p, Brick &br, bool winner);
49 void write(Player &p, Brick &br, std::string text, int x, int y);
50 double bounceSave;
51};
52
53#endif