-
Notifications
You must be signed in to change notification settings - Fork 0
/
MusicApple.cpp
executable file
·88 lines (77 loc) · 2.31 KB
/
MusicApple.cpp
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
#include "MusicApple.h"
MusicApple::MusicApple(int x, int y, int num)
{
this->x = x;
this->y = y;
this->num = num;
if(this->num == 0){
this->graphic_h_s = LoadGraph("picture/small_onestar.bmp");
this->graphic_h_b = LoadGraph("picture/ultrasoul_apple2.bmp");
this->sound_h = LoadSoundMem("music/ultrasoul.mp3");
this->sound_h_demo = LoadSoundMem("music/ultrasoul_mini.mp3");
this->musicfile = "ultrasoul_score.txt";
}
else if(this->num == 1){
this->graphic_h_s = LoadGraph("picture/small_twostar.bmp");
this->graphic_h_b = LoadGraph("picture/koi_apple.bmp");
this->sound_h = LoadSoundMem("music/koi.mp3");
this->sound_h_demo = LoadSoundMem("music/koi_mini.mp3");
this->musicfile = "koi_score.txt";
}
else if(this->num == 2){
this->graphic_h_s = LoadGraph("picture/small_threestar.bmp");
this->graphic_h_b = LoadGraph("picture/johnetsu_apple.bmp");
this->sound_h = LoadSoundMem("music/johnetsu.mp3");
this->sound_h_demo = LoadSoundMem("music/johnetsu_mini.mp3");
this->musicfile = "johnetsu_score.txt";
}
this->hit_area = MUSICAPPLE_HIT_AREA;
SetMouseDispFlag( TRUE );
this->color = GetColor(0, 0, 255);
once = false;
}
MusicApple::~MusicApple(void)
{
}
void MusicApple::Draw()
{
GetMousePoint(&mousex, &mousey);
if(sqrt(pow(((double)mousex-x), 2)+pow(((double)mousey-y), 2)) <= hit_area){
hit_area = 90;
//DrawCircle(this->x, this->y, hit_area, this->color, true);
DrawGraph(this->x-100, this->y-108, graphic_h_b, true);
}else{
hit_area = 30;
//DrawCircle(this->x, this->y, MUSICAPPLE_HIT_AREA, this->color, true);
DrawGraph(this->x-34, this->y-37, graphic_h_s, true);
}
//DrawCircle(this->x, this->y, 30, this->color, true);
}
void MusicApple::UpDate()
{
if(sqrt(pow(((double)mousex-x), 2)+pow(((double)mousey-y), 2)) <= hit_area){
if(!once){
PlaySoundMem(sound_h_demo, DX_PLAYTYPE_LOOP);
once = true;
}
}else{
once = false;
StopSoundMem(sound_h_demo);
}
}
void MusicApple::Hit()
{
}
bool MusicApple::HitJudge()
{
MouseInput = GetMouseInput();
if(( MouseInput & MOUSE_INPUT_LEFT ) == 1 ){
GetMousePoint(&mousex, &mousey);
if(sqrt(pow(((double)mousex-x), 2)+pow(((double)mousey-y), 2)) <= hit_area){
StopSoundMem(sound_h_demo);
return true;
}else{
return false;
}
}
}