diff --git a/raylib/camera.go b/raylib/camera.go index 8e38a26..34dab59 100644 --- a/raylib/camera.go +++ b/raylib/camera.go @@ -8,58 +8,6 @@ package raylib import "C" import "unsafe" -// Camera type, defines a camera position/orientation in 3d space -type Camera struct { - // Camera position - Position Vector3 - // Camera target it looks-at - Target Vector3 - // Camera up vector (rotation over its axis) - Up Vector3 - // Camera field-of-view apperture in Y (degrees) - Fovy float32 -} - -func (c *Camera) cptr() *C.Camera { - return (*C.Camera)(unsafe.Pointer(c)) -} - -// NewCamera - Returns new Camera -func NewCamera(pos, target, up Vector3, fovy float32) Camera { - return Camera{pos, target, up, fovy} -} - -// NewCameraFromPointer - Returns new Camera from pointer -func NewCameraFromPointer(ptr unsafe.Pointer) Camera { - return *(*Camera)(ptr) -} - -// Camera2D type, defines a 2d camera -type Camera2D struct { - // Camera offset (displacement from target) - Offset Vector2 - // Camera target (rotation and zoom origin) - Target Vector2 - // Camera rotation in degrees - Rotation float32 - // Camera zoom (scaling), should be 1.0f by default - Zoom float32 -} - -func (c *Camera2D) cptr() *C.Camera2D { - return (*C.Camera2D)(unsafe.Pointer(c)) -} - -// NewCamera2D - Returns new Camera2D -func NewCamera2D(offset, target Vector2, rotation, zoom float32) Camera2D { - return Camera2D{offset, target, rotation, zoom} -} - -// NewCamera2DFromPointer - Returns new Camera2D from pointer -func NewCamera2DFromPointer(ptr unsafe.Pointer) Camera2D { - return *(*Camera2D)(ptr) -} - // CameraMode type type CameraMode int32 diff --git a/raylib/cgo_linux.go b/raylib/cgo_linux.go index e8095ba..62af128 100644 --- a/raylib/cgo_linux.go +++ b/raylib/cgo_linux.go @@ -1,4 +1,4 @@ -// +build linux,!arm +// +build linux,!arm,!arm64 package raylib diff --git a/raylib/core.go b/raylib/core.go index bb86c45..ce4781f 100644 --- a/raylib/core.go +++ b/raylib/core.go @@ -349,6 +349,58 @@ func NewRectangleFromPointer(ptr unsafe.Pointer) Rectangle { return *(*Rectangle)(ptr) } +// Camera type, defines a camera position/orientation in 3d space +type Camera struct { + // Camera position + Position Vector3 + // Camera target it looks-at + Target Vector3 + // Camera up vector (rotation over its axis) + Up Vector3 + // Camera field-of-view apperture in Y (degrees) + Fovy float32 +} + +func (c *Camera) cptr() *C.Camera { + return (*C.Camera)(unsafe.Pointer(c)) +} + +// NewCamera - Returns new Camera +func NewCamera(pos, target, up Vector3, fovy float32) Camera { + return Camera{pos, target, up, fovy} +} + +// NewCameraFromPointer - Returns new Camera from pointer +func NewCameraFromPointer(ptr unsafe.Pointer) Camera { + return *(*Camera)(ptr) +} + +// Camera2D type, defines a 2d camera +type Camera2D struct { + // Camera offset (displacement from target) + Offset Vector2 + // Camera target (rotation and zoom origin) + Target Vector2 + // Camera rotation in degrees + Rotation float32 + // Camera zoom (scaling), should be 1.0f by default + Zoom float32 +} + +func (c *Camera2D) cptr() *C.Camera2D { + return (*C.Camera2D)(unsafe.Pointer(c)) +} + +// NewCamera2D - Returns new Camera2D +func NewCamera2D(offset, target Vector2, rotation, zoom float32) Camera2D { + return Camera2D{offset, target, rotation, zoom} +} + +// NewCamera2DFromPointer - Returns new Camera2D from pointer +func NewCamera2DFromPointer(ptr unsafe.Pointer) Camera2D { + return *(*Camera2D)(ptr) +} + // BoundingBox type type BoundingBox struct { // Minimum vertex box-corner