-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.h
63 lines (56 loc) · 1.4 KB
/
view.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Tetris game
#define SDL_MAIN_HANDLED
#ifdef __APPLE__
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_mixer.h>
#include <SDL_ttf.h>
#endif
#ifdef _WIN32
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#endif
#include "model.h"
#include <map>
#include <string>
#ifndef _VIEW_H
#define _VIEW_H
// Show (output) the state of the model
class View {
public:
View(std::string title, int width, int height);
~View();
// Print out the visible stuff in the grid
void show(Model * model);
// Print out a pause screen
void showPause(Model * model);
// Print out a start screen before the game begins
void showStartScreen(Model* model);
// Print out gameover screen
void showGameOver(Model * model);
private:
Mix_Music* music = NULL;
SDL_Window* window;
SDL_Surface* screen;
SDL_Surface* textPaused;
SDL_Surface* text2;
string scoreString;
bool fail;
SDL_Surface* load(std::string path);
TTF_Font * font;
TTF_Font * font2;
SDL_Surface* BG = NULL;
// Mix_Chunk * food;
SDL_Surface* blockIMG = NULL;
SDL_Surface* nextBlockIMG = NULL;
SDL_Surface* IblockIMG = NULL;
SDL_Surface* OblockIMG = NULL;
SDL_Surface* TblockIMG = NULL;
SDL_Surface* SblockIMG = NULL;
SDL_Surface* ZblockIMG = NULL;
SDL_Surface* JblockIMG = NULL;
SDL_Surface* LblockIMG = NULL;
};
#endif