MCPcopy Index your code
hub / github.com/EngoEngine/engo / jsPollKeys

Function jsPollKeys

engo_js.go:321–331  ·  view source on GitHub ↗

jsPollKeys polls the keys collected by the javascript callback this ensures the keys only get updated once per frame, since the callback has no information about the frames and is invoked several times between frames. This makes Input.Button.JustPressed and JustReleased able to return true properly.

()

Source from the content-addressed store, hash-verified

319// times between frames. This makes Input.Button.JustPressed and JustReleased
320// able to return true properly.
321func jsPollKeys() {
322 pollLock.Lock()
323 defer pollLock.Unlock()
324
325 Input.Modifier = mod
326 for key, state := range poll {
327 Input.keys.Set(Key(key), state)
328 delete(poll, key)
329 }
330
331}
332
333func checkModifiers(event js.Value) {
334 mod = 0

Callers 1

RunIterationFunction · 0.85

Calls 2

KeyTypeAlias · 0.85
SetMethod · 0.45

Tested by

no test coverage detected