MCPcopy Create free account
hub / github.com/SolarLune/masterplan / Update

Method Update

camera.go:25–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23}
24
25func (camera *Camera) Update() {
26
27 softness := camera.Softness
28
29 if !globals.Settings.Get(SettingsSmoothMovement).AsBool() {
30 softness = 1
31 }
32
33 camera.Zoom += (camera.TargetZoom - camera.Zoom) * softness
34
35 if math.Abs(float64(camera.TargetZoom-camera.Zoom)) < 0.01 {
36 camera.Zoom = camera.TargetZoom
37 }
38
39 globals.Renderer.SetScale(camera.Zoom, camera.Zoom)
40
41 camera.Position = camera.Position.Add(camera.TargetPosition.Sub(camera.Position).Mult(softness))
42
43}
44
45func (camera *Camera) JumpTo(pos Vector, zoom float32) {
46 camera.TargetPosition = pos

Callers 1

JumpToMethod · 0.95

Calls 5

AsBoolMethod · 0.80
GetMethod · 0.45
AddMethod · 0.45
MultMethod · 0.45
SubMethod · 0.45

Tested by

no test coverage detected