-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDokodemo.h
35 lines (31 loc) · 1.08 KB
/
Dokodemo.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
#ifndef DOKODEMO_H_INCLUDED
#define DOKODEMO_H_INCLUDED
#include "Tool.h"
class Dokodemo : public Tool
{
public:
Dokodemo(int mouse_x = 0, int mouse_y = 0) : Tool(mouse_x, mouse_y)
{
type = DOKODEMO;
img = al_load_bitmap("./Tool/Dokodemo.png");
sample = al_load_sample("./Music/tool.wav");
toolSound = al_create_sample_instance(sample);
al_set_sample_instance_playmode(toolSound, ALLEGRO_PLAYMODE_ONCE);
}
int getWidth() override { return ToolWidth[DOKODEMO]; }
int getHeight() override { return ToolHeight[DOKODEMO]; }
std::vector<int> Utilize(int x, int y, double d)
{
al_attach_sample_instance_to_mixer(toolSound, al_get_default_mixer());
al_stop_sample_instance(toolSound);
al_play_sample_instance(toolSound);
al_set_sample_instance_gain(toolSound, d);
while(al_get_sample_instance_playing(toolSound));
x/=40;
y/=40;
std::vector<int> change;
change.push_back((y-ground/40)*field_width/40+x);
return change;
}
};
#endif // DOKODEMO_H_INCLUDED