Demo Finish

This commit is contained in:
h z
2024-06-27 04:16:35 +08:00
parent b8af5f3ccd
commit 8703f92b4e
8 changed files with 75 additions and 30 deletions

24
Scenes/Viewer.cs Normal file
View File

@@ -0,0 +1,24 @@
using Godot;
public partial class Viewer : Node2D
{
private Vector2 Origin => GetParent<CompoundConstructor>().Size / 2;
public ViewerCamera ViewerCamera { get; private set; }
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
ViewerCamera = GetNode<ViewerCamera>("ViewerCamera");
base._Ready();
}
public override void _Input(InputEvent @event)
{
if (@event is InputEventMouseMotion em)
if (em.ButtonMask == MouseButtonMask.Middle)
Position -= em.Relative;
base._Input(@event);
}
public void BackToCenter() => Position = Origin;
}