Add default scaling level to config, set to 32 by default.

Was 16 before.
This commit is contained in:
KikooDX 2021-02-27 00:32:25 +01:00
parent a3a4483a44
commit 4eefad9062
3 changed files with 7 additions and 4 deletions

View File

@ -31,6 +31,8 @@ pub const default_grid_size = .{
.height = 16,
};
pub const default_scaling_level = 32;
pub const theme = .{
.background = ray.BLACK,
.mode = .{

View File

@ -59,7 +59,7 @@ pub fn main() void {
var camera: Vec2 = comptime Vec2.init(0, 0);
// Init scale, used by drawing code.
var scale: scaling.scale_type = scaling.scale_default;
var scale: scaling.scale_type = conf.default_scaling_level;
// Create mouse.
var mouse: Mouse = comptime Mouse.init();
@ -270,6 +270,7 @@ pub fn main() void {
draw.rectangle_selection(scale, camera, Rect.init_from_vec2(cursor, cursor_before), mode == .rectangle);
if (conf.mouse_enabled)
mouse.draw(scale, camera);
//ray.DrawFPS(0, 0);
}
}

View File

@ -8,15 +8,15 @@ const std = @import("std");
const expect = std.testing.expect;
const maxInt = std.math.maxInt;
const conf = @import("conf.zig");
const Parameter = @import("parameter.zig");
pub const scale_type = u8;
pub const scale_default: comptime_int = 16;
const scale_min = 3;
const scale_max = maxInt(scale_type);
pub fn scale_reset(current_scale: scale_type, arg: Parameter.buffer_type) scale_type {
return scale_default;
return conf.default_scaling_level;
}
pub fn scale_up(current_scale: scale_type, arg: Parameter.buffer_type) scale_type {
@ -32,7 +32,7 @@ pub fn scale_down(current_scale: scale_type, arg: Parameter.buffer_type) scale_t
}
test "scale reset" {
expect(scale_reset(42, 1) == scale_default);
expect(scale_reset(42, 1) == conf.default_scaling_level);
}
test "scale up" {