-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.h
More file actions
63 lines (58 loc) · 1.36 KB
/
game.h
File metadata and controls
63 lines (58 loc) · 1.36 KB
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
#ifndef GAME_H
#define GAME_H
#include "renderer.h"
#include "snake.h"
#include "food.h"
#include "red.h"
#include "teleports.h"
#include "constants.h"
#include "SDL2-2.0.10/include/SDL_events.h"
#include "SDL2-2.0.10/include/SDL_render.h"
#include "SDL2-2.0.10/include/SDL_surface.h"
#include "SDL2-2.0.10/include/SDL_timer.h"
#include <cstddef>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
extern "C" {
#include"./SDL2-2.0.10/include/SDL.h"
#include"./SDL2-2.0.10/include/SDL_main.h"
}
class Game {
public:
typedef struct {
char name[100];
int score;
} score;
SDL_Event event;
int screen_width,screen_height;
int t1, t2, quit, frames, time_in_sec, points, resets, n_of_top;
int points_for_blue;
double delta, worldTime, fpsTimer, fps;
Renderer renderer;
Snake snake;
Food food;
Red red;
Teleports teleports;
score top_scores[4];
Game();
void init();
void run(int k = 0);
void load_config();
void bubble_sort(score* list, int n);
int how_many_lines(FILE* fptr);
void read_top_scores();
int is_top_3();
void save_score();
void dispaly_top_three();
void reset(int k);
void enter_name(char name[100]);
void save();
void load();
void menu();
void key_handling(int* quit);
};
#endif