-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.html
More file actions
88 lines (75 loc) · 2.81 KB
/
Copy pathdebug.html
File metadata and controls
88 lines (75 loc) · 2.81 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TPT GameForge Debug Test</title>
<style>
body {
margin: 0;
background: #222;
color: white;
font-family: monospace;
padding: 20px;
}
canvas {
display: block;
border: 1px solid #555;
margin: 20px 0;
}
#output {
background: #111;
padding: 10px;
border: 1px solid #333;
white-space: pre-wrap;
}
</style>
</head>
<body>
<h1>TPT GameForge Debug Test</h1>
<div id="output">Loading...</div>
<canvas id="gameCanvas" width="800" height="600"></canvas>
<script type="module">
const output = document.getElementById('output');
function log(message) {
console.log(message);
output.textContent += message + '\n';
}
try {
log('Starting debug test...');
// Test importing the engine
log('Importing Engine from src/index.js...');
import('./src/index.js').then(module => {
log('✓ Successfully imported index.js');
log('Available exports: ' + Object.keys(module).join(', '));
const { Engine } = module;
if (!Engine) {
log('✗ Engine class not found in exports');
return;
}
log('✓ Engine class found');
// Try to create engine instance
const canvas = document.getElementById('gameCanvas');
log('Creating Engine instance...');
const engine = new Engine(canvas);
log('✓ Engine instance created successfully');
// Try to create entity
log('Creating test entity...');
const entityId = engine.scene.createEntity();
log('✓ Entity created with ID: ' + entityId.toString());
// Try to start engine
log('Starting engine...');
engine.start();
log('✓ Engine started successfully');
log('\n🎉 All tests passed! Engine is working.');
}).catch(error => {
log('✗ Error importing: ' + error.message);
log('Stack trace: ' + error.stack);
});
} catch (error) {
log('✗ Unexpected error: ' + error.message);
log('Stack trace: ' + error.stack);
}
</script>
</body>
</html>