And make work with colemak hehe
This commit is contained in:
2026-03-13 12:53:36 +01:00
parent c59ed511c0
commit c29af146dd
2 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -879,14 +879,14 @@ pub fn main() u8 {
wl_state.running = true; wl_state.running = true;
wl_state.resize = true; wl_state.resize = true;
wl_state.window_width = 800; wl_state.window_width = 1280;
wl_state.window_height = 600; wl_state.window_height = 960;
var shared_memory_pool: ?*c.wl_shm_pool = undefined; var shared_memory_pool: ?*c.wl_shm_pool = undefined;
var shared_memory_pool_data: []u8 = undefined; var shared_memory_pool_data: []u8 = undefined;
var wl_buffer: *c.wl_buffer = undefined; var wl_buffer: *c.wl_buffer = undefined;
const monitor_update_hz: f64 = 30; const monitor_update_hz: f64 = 60;
const game_update_hz: f64 = monitor_update_hz; const game_update_hz: f64 = monitor_update_hz;
const frame_target_time_s: f64 = 1.0 / game_update_hz; const frame_target_time_s: f64 = 1.0 / game_update_hz;
const frame_target_time_ms: f64 = std.time.ms_per_s * frame_target_time_s; const frame_target_time_ms: f64 = std.time.ms_per_s * frame_target_time_s;
+6 -6
View File
@@ -4,7 +4,7 @@ const builtin = @import("builtin");
pub const platform = @import("platform.zig"); pub const platform = @import("platform.zig");
const TILE_SIZE = 32; const TILE_SIZE = 64;
const V2 = struct { const V2 = struct {
x: f32, x: f32,
@@ -693,7 +693,7 @@ fn indexFont(font: Image, c: u8) V2 {
fn drawString(buffer: platform.OffscreenBuffer, image: Image, pos: V2, str: []const u8) void { fn drawString(buffer: platform.OffscreenBuffer, image: Image, pos: V2, str: []const u8) void {
var current_pos = pos; var current_pos = pos;
const font_size = 32; const font_size = 32;
const scale = 0.25; const scale = 0.5;
const font_width_scaled = scale * font_size; const font_width_scaled = scale * font_size;
for (str) |c| { for (str) |c| {
const char_image_pos = indexFont(image, c); const char_image_pos = indexFont(image, c);
@@ -916,7 +916,7 @@ pub fn updateAndRender(memory: *platform.AppMemory, buffer: platform.OffscreenBu
.pos = mid, .pos = mid,
.width = 7, .width = 7,
.height = 7, .height = 7,
.tile_size = V2.init(32, 32), .tile_size = V2.init(TILE_SIZE, TILE_SIZE),
.tiles = tiles, .tiles = tiles,
}; };
const board_size = V2.initI32( const board_size = V2.initI32(
@@ -997,7 +997,7 @@ pub fn updateAndRender(memory: *platform.AppMemory, buffer: platform.OffscreenBu
const diff = mouse_pos.sub(state.mouse_pos); const diff = mouse_pos.sub(state.mouse_pos);
brick.pos = brick.pos.add(diff); brick.pos = brick.pos.add(diff);
if (keyPressed(&input.key.e)) { if (keyPressed(&input.key.e) or keyPressed(&input.key.f)) {
brick.rotating = true; brick.rotating = true;
const rotated = brick.rotate(); const rotated = brick.rotate();
brick.tiles = rotated; brick.tiles = rotated;
@@ -1053,7 +1053,7 @@ pub fn updateAndRender(memory: *platform.AppMemory, buffer: platform.OffscreenBu
const width: i32 = @intFromFloat(board.tile_size.x); const width: i32 = @intFromFloat(board.tile_size.x);
const height: i32 = @intFromFloat(board.tile_size.y); const height: i32 = @intFromFloat(board.tile_size.y);
const str_width = @divFloor(32 * tile.label.len, 4); const str_width = @divFloor(TILE_SIZE * tile.label.len, 4);
const str_height = @divFloor(32, 4); const str_height = @divFloor(32, 4);
const str_size = V2.initUSize(str_width, str_height); const str_size = V2.initUSize(str_width, str_height);
const string_pos = tile_pos.add(board.tile_size.mul(0.5)).sub(str_size.mul(0.5)); const string_pos = tile_pos.add(board.tile_size.mul(0.5)).sub(str_size.mul(0.5));
@@ -1099,7 +1099,7 @@ pub fn updateAndRender(memory: *platform.AppMemory, buffer: platform.OffscreenBu
buffer, buffer,
@intFromFloat(camera_pos.x), @intFromFloat(camera_pos.x),
@intFromFloat(camera_pos.y), @intFromFloat(camera_pos.y),
30, TILE_SIZE,
color, color,
); );
} }