A Smoll game engine
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

59 linhas
2.1 KiB

using System.Collections.Specialized;
using System.Numerics;
using Raylib_cs;
namespace Smoll.Ex1 {
class CrosshairGizmoComponent : Smoll.Component {
Transform2DComponent? ownerTransform;
public CrosshairGizmoComponent()
{}
public override void OnAttached() {
ownerTransform = owner.GetComponent<Transform2DComponent>();
}
public override void Draw(Smoll.Layer.DrawMode drawMode) {
if(drawMode == Layer.DrawMode.Debug) {
ownerTransform ??= owner.GetComponent<Transform2DComponent>();
ownerTransform ??= new Transform2DComponent();
var tr = ownerTransform.AbsoluteTransform();
Raylib.DrawCircleLines((int)tr.position.Real, (int)tr.position.Imaginary, 5.5f, Color.Black);
Raylib.DrawLine(
(int)tr.position.Real,
(int)tr.position.Imaginary-10,
(int)tr.position.Real,
(int)tr.position.Imaginary+10,
Color.Lime);
Raylib.DrawLine(
(int)tr.position.Real-10,
(int)tr.position.Imaginary,
(int)tr.position.Real+10,
(int)tr.position.Imaginary,
Color.Red);
Raylib.DrawText(
tr.angle.ToString(),
(int)tr.position.Real+7,
(int)tr.position.Imaginary+7,
14,
Color.Magenta
);
Raylib.DrawText(
tr.position.Real.ToString(),
(int)tr.position.Real+7,
(int)tr.position.Imaginary+23,
14,
Color.Red
);
Raylib.DrawText(
tr.position.Imaginary.ToString(),
(int)tr.position.Real+7,
(int)tr.position.Imaginary+39,
14,
Color.Lime
);
}
}
}
}