mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-12-28 13:06:55 -05:00
6104adc700
* Comments and newlines in engine.go * Comments and newlines in object.go * Comments and newlines in animated_entity.go * Comments and newlines in missile.go * Comments and newlines in npc.go * Comments and newlines in player.go * Removed object.go (incorrectly merged it in during rebase). * Comments and newlines in renderer.go. * Comments and newlines in map_entity.go. * Comments and newlines in walk_mesh.go. * Comments and newlines in viewport.go and tile_cache.go. * Comments and newlines in stamp.go and wilderness_tile_types.go. * Comments and newlines in everything else.
26 lines
598 B
Go
26 lines
598 B
Go
package d2maprenderer
|
|
|
|
// Camera is the position of the camera perspective in orthogonal world space. See viewport.go.
|
|
// TODO: Has a coordinate (issue #456)
|
|
type Camera struct {
|
|
x float64
|
|
y float64
|
|
}
|
|
|
|
// MoveTo sets the position of the camera to the given x and y coordinates.
|
|
func (c *Camera) MoveTo(x, y float64) {
|
|
c.x = x
|
|
c.y = y
|
|
}
|
|
|
|
// MoveBy adds the given vector to the current position of the camera.
|
|
func (c *Camera) MoveBy(x, y float64) {
|
|
c.x += x
|
|
c.y += y
|
|
}
|
|
|
|
// GetPosition returns the camera x and y position.
|
|
func (c *Camera) GetPosition() (float64, float64) {
|
|
return c.x, c.y
|
|
}
|