draft: texture button

This commit is contained in:
h z
2025-02-15 08:25:01 +00:00
parent 0d75ed106d
commit 5a981c91ee
11 changed files with 193 additions and 18 deletions

View File

@@ -0,0 +1,38 @@
using Godot;
using Polonium.Attributes;
namespace GlobalClasses;
[ProxyNode]
[GlobalClass]
[Tool]
public partial class CameraScene : Scene
{
private Camera2D Camera { get; set; }
public float MaxZoom { get; set; }
public float MinZoom { get; set; }
public float ZoomRate { get; set; }
private float Zoom
{
get => Camera.Zoom.X;
set => Camera.Zoom = value * Vector2.One;
}
[ProxyMethod]
public virtual void __Ready()
{
}
public sealed override void _Ready()
{
Camera = GetNode<Camera2D>("Camera");
__Ready();
base._Ready();
}
protected void ZoomIn() => Zoom = Mathf.Max(Zoom * (1 + ZoomRate), MaxZoom);
protected void ZoomOut() => Zoom = Mathf.Min(Zoom * (1 - ZoomRate), MinZoom);
protected void ZoomAt(Vector2 pos) => Camera.Position = pos;
}