-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
55 lines (50 loc) · 1.61 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>SUI testing</title>
</head>
<body>
<script src="main.js"></script>
<script>
let logconsole = new SUI.panel('Logs', '20px', '380px');
logconsole.addText('This is the logs.');
function log(text) {
SUI.GUI.menus[0].elements[0].content = text
SUI.GUI.menus[0].elements[0].element.innerText = text
}
function defaultPage() {
template.clear()
template.addText('This is some sample text.');
template.addButton('Button', () => logconsole.toggle());
template.addSlider('Slider', 0, 100, 50, (value) => log('Slider value: ' + value));
template.addInput('Input', 'Default value', (value) => log('Input value: ' + value));
template.addText('Beta features:');
template.addCheckbox('Checkbox', true, (isChecked) => {
log('Checkbox state: ' + isChecked);
});
template.addColorPicker('Color Picker', '#00ff00', (color) => {
log('Selected color: ' + color);
});
template.addButton('Go to other page', () => otherPage());
SUI.renderer.render()
}
function otherPage() {
log('switched page')
template.clear()
template.addText('other page');
template.addButton('Back', () => defaultPage());
SUI.renderer.render()
}
// Create main menu w/ buttons
let template = new SUI.panel('Template', '20px', '20px');
// go to default page
defaultPage()
// Call render to display the GUI
SUI.renderer.render();
logconsole.toggle()
</script>
</body>
</html>