-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathEaglerTouch.js
More file actions
61 lines (52 loc) · 1.84 KB
/
Copy pathEaglerTouch.js
File metadata and controls
61 lines (52 loc) · 1.84 KB
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
function createButton(x,y,w,h,mult,text,up,down){
var btn = document.createElement("div");
btn.style.position = "fixed";
btn.onmousedown = down;
btn.onmouseup = up;
btn.style.fontFamily = "monospace";
btn.style.fontSize = h*mult+"px";
if(x < 0) {
btn.style.right = (-x)*mult-w+"px";
}else {
btn.style.left = x*mult+"px";
}
if(y < 0) {
btn.style.bottom = (-y)*mult-h+"px";
}else {
btn.style.top = y*mult+"px";
}
btn.style.width = w*mult+"px";
btn.style.height = h*mult+"px";
btn.style.background = "rgba(0,0,0,0.25)";
btn.style.color = "white";
btn.innerText = text;
document.body.appendChild(btn);
}
createButton(100,100,75,75,1.25,"W",
function(){ModAPI.mcinstance.$gameSettings.$keyBindForward.$pressed = 0},
function(){ModAPI.mcinstance.$gameSettings.$keyBindForward.$pressed = 1}
);
createButton(25,175,75,75,1.25,"A",
function(){ModAPI.mcinstance.$gameSettings.$keyBindLeft.$pressed = 0},
function(){ModAPI.mcinstance.$gameSettings.$keyBindLeft.$pressed = 1}
);
createButton(100,175,75,75,1.25,"S",
function(){ModAPI.mcinstance.$gameSettings.$keyBindBack.$pressed = 0},
function(){ModAPI.mcinstance.$gameSettings.$keyBindBack.$pressed = 1}
);
createButton(175,175,75,75,1.25,"D",
function(){ModAPI.mcinstance.$gameSettings.$keyBindRight.$pressed = 0},
function(){ModAPI.mcinstance.$gameSettings.$keyBindRight.$pressed = 1}
);
createButton(-200,-175,75,75,1.25,"L",
function(){},
function(){ModAPI.clickMouse()}
);
createButton(-100,-175,75,75,1.25,"R",
function(){},
function(){ModAPI.rightClickMouse()}
);
createButton(-275,-100,75,75,1.25,"E",
function(){ModAPI.mcinstance.$gameSettings.$keyBindInventory.$pressed = 0;},
function(){ModAPI.mcinstance.$gameSettings.$keyBindInventory.$pressed = 1;}
);