Skip to content

Releases: setanarut/kamera

v2.95.1

26 Dec 01:27
Compare
Choose a tag to compare

Change Log

Added

// Right returns the right edge position of the camera in world-space.
func (cam *Camera) Right() float64 {
	return cam.TopLeftX + cam.w
}

// Bottom returns the bottom edge position of the camera in world-space.
func (cam *Camera) Bottom() float64 {
	return cam.TopLeftY + cam.h
}

// SetTopLeft sets top-left position of the camera in world-space.
//
// Unlike the LookAt() method, the position is set directly without any smoothing.
//
// Useful for static cameras.
func (cam *Camera) SetTopLeft(x, y float64) {
	cam.TopLeftX, cam.TopLeftY = x, y
}

Changed

cam.topLeftX and cam.topLeftY are now exported.

cam.topLeftX -> cam.TopLeftX
cam.topLeftY -> cam.TopLeftY

v2.95.0

22 Dec 22:41
Compare
Choose a tag to compare

Change Log

  • Fixed the issue where axis smoothing could not be disabled.
  • Optimization with per-axis calculation has been improved.

Added:

(cam *Camera) XAxisSmoothingDisabled bool
(cam *Camera) YAxisSmoothingDisabled bool

(cam *Camera) smoothDampX(targetX float64) float64 // internal
(cam *Camera) smoothDampY(targetY float64) float64 // internal

Removed:

(cam *Camera) smoothDamp(targetX, targetY float64) (float64, float64)  // internal

v2.94.0

17 Dec 17:48
Compare
Choose a tag to compare

Change Log

Added

  • (c *Camera) DrawWithColorM()
  • /director_colorm example

Removed

  • BB{}
  • (c *Camera) BB()
  • Internal vec2 struct

Renamed

CameraShakeOptions -> ShakeOptions
SmoothingOptions -> SmoothOptions
cam.Smoothing -> cam.SmoothType

Fixed

  • retract v2.93.0
  • Missing doc comments
  • Bugs in examples

Updated

  • Refactoring
  • smoothDamp() belongs to the camera class and does not use vec2.

v2.92.0

09 Dec 23:15
Compare
Choose a tag to compare

Changelog

  • Closes the #9 (Ability to control X and Y axes separately for smoothing settings.)
    func DefaultSmoothOptions() *SmoothOptions {
        return &SmoothOptions{
      	  LerpSpeedX:          0.09,
      	  LerpSpeedY:          0.09,
      	  SmoothDampTimeX:     0.2,
      	  SmoothDampTimeY:     0.2,
      	  SmoothDampMaxSpeedX: 1000.0,
      	  SmoothDampMaxSpeedY: 1000.0,
        }
    }
  • Refactoring

v2.9.1

01 Dec 10:20
Compare
Choose a tag to compare

Fix: enable shake for director example

Full Changelog: v2.9.0...v2.9.1

v2.9.0

01 Dec 01:25
Compare
Choose a tag to compare

Change Log

Added

  • (cam *Camera) ApplyCameraTransformToPoint(x, y float64) (float64, float64)
  • None, Lerp, SmoothDamp
  • SmoothOptions{}
  • Platformer demo example
  • Director demo example
const (
	// None is instant movement to the target. No smoothing.
	None SmoothingType = iota
	// Lerp is Lerp() function.
	Lerp
	// SmoothDamp is SmoothDamp() function.
	SmoothDamp
)

func DefaultSmoothOptions() *SmoothOptions {
	return &SmoothOptions{
		LerpSpeed:          0.09,
		SmoothDampTime:     0.2,
		SmoothDampMaxSpeed: 1000.0,
	}
}

Removed

  • LerpEnabled

Full Changelog: v2.8.1...v2.9.0

v2.8.1

09 Nov 17:46
7d7d907
Compare
Choose a tag to compare

Full Changelog: v2.8.0...v2.8.1

  • Typo in doc comment
  • Refactoring

v2.8.0

03 Nov 01:14
Compare
Choose a tag to compare

Full Changelog: v2.7.0...v2.8.0

[v2.8.0] Change Log

Renamed

  • cam.Target() -> cam.Center()
  • Lerp -> LerpEnabled

Fixed

  • Incorrect position when use SetSize().
  • Fix camera movement bug in example/demo.go.

Added

  • cam.ShakeEnabled option
  • Added BB{} structure that returns camera bounds.
    cam.BB()
    cam.BB().ContainsPoint(-1, -5)
    cam.BB().Contains(kamera.NewBBForExtents(0, 0, 5, 5))

v2.7.0

29 Sep 01:15
be8b416
Compare
Choose a tag to compare

[v2.7.0] Change Log

  • Zoom was also included in the camera shaking
  • More noise types with the new fastnoise package.

Changed

CameraShakeOptions{} field names have changed. MaxZoomFactor added.

type CameraShakeOptions struct {
	// Noise generator for noise types and settings.
	Noise         *fastnoise.State[float64]
	MaxX          float64 // Maximum X-axis shake. 0 means disabled
	MaxY          float64 // Maximum Y-axis shake. 0 means disabled
	MaxAngle      float64 // Max shake angle (radians). 0 means disabled
	MaxZoomFactor float64 // Zoom factor strength [1-0]. 0 means disabled
	TimeScale     float64 // Noise time domain speed
	Decay         float64 // Decay for trauma
}

v2.6.1

27 Sep 03:03
Compare
Choose a tag to compare

[v2.6.1] Change Log

Minor Changes

  • Replace the demo with a better one.
  • Code refactoring

Breaking Changes

  • Removed exponential ZoomFactor

Renamed

  • Rotation() -> Angle()
  • ActualRotation() -> ActualAngle()
  • SetRotation() -> SetAngle()