feat(app): add CameraController with F toggle and cursor capture
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7cf6ea267a
commit
22f684e8c6
2 changed files with 100 additions and 15 deletions
31
src/AcDream.App/Rendering/CameraController.cs
Normal file
31
src/AcDream.App/Rendering/CameraController.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// src/AcDream.App/Rendering/CameraController.cs
|
||||
namespace AcDream.App.Rendering;
|
||||
|
||||
public sealed class CameraController
|
||||
{
|
||||
public OrbitCamera Orbit { get; }
|
||||
public FlyCamera Fly { get; }
|
||||
public ICamera Active { get; private set; }
|
||||
public bool IsFlyMode => Active == Fly;
|
||||
|
||||
public event Action<bool>? ModeChanged;
|
||||
|
||||
public CameraController(OrbitCamera orbit, FlyCamera fly)
|
||||
{
|
||||
Orbit = orbit;
|
||||
Fly = fly;
|
||||
Active = orbit;
|
||||
}
|
||||
|
||||
public void ToggleFly()
|
||||
{
|
||||
Active = IsFlyMode ? (ICamera)Orbit : Fly;
|
||||
ModeChanged?.Invoke(IsFlyMode);
|
||||
}
|
||||
|
||||
public void SetAspect(float aspect)
|
||||
{
|
||||
Orbit.Aspect = aspect;
|
||||
Fly.Aspect = aspect;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue