-
Notifications
You must be signed in to change notification settings - Fork 1
/
Karaoke.h
113 lines (95 loc) · 2.58 KB
/
Karaoke.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
#ifndef __KARAOKE__
#define __KARAOKE__
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <algorithm>
#include <functional>
#include "includes.h"
#include "Clicks.h"
#include "Texture.h"
#include "Window.h"
#include "Sound.h"
#include "FontEngine.h"
#include "Program.h"
#include "Particle.h"
#include "Camera.h"
#define MIKU 0
#define MIKU_POS glm::vec3(2.0, 3.5, 1.0)
#define RIN 1
#define RIN_POS glm::vec3(0.7, 3.5, 1.0)
#define LEN 2
#define LEN_POS glm::vec3(-0.7, 3.5, 1.0)
#define KAITO 3
#define KAITO_POS glm::vec3(-2.0, 3.5, 1.0)
#define CHARA_TEX 14
#define PERF_STR "Perfect!!!"
#define GOOD_STR "Good!"
#define BAD_STR "Bad..."
using namespace cv;
class Karaoke {
public:
// constructor & deconstructor
Karaoke(GLuint _ShadeProg, Sound* _sound, Camera* _camera, Program* _particleProg);
virtual ~Karaoke();
// called by session
void step(Window* window);
// called by main (uses keyboard input)
void selectCharacter(int target);
void nextSong();
void prevSong();
void increaseDifficulty();
void decreaseDifficulty();
// called by minigame
void selectSong();
void addNewFirework(int target);
void particleStep();
// getters and setters
bool gameOver, gameStart, songChosen;
private:
// Variables
vector<Object*> characters;
vector<tinyobj::shape_t> shapes;
vector<tinyobj::material_t> materials;
GLuint ShadeProg;
Camera* camera;
Program* particleProg;
Object *screen, *arrow, *renderer;
Sound* sound;
// Paticles
vector<vector<Particle*> > fireworks;
int numFireworks, numParticles;
map<int, glm::vec3> charaPos;
// time info for particles
float t, t0_disp, t_disp;
float h;
glm::vec3 g;
// Minigame variables
int score, curTarget, curSong, speed;
int totsec, mins, secs, etotsec, emins, esecs;
int numGood, numBad, numPerfect;
float timeStart, beat, bpm, songDuration;
// Animation variables
float timeArrow, arrowPos;
const char* message;
float messageTime;
glm::vec3 messageColor;
// Video variables
VideoCapture cap;
float fps;
float timeFrame, frameStep;
int texture_id;
// Minigame functions
void checkTime(Window *window);
void setUp();
void addCharacter(char *file, int tex, float xPos);
void addArrow();
void drawArrow();
// Video functions
void initVideo();
void drawVideo(Window *window);
// Text functions
void printInstructions();
void printScore();
void textStep();
};
#endif