jbilcke-hf's picture
jbilcke-hf HF Staff
up
f1803ce
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MatrixGame Client</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #121212;
color: #e0e0e0;
display: flex;
flex-direction: column;
align-items: center;
user-select: none; /* Disable text selection */
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
overflow-x: hidden;
}
.container {
width: 100%;
max-width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.game-area {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
max-height: 85vh;
margin: 0;
position: relative;
}
#mouse-tracking-area {
position: relative;
width: 100%;
height: auto;
cursor: pointer; /* Show cursor as pointer to encourage clicks */
display: flex;
justify-content: center;
align-items: center;
max-height: 85vh;
}
#game-canvas {
width: 100%;
height: auto;
max-height: 85vh;
object-fit: contain;
background-color: #000;
pointer-events: none; /* Prevent drag on the image */
-webkit-user-drag: none;
-khtml-user-drag: none;
-moz-user-drag: none;
-o-user-drag: none;
user-drag: none;
}
.controls {
display: flex;
justify-content: space-between;
width: 100%;
max-width: 1200px;
padding: 10px;
background-color: rgba(0, 0, 0, 0.5);
position: absolute;
bottom: 0;
z-index: 10;
box-sizing: border-box;
}
.panels-container {
display: flex;
width: 100%;
max-width: 1200px;
margin: 10px auto;
gap: 10px;
}
.panel {
flex: 1;
background-color: #1E1E1E;
border-radius: 5px;
overflow: hidden;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
transition: height 0.3s ease;
}
.panel-header {
background-color: #272727;
padding: 10px 15px;
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
}
.panel-title {
font-weight: bold;
color: #4CAF50;
}
.toggle-button {
background: none;
border: none;
color: #e0e0e0;
font-size: 18px;
cursor: pointer;
}
.toggle-button:focus {
outline: none;
}
.panel-content {
padding: 15px;
max-height: 300px;
overflow-y: auto;
transition: all 0.3s ease;
}
.collapsed .panel-content {
max-height: 0;
padding-top: 0;
padding-bottom: 0;
overflow: hidden;
}
button {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 15px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 14px;
border-radius: 5px;
cursor: pointer;
margin: 5px;
transition: background-color 0.3s;
}
button:hover {
background-color: #45a049;
}
button:disabled {
background-color: #cccccc;
cursor: not-allowed;
}
select {
padding: 10px;
border-radius: 5px;
background-color: #2A2A2A;
color: #e0e0e0;
border: 1px solid #4CAF50;
}
.status {
margin-top: 10px;
color: #4CAF50;
}
.key-indicators {
display: flex;
justify-content: center;
margin-top: 15px;
}
.key {
width: 40px;
height: 40px;
margin: 0 5px;
background-color: #2A2A2A;
border: 1px solid #444;
border-radius: 5px;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
transition: background-color 0.2s;
}
.key.active {
background-color: #4CAF50;
color: white;
}
.key-row {
display: flex;
justify-content: center;
margin: 5px 0;
}
.spacebar {
width: 150px;
}
.connection-info {
font-family: monospace;
height: 100%;
overflow-y: auto;
}
.log-entry {
margin: 5px 0;
padding: 3px;
border-bottom: 1px solid #333;
}
.fps-counter {
position: absolute;
top: 10px;
right: 10px;
background-color: rgba(0,0,0,0.5);
color: #4CAF50;
padding: 5px;
border-radius: 3px;
font-family: monospace;
z-index: 20;
}
#mouse-position {
position: absolute;
top: 10px;
left: 10px;
background-color: rgba(0,0,0,0.5);
color: #4CAF50;
padding: 5px;
border-radius: 3px;
font-family: monospace;
z-index: 20;
}
@media (max-width: 768px) {
.panels-container {
flex-direction: column;
}
}
</style>
</head>
<body>
<div class="container">
<div class="game-area">
<div id="mouse-tracking-area">
<img id="game-canvas" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=" alt="Game Frame">
<div id="mouse-position">Mouse: 0.00, 0.00</div>
<div class="fps-counter" id="fps-counter">FPS: 0</div>
</div>
<div class="controls">
<button id="connect-btn">Connect</button>
<button id="start-stream-btn" disabled>Start Stream</button>
<button id="stop-stream-btn" disabled>Stop Stream</button>
<select id="scene-select" disabled>
<option value="forest">Forest</option>
<option value="desert">Desert</option>
<option value="beach">Beach</option>
<option value="hills">Hills</option>
<option value="river">River</option>
<option value="icy">Icy</option>
<option value="mushroom">Mushroom</option>
<option value="plain">Plain</option>
</select>
</div>
</div>
<div class="panels-container">
<!-- Controls Panel -->
<div class="panel" id="controls-panel">
<div class="panel-header" onclick="togglePanel('controls-panel')">
<div class="panel-title">Keyboard Controls</div>
<button class="toggle-button">βˆ’</button>
</div>
<div class="panel-content">
<div class="key-indicators">
<div class="key-row">
<div id="key-w" class="key">W</div>
</div>
<div class="key-row">
<div id="key-a" class="key">A</div>
<div id="key-s" class="key">S</div>
<div id="key-d" class="key">D</div>
</div>
<div class="key-row">
<div id="key-space" class="key spacebar">SPACE</div>
</div>
<div class="key-row">
<div id="key-shift" class="key">SHIFT</div>
</div>
</div>
<p class="status">
W or ↑ = Forward, S or ↓ = Back, A or ← = Left, D or β†’ = Right<br>
Space = Jump, Shift = Attack<br>
Click on game view to capture mouse (ESC to release)<br>
Mouse = Look around
</p>
</div>
</div>
<!-- Connection Log Panel -->
<div class="panel" id="log-panel">
<div class="panel-header" onclick="togglePanel('log-panel')">
<div class="panel-title">Connection Log</div>
<button class="toggle-button">βˆ’</button>
</div>
<div class="panel-content">
<div class="connection-info" id="connection-log">
<div class="log-entry">Waiting to connect...</div>
</div>
</div>
</div>
</div>
</div>
<script src="./assets/client.js"></script>
</body>
</html>