-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_test.html
128 lines (126 loc) · 3.28 KB
/
index_test.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
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
<!DOCTYPE html>
<html>
<head>
<title>Sprite Rover Control</title>
<style>
body {
background-color: black;
color: white;
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
overflow: hidden; /* Prevents scrolling due to background size */
}
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
}
.logo {
margin-right: 10px;
margin-left: 20px;
margin-top: 10px;
}
.active {
font-weight: bold;
color: green;
margin-right: 20px;
margin-top: 10px;
}
.content {
display: flex;
justify-content: center; /* Centers the controls */
align-items: center;
width: 100vw;
height: 100vh;
position: relative;
}
.content::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('Spector_Sprite_Ai_Mockup.jpeg');
background-size: cover;
background-position: center; /* Centers the background image */
opacity: 0.2;
z-index: -1;
}
.controls {
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
flex-wrap: nowrap; /* Prevents buttons from wrapping on smaller screens */
}
.button {
margin: 10px;
padding: 10px 20px;
background-color: #000000;
color: white;
border: 1px solid white;
cursor: pointer;
}
</style>
</head>
<body>
<div class="navbar">
<div class="logo">
<img src="Specter__Logo_Wht_250.png" alt="Spector Dynamics" />
</div>
<div class="status">Sprite Rover: <span class="active">ACTIVE</span></div>
</div>
<div class="content">
<div class="controls">
<div>
<button class="button" id="forward" accesskey="w" onclick="move('forward')">
Forward
</button>
</div>
<div>
<button class="button" id="left" accesskey="a" onclick="move('left')">
Left
</button>
<button class="button" id="backward" accesskey="s" onclick="move('backward')">
Backward
</button>
<button class="button" id="right" accesskey="d" onclick="move('right')">
Right
</button>
</div>
</div>
</div>
</body>
<script>
function move(direction) {
fetch("/move", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: "direction=" + direction,
});
}
document.onkeydown = function (e) {
switch (e.keyCode) {
case 37:
document.getElementById("left").click();
break;
case 38:
document.getElementById("forward").click();
break;
case 39:
document.getElementById("right").click();
break;
case 40:
document.getElementById("backward").click();
break;
}
};
</script>
</body>
</html>