const rl = @import("raylib");
const shared = @import("shared");
const zm = @import("zmath");

pub const Elf = struct {
    elf: shared.entity.Elf,

    boy: rl.Texture,

    pub fn init() Elf {
        return .{
            .elf = .{ .hp = 10, .pos = zm.f32x4(0, 0, 0, 0) },
            .boy = rl.loadTexture("assets/tile_0000.png") catch unreachable,
        };
    }

    pub fn draw(self: *Elf) void {
        const src = rl.Rectangle.init(0, 0, @floatFromInt(self.boy.width), @floatFromInt(self.boy.height));
        const dst = rl.Rectangle.init(100 + 100 * zm.cos(@as(f32, @floatCast(rl.getTime()))), 100 + 100 * zm.sin(@as(f32, @floatCast(rl.getTime()))), 2.0 * @as(f32, @floatFromInt(self.boy.width)), 2.0 * @as(f32, @floatFromInt(self.boy.height)));
        self.boy.drawPro(src, dst, .{ .x = 0, .y = 0 }, 0, .white);
    }
};
