update to servicepoint2 v0.4.1

This commit is contained in:
Vinzenz Schroeter 2024-05-17 21:28:51 +02:00
parent 3578a279c5
commit 33994537e6
4 changed files with 16 additions and 11 deletions

4
Cargo.lock generated
View file

@ -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",

View file

@ -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

4
shell.nix Normal file
View file

@ -0,0 +1,4 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs.buildPackages; [ rustup pkg-config xe lzma ];
}

View file

@ -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);
}