Camera2D

package
v0.0.0-...-d9f4d4e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package Camera2D provides methods for working with Camera2D object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type AnchorMode

type AnchorMode = gdclass.Camera2DAnchorMode //gd:Camera2D.AnchorMode
const (
	/*The camera's position is fixed so that the top-left corner is always at the origin.*/
	AnchorModeFixedTopLeft AnchorMode = 0
	/*The camera's position takes into account vertical/horizontal offsets and the screen size.*/
	AnchorModeDragCenter AnchorMode = 1
)

type Any

type Any interface {
	gd.IsClass
	AsCamera2D() Instance
}

type Camera2DProcessCallback

type Camera2DProcessCallback = gdclass.Camera2DCamera2DProcessCallback //gd:Camera2D.Camera2DProcessCallback
const (
	/*The camera updates during physics frames (see [constant Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS]).*/
	Camera2dProcessPhysics Camera2DProcessCallback = 0
	/*The camera updates during process frames (see [constant Node.NOTIFICATION_INTERNAL_PROCESS]).*/
	Camera2dProcessIdle Camera2DProcessCallback = 1
)

type Instance

type Instance [1]gdclass.Camera2D

Camera node for 2D scenes. It forces the screen (current layer) to scroll following this node. This makes it easier (and faster) to program scrollable scenes than manually changing the position of [CanvasItem]-based nodes. Cameras register themselves in the nearest [Viewport] node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. This node is intended to be a simple helper to get things going quickly, but more functionality may be desired to change how the camera works. To make your own custom camera node, inherit it from [Node2D] and change the transform of the canvas by setting [member Viewport.canvas_transform] in [Viewport] (you can obtain the current [Viewport] by using [method Node.get_viewport]). Note that the [Camera2D] node's [code]position[/code] doesn't represent the actual position of the screen, which may differ due to applied smoothing or limits. You can use [method get_screen_center_position] to get the real position.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) Align

func (self Instance) Align()

Aligns the camera to the tracked node.

func (Instance) AnchorMode

func (self Instance) AnchorMode() gdclass.Camera2DAnchorMode

func (Instance) AsCamera2D

func (self Instance) AsCamera2D() Instance

func (Instance) AsCanvasItem

func (self Instance) AsCanvasItem() CanvasItem.Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode2D

func (self Instance) AsNode2D() Node2D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) CustomViewport

func (self Instance) CustomViewport() [1]gdclass.Node

func (Instance) DragBottomMargin

func (self Instance) DragBottomMargin() Float.X

func (Instance) DragHorizontalEnabled

func (self Instance) DragHorizontalEnabled() bool

func (Instance) DragHorizontalOffset

func (self Instance) DragHorizontalOffset() Float.X

func (Instance) DragLeftMargin

func (self Instance) DragLeftMargin() Float.X

func (Instance) DragRightMargin

func (self Instance) DragRightMargin() Float.X

func (Instance) DragTopMargin

func (self Instance) DragTopMargin() Float.X

func (Instance) DragVerticalEnabled

func (self Instance) DragVerticalEnabled() bool

func (Instance) DragVerticalOffset

func (self Instance) DragVerticalOffset() Float.X

func (Instance) EditorDrawDragMargin

func (self Instance) EditorDrawDragMargin() bool

func (Instance) EditorDrawLimits

func (self Instance) EditorDrawLimits() bool

func (Instance) EditorDrawScreen

func (self Instance) EditorDrawScreen() bool

func (Instance) Enabled

func (self Instance) Enabled() bool

func (Instance) ForceUpdateScroll

func (self Instance) ForceUpdateScroll()

Forces the camera to update scroll immediately.

func (Instance) GetScreenCenterPosition

func (self Instance) GetScreenCenterPosition() Vector2.XY

Returns the center of the screen from this camera's point of view, in global coordinates. [b]Note:[/b] The exact targeted position of the camera may be different. See [method get_target_position].

func (Instance) GetTargetPosition

func (self Instance) GetTargetPosition() Vector2.XY

Returns this camera's target position, in global coordinates. [b]Note:[/b] The returned value is not the same as [member Node2D.global_position], as it is affected by the drag properties. It is also not the same as the current position if [member position_smoothing_enabled] is [code]true[/code] (see [method get_screen_center_position]).

func (Instance) IgnoreRotation

func (self Instance) IgnoreRotation() bool

func (Instance) IsCurrent

func (self Instance) IsCurrent() bool

Returns [code]true[/code] if this [Camera2D] is the active camera (see [method Viewport.get_camera_2d]).

func (Instance) LimitBottom

func (self Instance) LimitBottom() int

func (Instance) LimitLeft

func (self Instance) LimitLeft() int

func (Instance) LimitRight

func (self Instance) LimitRight() int

func (Instance) LimitSmoothed

func (self Instance) LimitSmoothed() bool

func (Instance) LimitTop

func (self Instance) LimitTop() int

func (Instance) MakeCurrent

func (self Instance) MakeCurrent()

Forces this [Camera2D] to become the current active one. [member enabled] must be [code]true[/code].

func (Instance) Offset

func (self Instance) Offset() Vector2.XY

func (Instance) PositionSmoothingEnabled

func (self Instance) PositionSmoothingEnabled() bool

func (Instance) PositionSmoothingSpeed

func (self Instance) PositionSmoothingSpeed() Float.X

func (Instance) ProcessCallback

func (self Instance) ProcessCallback() gdclass.Camera2DCamera2DProcessCallback

func (Instance) ResetSmoothing

func (self Instance) ResetSmoothing()

Sets the camera's position immediately to its current smoothing destination. This method has no effect if [member position_smoothing_enabled] is [code]false[/code].

func (Instance) RotationSmoothingEnabled

func (self Instance) RotationSmoothingEnabled() bool

func (Instance) RotationSmoothingSpeed

func (self Instance) RotationSmoothingSpeed() Float.X

func (Instance) SetAnchorMode

func (self Instance) SetAnchorMode(value gdclass.Camera2DAnchorMode)

func (Instance) SetCustomViewport

func (self Instance) SetCustomViewport(value [1]gdclass.Node)

func (Instance) SetDragBottomMargin

func (self Instance) SetDragBottomMargin(value Float.X)

func (Instance) SetDragHorizontalEnabled

func (self Instance) SetDragHorizontalEnabled(value bool)

func (Instance) SetDragHorizontalOffset

func (self Instance) SetDragHorizontalOffset(value Float.X)

func (Instance) SetDragLeftMargin

func (self Instance) SetDragLeftMargin(value Float.X)

func (Instance) SetDragRightMargin

func (self Instance) SetDragRightMargin(value Float.X)

func (Instance) SetDragTopMargin

func (self Instance) SetDragTopMargin(value Float.X)

func (Instance) SetDragVerticalEnabled

func (self Instance) SetDragVerticalEnabled(value bool)

func (Instance) SetDragVerticalOffset

func (self Instance) SetDragVerticalOffset(value Float.X)

func (Instance) SetEditorDrawDragMargin

func (self Instance) SetEditorDrawDragMargin(value bool)

func (Instance) SetEditorDrawLimits

func (self Instance) SetEditorDrawLimits(value bool)

func (Instance) SetEditorDrawScreen

func (self Instance) SetEditorDrawScreen(value bool)

func (Instance) SetEnabled

func (self Instance) SetEnabled(value bool)

func (Instance) SetIgnoreRotation

func (self Instance) SetIgnoreRotation(value bool)

func (Instance) SetLimitBottom

func (self Instance) SetLimitBottom(value int)

func (Instance) SetLimitLeft

func (self Instance) SetLimitLeft(value int)

func (Instance) SetLimitRight

func (self Instance) SetLimitRight(value int)

func (Instance) SetLimitSmoothed

func (self Instance) SetLimitSmoothed(value bool)

func (Instance) SetLimitTop

func (self Instance) SetLimitTop(value int)

func (Instance) SetOffset

func (self Instance) SetOffset(value Vector2.XY)

func (Instance) SetPositionSmoothingEnabled

func (self Instance) SetPositionSmoothingEnabled(value bool)

func (Instance) SetPositionSmoothingSpeed

func (self Instance) SetPositionSmoothingSpeed(value Float.X)

func (Instance) SetProcessCallback

func (self Instance) SetProcessCallback(value gdclass.Camera2DCamera2DProcessCallback)

func (Instance) SetRotationSmoothingEnabled

func (self Instance) SetRotationSmoothingEnabled(value bool)

func (Instance) SetRotationSmoothingSpeed

func (self Instance) SetRotationSmoothingSpeed(value Float.X)

func (Instance) SetZoom

func (self Instance) SetZoom(value Vector2.XY)

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

func (Instance) Zoom

func (self Instance) Zoom() Vector2.XY

type Side

type Side int
const (
	/*Left side, usually used for [Control] or [StyleBox]-derived classes.*/
	SideLeft Side = 0
	/*Top side, usually used for [Control] or [StyleBox]-derived classes.*/
	SideTop Side = 1
	/*Right side, usually used for [Control] or [StyleBox]-derived classes.*/
	SideRight Side = 2
	/*Bottom side, usually used for [Control] or [StyleBox]-derived classes.*/
	SideBottom Side = 3
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL