diff options
-rw-r--r-- | derelict.js | 9 | ||||
-rw-r--r-- | index.html | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/derelict.js b/derelict.js index 609fd01..d32d269 100644 --- a/derelict.js +++ b/derelict.js @@ -43,6 +43,15 @@ function init() { const controls = new OrbitControls(camera, renderer2d.domElement) controls.minDistance = 0.5 controls.maxDistance = 8 + + window.addEventListener('resize', onWindowResize) +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight + camera.updateProjectionMatrix() + renderer.setSize(window.innerWidth, window.innerHeight) + renderer2d.setSize(window.innerWidth, window.innerHeight) } function animate() { @@ -1,5 +1,8 @@ <!doctype html> <html lang="en"> -<title>Derelict</title> +<meta charset="utf-8"> +<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <link rel="stylesheet" type="text/css" href="style.css"> +<title>Derelict</title> +<body> <script type="module" src="derelict.js"></script> |