From 1eb1471d2aa0c8808e44a532f2d8dacdb9aff7bb Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Thu, 9 May 2024 16:43:56 +0200 Subject: [PATCH] move constants to shared --- src/gui.rs | 3 ++- src/main.rs | 8 +------- src/upd_loop.rs | 6 ++++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/gui.rs b/src/gui.rs index e2f9cd4..15098e2 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -1,5 +1,6 @@ -use crate::{DISPLAY, PIXEL_HEIGHT, PIXEL_WIDTH}; +use crate::DISPLAY; use log::{debug, warn}; +use pixel_shared_rs::{PIXEL_HEIGHT, PIXEL_WIDTH}; use pixels::wgpu::TextureFormat; use pixels::{Pixels, PixelsBuilder, SurfaceTexture}; use winit::application::ApplicationHandler; diff --git a/src/main.rs b/src/main.rs index 22b2c54..78992a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ use crate::gui::App; use crate::upd_loop::start_udp_thread; use clap::Parser; use log::info; +use pixel_shared_rs::PIXEL_COUNT; use winit::event_loop::{ControlFlow, EventLoop}; #[derive(Parser, Debug)] @@ -18,13 +19,6 @@ struct Cli { bind: String, } -const TILE_SIZE: u16 = 8; -const TILE_WIDTH: u16 = 65; -const TILE_HEIGHT: u16 = 20; -const PIXEL_WIDTH: u16 = TILE_WIDTH * TILE_SIZE; -const PIXEL_HEIGHT: u16 = TILE_HEIGHT * TILE_SIZE; -const PIXEL_COUNT: usize = PIXEL_WIDTH as usize * PIXEL_HEIGHT as usize; - static mut DISPLAY: [bool; PIXEL_COUNT] = [false; PIXEL_COUNT]; fn main() { diff --git a/src/upd_loop.rs b/src/upd_loop.rs index 821524f..ed0c2af 100644 --- a/src/upd_loop.rs +++ b/src/upd_loop.rs @@ -1,6 +1,8 @@ -use crate::{DISPLAY, PIXEL_WIDTH, TILE_SIZE}; +use crate::DISPLAY; use log::{error, info, warn}; -use pixel_shared_rs::{read_hdr_window, DisplayCommand, HdrWindow, ReadHdrWindowError}; +use pixel_shared_rs::{ + read_hdr_window, DisplayCommand, HdrWindow, ReadHdrWindowError, PIXEL_WIDTH, TILE_SIZE, +}; use std::io::ErrorKind; use std::mem::size_of; use std::net::UdpSocket;