kble/src/mouse.zig

30 lines
747 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.
//! Mouse (eurk) logic and operations.
const std = @import("std");
const Vec2 = @import("vec2.zig");
const Self = @This();
pub const MouseMode = enum {
idle,
sel,
rect_sel,
};
mode: MouseMode, // State.
pos: Vec2, // Where the cursor is.
start_pos: Vec2, // Used for rectangle selection.
pub fn init() Self {
return Self{
.mode = MouseMode.idle, // state
.pos = Vec2{ .x = 0, .y = 0 },
.start_pos = Vec2{ .x = 0, .y = 0 },
};
}