-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.h
106 lines (73 loc) · 2.41 KB
/
game.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* Copyright (c) 2012 Cheese and Bacon Games, LLC */
/* This file is licensed under the MIT License. */
/* See the file docs/LICENSE.txt for the full license text. */
#ifndef game_h
#define game_h
#include "rng.h"
#include "collision.h"
#include "screen_shake.h"
#include "game_world.h"
#include <string>
#include <vector>
class Game{
public:
uint32_t option_effect_limit;
double option_camera_speed;
double option_camera_zoom;
std::string option_name;
bool option_chat_timestamps;
uint32_t option_max_players;
bool option_screen_shake;
uint32_t option_background_count;
bool display_scoreboard;
RNG rng;
//If true, a game is currently in progress.
//If false, a game is not in progress.
bool in_progress;
//If true, the game is paused.
//If false, the game is not paused.
bool paused;
//Current movement state of the camera.
std::string cam_state;
//Holds a string representing each command that is currently in the on state, and is relevant for networking.
//This is updated each frame.
std::vector<std::string> command_states;
Collision_Rect camera;
double camera_delta_x;
double camera_delta_y;
double camera_speed;
double camera_zoom;
Screen_Shake screen_shake;
std::string current_music;
Game_World world;
Game();
void reset();
void reset_camera_dimensions();
std::string get_random_direction_cardinal();
std::string get_random_direction_cardinal_ordinal();
//Returns true if the number of effects does not exceed the effect limit.
bool effect_allowed();
void manage_music();
void toggle_pause();
void start();
void start_client();
void stop();
void center_camera(Collision_Rect box);
void center_camera(Collision_Circ circle);
void zoom_camera_in(Collision_Rect box);
void zoom_camera_in(Collision_Circ circle);
void zoom_camera_out(Collision_Rect box);
void zoom_camera_out(Collision_Circ circle);
void set_camera();
void render_scoreboard();
void prepare_for_input();
void handle_command_states_multiplayer();
void handle_game_commands_multiplayer();
void handle_input_states_gui();
void handle_input_states();
bool handle_game_command_gui(std::string command_name);
bool handle_game_command(std::string command_name);
bool handle_input_events_gui();
bool handle_input_events();
};
#endif