mirror of https://git.sr.ht/~kikoodx/kble
26 lines
859 B
Zig
26 lines
859 B
Zig
// SPDX-License-Identifier: MIT
|
|
// Copyright (c) 2021 KikooDX
|
|
// This file is part of [KBLE](https://sr.ht/~kikoodx/kble), which is
|
|
// MIT licensed. The MIT license requires this copyright notice to be
|
|
// included in all copies and substantial portions of the software.
|
|
const ray = @cImport({
|
|
@cInclude("raylib.h");
|
|
});
|
|
|
|
const Vec2 = @import("vec2.zig");
|
|
const scaling = @import("scaling.zig");
|
|
const Mode = @import("modes.zig").Mode;
|
|
|
|
/// Draw cursor.
|
|
pub fn cursor(scale: scaling.scale_type, offset: Vec2, pos: Vec2, mode: Mode) void {
|
|
const x = (pos.x - offset.y) * scale;
|
|
const y = (pos.y - offset.y) * scale;
|
|
const color: ray.Color = switch (mode) {
|
|
.normal => ray.GRAY,
|
|
.select => ray.BLUE,
|
|
.rectangle => ray.SKYBLUE,
|
|
.camera => ray.PURPLE,
|
|
};
|
|
ray.DrawRectangleLines(x, y, scale, scale, color);
|
|
}
|