MCPcopy
hub / github.com/EngoEngine/engo / Update

Method Update

common/camera.go:332–343  ·  view source on GitHub ↗

Update updates the camera based on keyboard input.

(dt float32)

Source from the content-addressed store, hash-verified

330
331// Update updates the camera based on keyboard input.
332func (c *KeyboardScroller) Update(dt float32) {
333 c.keysMu.RLock()
334 defer c.keysMu.RUnlock()
335
336 m := engo.Point{
337 X: engo.Input.Axis(c.horizontalAxis).Value(),
338 Y: engo.Input.Axis(c.verticalAxis).Value(),
339 }
340 n, _ := m.Normalize()
341 engo.Mailbox.Dispatch(CameraMessage{Axis: XAxis, Value: n.X * c.ScrollSpeed * dt, Incremental: true})
342 engo.Mailbox.Dispatch(CameraMessage{Axis: YAxis, Value: n.Y * c.ScrollSpeed * dt, Incremental: true})
343}
344
345// BindKeyboard sets the vertical and horizontal axes used by the KeyboardScroller.
346func (c *KeyboardScroller) BindKeyboard(hori, vert string) {

Callers

nothing calls this directly

Calls 4

NormalizeMethod · 0.95
AxisMethod · 0.80
DispatchMethod · 0.80
ValueMethod · 0.65

Tested by

no test coverage detected