Fullscreen
This commit is contained in:
parent
a1d117595f
commit
10b5109e21
13
game.js
13
game.js
@ -200,7 +200,8 @@ function tagABlock(gl, params, objects) {
|
||||
// [x] better controls
|
||||
// [x] non-flowy water
|
||||
// [x] slightly cooler terrain
|
||||
// [ ] fullscreen
|
||||
// [x] double jump!!
|
||||
// [x] fullscreen
|
||||
// [ ] a soundrack
|
||||
// [ ] trees and stuff
|
||||
// [ ] different biomes (with different noise stats)
|
||||
@ -330,6 +331,16 @@ export function initUiListeners(params, canvas) {
|
||||
document.addEventListener('keyup', keyListener);
|
||||
};
|
||||
canvas.onclick = canvasClickHandler;
|
||||
document.addEventListener('keydown', e => {
|
||||
switch (e.code) {
|
||||
case 'F11':
|
||||
canvas.requestFullscreen().then(() => {
|
||||
console.log('full screen!!');
|
||||
});
|
||||
break;
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function tick(time, gl, params) {
|
||||
|
2
index.js
2
index.js
@ -4,6 +4,8 @@ import * as se3 from './se3';
|
||||
|
||||
async function main() {
|
||||
const canvas = document.querySelector('#game');
|
||||
// adjust canvas aspect ratio to that of the screen
|
||||
canvas.height = screen.height / screen.width * canvas.width;
|
||||
const gl = canvas.getContext('webgl');
|
||||
|
||||
if (gl === null) {
|
||||
|
Loading…
Reference in New Issue
Block a user