This repository has been archived by the owner on Aug 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FOV.js
45 lines (41 loc) · 1.62 KB
/
FOV.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
var GUI;
var checked = false;
function newLevel(){
var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
ctx.runOnUiThread(new java.lang.Runnable({ run: function(){
try{
var layout = new android.widget.LinearLayout(ctx);
layout.setOrientation(1);
var button = new android.widget.CheckBox(ctx);
button.setText("FOV");
button.setChecked(checked);
button.setOnClickListener(new android.view.View.OnClickListener({
onClick: function(viewarg){
if(!checked){
ModPE.setFov(140);
checked = true;
} else{
ModPE.resetFov();
checked = false;
}
}
}));
layout.addView(button);
GUI = new android.widget.PopupWindow(layout, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT);
GUI.setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT));
GUI.showAtLocation(ctx.getWindow().getDecorView(), android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM, 0, 0);
}catch(err){
print("Err: " + err);
}
}}));
}
function leaveGame(){
var ctx = com.mojang.minecraftpe.MainActivity.currentMainActivity.get();
ctx.runOnUiThread(new java.lang.Runnable({ run: function(){
if(GUI != null){
GUI.dismiss();
GUI = null;
checked = false;
}
}}));
}