-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.js
75 lines (75 loc) · 2.33 KB
/
settings.js
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
///////////////////////////////////////////////////
/////////////NASTAVENIA OBRAZOVKA//////////////////
///////////////////////////////////////////////////
class Nastavenia{
constructor(canvas){
this.canvas = canvas;
this.ctx = canvas.getContext("2d");
this.canvas.onclick = this.Onclick.bind(this);
this.tlacAudio = new Audio("zvuky/klik_tlacitko.wav");
this.imgSrc = document.getElementById("pozadie");
}
Start(){
if(volumeE == 1)
this.tlacAudio.play();
this.ctx.beginPath();
this.ctx.clearRect(0, 0, canvas.width, canvas.height);
this.ctx.drawImage(this.imgSrc, 0, 0, canvas.width, canvas.height);
this.ctx.rect(790,535,80,50);
this.ctx.stroke();
this.ctx.font = "100px myFont";
this.ctx.fillText("Nastavenia",185,125);
this.ctx.font = "30px myFont";
this.ctx.fillStyle = "black";
this.ctx.fillText("Späť", 800, 570);
if(volumeM == 1)
this.ctx.fillStyle = "green";
else this.ctx.fillStyle = "black";
this.ctx.fillText("Zapnutá", 220, 250);
if(volumeM == 0)
this.ctx.fillStyle = "red";
else this.ctx.fillStyle = "black";
this.ctx.fillText("Vypnutá", 220, 290);
if(volumeE == 1)
this.ctx.fillStyle = "green";
else this.ctx.fillStyle = "black";
this.ctx.fillText("Zapnuté", 500, 250);
if(volumeE == 0)
this.ctx.fillStyle = "red";
else this.ctx.fillStyle = "black";
this.ctx.fillText("Vypnuté", 500, 290);
this.ctx.font = "40px myFont";
this.ctx.fillStyle = "black";
this.ctx.fillText("Hudba", 220, 200);
this.ctx.fillText("Efekty", 495, 200);
this.ctx.closePath();
}
Onclick(e){
var mousex;
var mousey;
if (!e) e = window.event;
mousex = e.clientX;
mousey = e.clientY;
if(mousex >= 220 && mousex <= 345 && mousey >= 275 && mousey <= 305){ //vypnutie hudby
volumeM = 0;
menuHudba.pause();
this.Start();
}
if(mousex >= 220 && mousex <= 345 && mousey >= 235 && mousey <= 265){ //zapnutie
volumeM = 1;
menuHudba.play();
this.Start();
}
if(mousex >= 500 && mousex <= 625 && mousey >= 275 && mousey <= 305){ //v. efektov
volumeE = 0;
this.Start();
}
if(mousex >= 500 && mousex <= 625 && mousey >= 235 && mousey <= 265){ //zapnutie
volumeE = 1;
this.Start();
}
if(mousex >= 800 && mousex <= 880 && mousey >= 535 && mousey <= 585){
window.handler(1);
}
}
}