// 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. //! User defined settings. const ray = @import("raylib.zig"); const cell_type = @import("level.zig").cell_type; /// raylib.Color initialisation wrapper. fn col(r: u8, g: u8, b: u8) ray.Color { return ray.Color{ .r = r, .g = g, .b = b, .a = 255, }; } // BEGIN USER CONFIG pub const mouse_enabled: bool = true; pub const mouse_left_btn: c_int = 0; pub const mouse_right_btn: c_int = 1; // Set to true for better graphical tablet experience. // * false: click to enter, draw, click to exit. // * true: click to enter, draw, release to exit. pub const mouse_graphic_tablet: bool = false; pub const default_grid_size = .{ .width = 16, .height = 16, }; pub const theme = .{ .background = ray.BLACK, .mode = .{ .normal = ray.GRAY, .select = ray.BLUE, .select_rect = ray.SKYBLUE, .unselect = ray.RED, .unrectangle = ray.PINK, .camera = ray.PURPLE, }, }; /// Return user defined color for corresponding cell ID. pub fn cell_color(cell: cell_type) ray.Color { return switch (cell) { 0 => comptime col(026, 026, 026), // air 1 => comptime col(144, 144, 144), // solid 2 => comptime col(240, 010, 050), // red thing else => ray.PURPLE, // undefined }; } /// Used to set keybindings. /// Only bind to default keybindings, use 0 to unbind a key. pub fn bind_key(key: u8) u8 { return switch (key) { // // jkl; movement. // 'j' => 'h', // 'k' => 'j', // 'l' => 'k', // ';' => 'l', // // Backward movement with HJKL. // 'H' => 'l', // 'J' => 'k', // 'K' => 'j', // 'L' => 'h', // // Use x instead of return for normal mode. // '\n' => 0, // 'x' => '\n', else => key }; } // END USER CONFIG