From 33994537e6c0d69163bd7517c5e643553aee2729 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Fri, 17 May 2024 21:28:51 +0200 Subject: [PATCH] update to servicepoint2 v0.4.1 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- shell.nix | 4 ++++ src/execute_command.rs | 17 +++++++++-------- 4 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 shell.nix diff --git a/Cargo.lock b/Cargo.lock index e706e34..8471727 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1622,9 +1622,9 @@ dependencies = [ [[package]] name = "servicepoint2" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e271ff29f683581a14d1712f76c0cf2dad956725cc1f36228ddde8ea783055cf" +checksum = "54d49d501f34100406d70730d887775ed5961b6343ccb10d5ef0e105d7b295ae" dependencies = [ "bzip2", "flate2", diff --git a/Cargo.toml b/Cargo.toml index e49226f..d80569f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later" [dependencies] # packet parsing -servicepoint2 = "0.4.0" +servicepoint2 = "0.4.1" # gui winit = { version = "0.30", features = ["rwh_05"] } # for creating a window diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..0818d4c --- /dev/null +++ b/shell.nix @@ -0,0 +1,4 @@ +{ pkgs ? import {} }: + pkgs.mkShell { + nativeBuildInputs = with pkgs.buildPackages; [ rustup pkg-config xe lzma ]; +} diff --git a/src/execute_command.rs b/src/execute_command.rs index b9db971..ea2f7d4 100644 --- a/src/execute_command.rs +++ b/src/execute_command.rs @@ -2,7 +2,7 @@ use std::sync::{RwLock, RwLockWriteGuard}; use log::{debug, error, info, warn}; use servicepoint2::{ - ByteGrid, Command, Origin, PixelGrid, PIXEL_COUNT, PIXEL_WIDTH, TILE_SIZE, + ByteGrid, Command, Origin, PIXEL_COUNT, PIXEL_WIDTH, PixelGrid, TILE_SIZE, }; use crate::font::BitmapFont; @@ -89,8 +89,8 @@ pub(crate) fn execute_command( let offset_y = offset_y as usize; let mut luma = luma_ref.write().unwrap(); - for inner_y in 0..grid.height { - for inner_x in 0..grid.width { + for inner_y in 0..grid.height() { + for inner_x in 0..grid.width() { let brightness = grid.get(inner_x, inner_y); luma.set( offset_x + inner_x, @@ -133,8 +133,8 @@ fn print_cp437_data( let x = x as usize; let y = y as usize; - for char_y in 0usize..grid.height { - for char_x in 0usize..grid.width { + for char_y in 0usize..grid.height() { + for char_x in 0usize..grid.width() { let char_code = grid.get(char_x, char_y); let tile_x = char_x + x; @@ -159,10 +159,11 @@ fn print_pixel_grid( ) { debug!( "printing {}x{} grid at {offset_x} {offset_y}", - pixels.width, pixels.height + pixels.width(), + pixels.height() ); - for inner_y in 0..pixels.height { - for inner_x in 0..pixels.width { + for inner_y in 0..pixels.height() { + for inner_x in 0..pixels.width() { let is_set = pixels.get(inner_x, inner_y); display.set(offset_x + inner_x, offset_y + inner_y, is_set); }