Started work on data viewer
This commit is contained in:
41
src/data_viewer/DataViewer.cs
Normal file
41
src/data_viewer/DataViewer.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class DataViewer : Control
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Export]
|
||||
public float _cameraSpeed = 0.01f;
|
||||
|
||||
[Node] public Node3D CameraPivot { get; set; } = default!;
|
||||
|
||||
[Node] public Camera3D Camera3D { get; set; } = default!;
|
||||
|
||||
[Node] public Node3D ModelPivot { get; set; } = default!;
|
||||
|
||||
[Node] public Label RotationLabel { get; set; } = default!;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Input.IsActionPressed(GameInputs.MoveLeft))
|
||||
CameraPivot.RotateY(_cameraSpeed);
|
||||
if (Input.IsActionPressed(GameInputs.MoveRight))
|
||||
CameraPivot.RotateY(-_cameraSpeed);
|
||||
if (Input.IsActionPressed(GameInputs.MoveUp))
|
||||
ModelPivot.RotateX(-_cameraSpeed);
|
||||
if (Input.IsActionPressed(GameInputs.MoveDown))
|
||||
ModelPivot.RotateX(_cameraSpeed);
|
||||
if (Input.IsActionPressed(GameInputs.StrafeLeft))
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, (float)delta * 2f);
|
||||
if (Input.IsActionPressed(GameInputs.StrafeRight))
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, -(float)delta * 2f);
|
||||
|
||||
Camera3D.Position = Camera3D.Position.Clamp(new Vector3(0, 0, 1), new Vector3(0, 0, 4));
|
||||
ModelPivot.Rotation = ModelPivot.Rotation.Clamp(Mathf.DegToRad(-60), Mathf.DegToRad(60));
|
||||
}
|
||||
}
|
||||
198
src/data_viewer/DataViewer.tscn
Normal file
198
src/data_viewer/DataViewer.tscn
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user