53 行
1006 B
C++
53 行
1006 B
C++
#ifndef RENDER_H
|
|
#define RENDER_H
|
|
|
|
#include <SDL2/SDL.h>
|
|
#include <SDL2/SDL_ttf.h>
|
|
#include <SDL2/SDL_mixer.h>
|
|
#include <iostream>
|
|
|
|
class Player;
|
|
class Ball;
|
|
class Brick;
|
|
|
|
class Render {
|
|
public:
|
|
bool running, gameover, winner;
|
|
int frameCount, timerFPS, lastFrame, fps = 0;
|
|
|
|
int width = 620;
|
|
int height = 720;
|
|
int fontsize = 16;
|
|
int xpos = 9;
|
|
int level = 1;
|
|
|
|
// 色
|
|
int c1r, c1g, c1b;
|
|
int c2r, c2g, c2b;
|
|
int c3r, c3g, c3b;
|
|
int c4r, c4g, c4b;
|
|
int c5r, c5g, c5b;
|
|
int c6r, c6g, c6b;
|
|
|
|
SDL_Window *window;
|
|
SDL_Renderer *renderer;
|
|
TTF_Font* font;
|
|
Mix_Music* music;
|
|
|
|
void update(Render &r, Player &p, Ball &bl, Brick &br);
|
|
void input(Player &p);
|
|
void render(Player &p, Ball &bl, Brick &br);
|
|
|
|
Render() {
|
|
winner = false;
|
|
gameover = false;
|
|
running = true;
|
|
}
|
|
|
|
private:
|
|
void gameOver(Player &p, Brick &br, bool winner);
|
|
void write(Player &p, Brick &br, std::string text, int x, int y);
|
|
};
|
|
|
|
#endif
|