// 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 Rect = @import("rect.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); } /// Draw rectangle selection preview. pub fn rectangle_selection(scale: scaling.scale_type, offset: Vec2, rect: Rect) void { const x = (rect.left_x - offset.x) * scale; const w = (rect.right_x - rect.left_x + 1) * scale; const y = (rect.top_y - offset.y) * scale; const h = (rect.bottom_y - rect.top_y + 1) * scale; ray.DrawRectangleLines(x, y, w, h, ray.SKYBLUE); }