onlinecodesimulator/index.html

88 lines
2.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pyodide Real-Time Python Execution with Console</title>
<script src="https://cdn.jsdelivr.net/pyodide/v0.23.4/full/pyodide.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.19.0/matter.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/monaco-editor@0.39.0/min/vs/loader.js"></script>
<style>
/* Use a grid layout for the entire page */
body {
margin: 0;
display: grid;
grid-template-columns: 1fr 1fr; /* Two equal columns */
grid-template-rows: auto 2fr 1fr; /* Header, main content, and console sections */
height: 100vh; /* Full viewport height */
font-family: Arial, sans-serif;
}
h1 {
grid-column: span 2; /* Header spans both columns */
text-align: center;
margin: 10px 0;
}
#monaco-editor {
grid-column: 1; /* Left column */
grid-row: 2 / span 2; /* Takes full left side */
border: 1px solid #ccc;
height: 100%; /* Fill available space */
}
#gameCanvas {
grid-column: 2; /* Right column */
grid-row: 2; /* Top two-thirds */
width: 100%;
height: 100%; /* Canvas stretches to fill the grid cell */
border: 1px solid black;
}
#console {
grid-column: 2; /* Right column */
grid-row: 3; /* Bottom one-third */
background-color: black;
color: white;
font-family: monospace;
padding: 10px;
overflow-y: auto;
border: 1px solid #ccc;
height: 100%;
}
button {
margin: 10px;
}
</style>
</head>
<body>
<h1>Real-Time Python Execution</h1>
<!-- Monaco Editor -->
<div id="monaco-editor"></div>
<!-- Game Canvas -->
<canvas id="gameCanvas"></canvas>
<!-- Console Output -->
<div id="console"></div>
<!-- Buttons -->
<div style="grid-column: span 2; text-align: center;">
<button id="compile-button">Compile and Run</button>
<button id="pause-button">Pause</button>
<button id="reset-button">Reset</button>
</div>
<script type="module">
import { initializeMonaco } from './game.js';
initializeMonaco();
</script>
</body>
</html>