mirror of
https://github.com/PlayableIntelligence/game-creator.git
synced 2026-09-19 07:34:10 +08:00
695a6ebe84
Upgrade the barn-defense example to use the new high-DPI rendering architecture from the Phaser 2D template, ensuring crisp rendering on retina displays and proper responsive scaling across all screen sizes. Key changes: - Constants.js: Add DPR/PX canvas sizing, scale all spatial values (sizes, speeds, ranges, radii) by PX factor while preserving game logic values (HP, damage, costs, durations) - GameConfig.js: Add Scale.FIT, CENTER_BOTH, zoom: 1/DPR, roundPixels, antialias, preserveDrawingBuffer - index.html: Responsive viewport (max-scale=1, no user-scale), fullscreen game container - main.js: Add render_game_to_text() and advanceTime(ms) test hooks - PixelRenderer.js: Round canvas dimensions for fractional PX scales, use floor/ceil pixel rendering to avoid sub-pixel gaps - All sprites (tiles, enemies, towers, projectiles): Scale by PX - All scenes: PX-scale hardcoded offsets for text, buttons, particles - All UI components: PX-scale button sizes, spacing, fonts, info panels - All systems: PX-scale particle effects, path markers, barn drawing - Grid math preserved: TILE_SIZE = 40*PX, GRID_COLS/ROWS unchanged Co-Authored-By: Claude <noreply@anthropic.com>
18 lines
538 B
HTML
18 lines
538 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
|
<title>Barn Defense</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
|
|
#game-container { width: 100%; height: 100%; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="game-container"></div>
|
|
<script type="module" src="/src/main.js"></script>
|
|
</body>
|
|
</html>
|