fix: minor stuff
This commit is contained in:
parent
e0585db0e0
commit
f86b4ada13
5 changed files with 25 additions and 7 deletions
|
|
@ -99,7 +99,7 @@ export function buildLevel(): Level {
|
|||
sun: Color.rgb(255, 246, 214),
|
||||
sunDir: { x: 0.3, y: 0.5, z: -0.8 },
|
||||
sunSize: 0.04,
|
||||
clouds: fancyCumulus,
|
||||
clouds: basicCumulus,
|
||||
}
|
||||
|
||||
return { floor, walls, crate, colliders, npcPosition: { x: 2, y: 0, z: -1 }, sky }
|
||||
|
|
|
|||
|
|
@ -67,6 +67,11 @@ async function main(): Promise<void> {
|
|||
globalThis.addEventListener("keyup", (e) => {
|
||||
keys.delete(e.code)
|
||||
})
|
||||
// Losing focus (alt-tab, pointer-lock exit) drops keyup events, so clear held
|
||||
// keys or movement sticks on.
|
||||
globalThis.addEventListener("blur", () => {
|
||||
keys.clear()
|
||||
})
|
||||
screen.addEventListener("click", () => {
|
||||
screen.requestPointerLock()
|
||||
})
|
||||
|
|
@ -108,7 +113,7 @@ async function main(): Promise<void> {
|
|||
Rasterizer.draw(fb, level.floor, textures.floor, viewProj, config)
|
||||
Rasterizer.draw(fb, level.walls, textures.wall, viewProj, config)
|
||||
Rasterizer.draw(fb, level.crate, textures.crate, viewProj, config)
|
||||
Rasterizer.draw(fb, Sprite.billboard(npc, camera), textures.npc, viewProj, config)
|
||||
Rasterizer.draw(fb, Sprite.billboard(npc, camera), npc.texture, viewProj, config)
|
||||
Framebuffer.quantize(fb, config)
|
||||
present()
|
||||
requestAnimationFrame(frame)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue