forked from WofWca/quake3.xdc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain-menu.html
More file actions
131 lines (113 loc) · 4.04 KB
/
main-menu.html
File metadata and controls
131 lines (113 loc) · 4.04 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark light">
<title>Main Menu - VectorQuake</title>
<style>
html, body {
font-family: "Antonio", sans-serif;
font-optical-sizing: auto;
font-weight: 700;
font-style: normal;
letter-spacing: -.05ch;
font-size: xx-large;
display: flex;
flex-direction: column;
align-items: center;
}
a {
overflow-wrap: anywhere;
}
#openFileExplorerBtn {
height: 30px;
font-family: "Antonio", sans-serif;
font-optical-sizing: auto;
font-weight: 700;
font-style: normal;
letter-spacing: -.05ch;
}
#closeFileExplorerBtn {
height: 30px;
width: 30px;
}
#fileExplorerDialog {
font-size: medium;
padding: 5px;
width: 80vw;
height: 80vh;
}
#fileExplorerContainer {
height: 100%;
display: flex;
flex-direction: column;
}
</style>
<!-- https://github.com/DavidSM100/emscripten-fs-file-explorer-ui -->
<script src="./emscripten-fs-file-explorer-ui.iife.js"></script>
<script src="webxdc.js"></script>
<!-- https://codeberg.org/DavidSM100/webxdc-download-polyfill -->
<script src="./webxdc-download-polyfill.js"></script>
</head>
<body>
<a href="./index.html">Play VectorQuake</a>
<br>
<button id="openFileExplorerBtn" style="margin-top: 10px;">Open File Explorer</button>
<div style="font-size: medium;">
<p>
The File Explorer lets you edit the game config files
(<code>autoexec.cfg</code>, <code>q3config.cfg</code>),
install game mods, and do other fun stuff.
</p>
<p>
For example, to be a true pro, change the field of view
by adding a line <code>set cg_fov 110</code>
at the end of <code>autoexec.cfg</code>.
</p>
</div>
<dialog id="fileExplorerDialog">
<div id="fileExplorerContainer">
<div style="text-align: right; margin-bottom: 5px;">
<button id="closeFileExplorerBtn">
<b>X</b>
</button>
</div>
</div>
</dialog>
<script>
const dialog = document.getElementById("fileExplorerDialog");
const fileExplorerContainer = document.getElementById("fileExplorerContainer");
document.getElementById("closeFileExplorerBtn").onclick = () => {
const container = document.getElementById("fileExplorerDiv");
dialog.close();
}
dialog.addEventListener("close", () => {
const container = document.getElementById("fileExplorerDiv");
container.remove();
})
const openFileExplorerBtn = document.getElementById("openFileExplorerBtn");
openFileExplorerBtn.onclick = async () => {
openFileExplorerBtn.disabled = true;
const container = document.createElement("div");
container.style.flex = "1";
container.id = "fileExplorerDiv";
const ioquake3 = await import("/ioquake3_opengl2.wasm32.js");
const module = await ioquake3.default();
module.FS.mkdirTree("/home/web_user/.q3a");
module.FS.mount(module.FS.filesystems.IDBFS, {}, "/home/web_user/.q3a");
module.FS.syncfs(true, (err) => {
if (err) {
console.error(err);
}
mountEmscriptenFileExplorer(container, module.FS, {
initialDir: "/home/web_user/.q3a"
});
fileExplorerContainer.append(container);
dialog.showModal();
openFileExplorerBtn.disabled = false;
});
}
</script>
</body>
</html>