-
Notifications
You must be signed in to change notification settings - Fork 0
/
DEFS.h
166 lines (131 loc) · 3.34 KB
/
DEFS.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#ifndef _DEFS_
#define _DEFS_
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <iostream>
#include <fstream>
#include <chrono>
#include <thread>
#define _WIDTH_ 1600
#define _HEIGHT_ 900
#define _WAIT_ 1000
__declspec(selectany) //This line to prevent "redefinition error"
int dx[] = { -1, 0, 1, 0 };
__declspec(selectany)
int dy[] = { 0, 1, 0, -1 };
__declspec(selectany)
int MUSIC_VOLUME = 50;
__declspec(selectany)
int VOLUME = 30;
using namespace sf;
enum TeamOpt
{
player1,
AIplayer
};
enum PlayState
{
menu,
prep,
game,
endgame,
closed
};
enum PlayerState
{
dead,
alive
};
enum OptionMenu
{
sound,
closed_op
};
enum Direction
{
horizontal,
vertical
};
__declspec(selectany) //This line to prevent "redefinition error"
struct UI_Settings
{
Vector2i* player1 = new Vector2i(80, 220);
Vector2i* player2 = new Vector2i(560, 220);
Vector2i* main_menu = new Vector2i(120, 220);
int Width = 1600;
int Height = 900;
Color Sections = Color(255, 255, 255, 70);
Color PopUps = Color(111, 111, 111, 215);
Color GridColor = Color(255, 255, 255, 128);
Color Player_theme = Color(0, 255, 255, 200);
Color Computer_theme = Color(255, 0, 0, 200);
Color TextColor = Color(255, 255, 255, 200);
Color Secondary = Color(192, 192, 192, 170);
Color HitColor = Color(235, 33, 46, 150);
Color HitColorShots = Color(247, 13, 26, 170);
Color MissColorShots = Color(111, 111, 111, 170);
Color ShipColor = Color(0, 195, 227, 150);
Color ShipColorSelected = Color(48, 197, 255, 227);
PlayState mode = prep;
void clean()
{
delete player1, player2, main_menu;
}
}UI;
__declspec(selectany) //This line to prevent "redefinition error"
struct UI_Sounds
{
Music Main_music, Game_music;
SoundBuffer barrierB, explosionB, explosion_shipB, hoverB, menuB, moveB, selectB, shotHB, shotLB, rotateB;
Sound barrier, explosion, explosion_ship, hover, open_menu, move, select, shotH, shotL, rotate;
int oldVolume, oldMusic;
UI_Sounds()
{
UI_s.Main_music.openFromFile(".\\Sounds\\main_music.wav");
UI_s.Main_music.setLoop(true);
barrierB.loadFromFile(".\\Sounds\\barrier.wav");
barrier.setBuffer(barrierB);
explosionB.loadFromFile(".\\Sounds\\explosion.wav");
explosion.setBuffer(explosionB);
explosion_shipB.loadFromFile(".\\Sounds\\explosion_ship.wav");
explosion_ship.setBuffer(explosion_shipB);
hoverB.loadFromFile(".\\Sounds\\hover.wav");
hover.setBuffer(hoverB);
menuB.loadFromFile(".\\Sounds\\menu.wav");
open_menu.setBuffer(menuB);
moveB.loadFromFile(".\\Sounds\\move.wav");
move.setBuffer(moveB);
rotateB.loadFromFile(".\\Sounds\\rotate.wav");
rotate.setBuffer(rotateB);
selectB.loadFromFile(".\\Sounds\\select.wav");
select.setBuffer(selectB);
shotHB.loadFromFile(".\\Sounds\\shot_heavy.wav");
shotH.setBuffer(shotHB);
shotLB.loadFromFile(".\\Sounds\\shot_light.wav");
shotL.setBuffer(shotLB);
setSFXVolume(VOLUME);
setMusicVolume(MUSIC_VOLUME);
}
void setSFXVolume(int vol)
{
oldVolume = VOLUME;
VOLUME = vol;
barrier.setVolume(vol);
explosion.setVolume(vol);
explosion_ship.setVolume(vol);
hover.setVolume(vol);
open_menu.setVolume(vol);
move.setVolume(vol);
rotate.setVolume(vol);
select.setVolume(vol);
shotH.setVolume(vol);
shotL.setVolume(vol);
}
void setMusicVolume(int vol)
{
oldMusic = MUSIC_VOLUME;
MUSIC_VOLUME = vol;
Main_music.setVolume(vol);
}
}UI_s;
#endif