-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdisplayarea.h
72 lines (54 loc) · 1.49 KB
/
displayarea.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
// This class only draw on the "displayArea" (where the "notes are drawn")
// it receive info from pianoLearning and gameManager.
#ifndef DISPLAYAREA_H
#define DISPLAYAREA_H
#include <QWidget>
#include <QColor>
#include <QImage>
#include <QPoint>
#include <QPen>
#include "MIDIFile/include/MidiFile.h"
#include "gamemanager.h"
class DisplayArea : public QWidget
{
Q_OBJECT
public:
DisplayArea(QWidget *parent = 0);
virtual ~DisplayArea() {};
bool createInitialDisplay(smf::MidiFile *midifile);
void getParamsFromManager(GameManager *manager);
double songTimeShowed;
QColor keyboardNoteColor;
QColor midiNoteColor, backgroundColor;
QVector<QColor> trackColors;
public slots:
void animate();
protected:
void paintEvent(QPaintEvent *event) override;
private:
void paintNotes(QPainter *painter);
void paintPiano(QPainter *painter);
int getPianoHeight();
int getNoteAreaHeight();
int getNoteX0(int note);
int getHeightForTime(float t);
bool isBlackKey(int keyId);
void setOneLoopDisplayParameters();
bool isMidiSelectedFileValid;
QBrush background;
int elapsed;
//display parameters :
int minNote;
int maxNote;
smf::MidiFile *midifile;
int whiteKeySize, blackKeySize;
QVector<int> midiCurrentNotes;
std::set<int> currPressedNotes;
double songTime;
int selectedTrack;
//interval
bool isIntervalOn;
double intInitTime, intFinalTime;
int transpose;
};
#endif // DISPLAYAREA_H