mirror of
https://github.com/kaesaecracker/servicepoint-simulator.git
synced 2025-01-31 01:30:13 +01:00
update to servicepoint2 v0.4.1
This commit is contained in:
parent
3578a279c5
commit
33994537e6
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1622,9 +1622,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servicepoint2"
|
name = "servicepoint2"
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e271ff29f683581a14d1712f76c0cf2dad956725cc1f36228ddde8ea783055cf"
|
checksum = "54d49d501f34100406d70730d887775ed5961b6343ccb10d5ef0e105d7b295ae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bzip2",
|
"bzip2",
|
||||||
"flate2",
|
"flate2",
|
||||||
|
|
|
@ -7,7 +7,7 @@ license = "GPL-3.0-or-later"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# packet parsing
|
# packet parsing
|
||||||
servicepoint2 = "0.4.0"
|
servicepoint2 = "0.4.1"
|
||||||
|
|
||||||
# gui
|
# gui
|
||||||
winit = { version = "0.30", features = ["rwh_05"] } # for creating a window
|
winit = { version = "0.30", features = ["rwh_05"] } # for creating a window
|
||||||
|
|
4
shell.nix
Normal file
4
shell.nix
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
nativeBuildInputs = with pkgs.buildPackages; [ rustup pkg-config xe lzma ];
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ use std::sync::{RwLock, RwLockWriteGuard};
|
||||||
|
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, warn};
|
||||||
use servicepoint2::{
|
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;
|
use crate::font::BitmapFont;
|
||||||
|
@ -89,8 +89,8 @@ pub(crate) fn execute_command(
|
||||||
let offset_y = offset_y as usize;
|
let offset_y = offset_y as usize;
|
||||||
|
|
||||||
let mut luma = luma_ref.write().unwrap();
|
let mut luma = luma_ref.write().unwrap();
|
||||||
for inner_y in 0..grid.height {
|
for inner_y in 0..grid.height() {
|
||||||
for inner_x in 0..grid.width {
|
for inner_x in 0..grid.width() {
|
||||||
let brightness = grid.get(inner_x, inner_y);
|
let brightness = grid.get(inner_x, inner_y);
|
||||||
luma.set(
|
luma.set(
|
||||||
offset_x + inner_x,
|
offset_x + inner_x,
|
||||||
|
@ -133,8 +133,8 @@ fn print_cp437_data(
|
||||||
let x = x as usize;
|
let x = x as usize;
|
||||||
let y = y as usize;
|
let y = y as usize;
|
||||||
|
|
||||||
for char_y in 0usize..grid.height {
|
for char_y in 0usize..grid.height() {
|
||||||
for char_x in 0usize..grid.width {
|
for char_x in 0usize..grid.width() {
|
||||||
let char_code = grid.get(char_x, char_y);
|
let char_code = grid.get(char_x, char_y);
|
||||||
|
|
||||||
let tile_x = char_x + x;
|
let tile_x = char_x + x;
|
||||||
|
@ -159,10 +159,11 @@ fn print_pixel_grid(
|
||||||
) {
|
) {
|
||||||
debug!(
|
debug!(
|
||||||
"printing {}x{} grid at {offset_x} {offset_y}",
|
"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_y in 0..pixels.height() {
|
||||||
for inner_x in 0..pixels.width {
|
for inner_x in 0..pixels.width() {
|
||||||
let is_set = pixels.get(inner_x, inner_y);
|
let is_set = pixels.get(inner_x, inner_y);
|
||||||
display.set(offset_x + inner_x, offset_y + inner_y, is_set);
|
display.set(offset_x + inner_x, offset_y + inner_y, is_set);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue