clean up ui, more upgrades

This commit is contained in:
Vinzenz Schroeter 2025-07-06 22:03:11 +02:00
commit 2a4f92c9b3
6 changed files with 132 additions and 175 deletions

View file

@ -1,9 +1,9 @@
use game::Game;
use servicepoint::{
BinaryOperation, BitVecCommand, Bitmap, CharGrid, CharGridCommand, ClearCommand,
CompressionCode, FRAME_PACING, TILE_HEIGHT, TILE_WIDTH, UdpSocketExt,
Bitmap, BitmapCommand, CharGrid, CharGridCommand, ClearCommand, TILE_HEIGHT, TILE_WIDTH,
UdpSocketExt,
};
use std::{net::UdpSocket, thread::sleep, time::Instant};
use std::{net::UdpSocket, time::Instant};
mod bar;
mod border_panel;
@ -23,8 +23,8 @@ fn main() {
let connection = UdpSocket::bind_connect(DESTINATION).unwrap();
connection.send_command(ClearCommand);
let mut chars = CharGrid::new(TILE_WIDTH, TILE_HEIGHT);
let mut pixels = Bitmap::max_sized();
let mut bitmap_cmd = BitmapCommand::from(Bitmap::max_sized());
let mut chars_cmd = CharGridCommand::from(CharGrid::new(TILE_WIDTH, TILE_HEIGHT));
let mut last_refresh = Instant::now();
loop {
@ -34,7 +34,10 @@ fn main() {
state.progress(delta);
chars.fill(' ');
let chars = &mut chars_cmd.grid;
let pixels = &mut bitmap_cmd.bitmap;
chars.fill('\0');
pixels.fill(false);
let chars_view = chars
@ -45,18 +48,8 @@ fn main() {
.unwrap();
state.draw(chars_view, pixels_view);
connection
.send_command(CharGridCommand::from(chars.clone()))
.unwrap();
connection
.send_command(BitVecCommand {
bitvec: pixels.clone().into(),
compression: CompressionCode::default(),
operation: BinaryOperation::Or,
offset: 0,
})
.unwrap();
sleep(FRAME_PACING / 2);
connection.send_command(&bitmap_cmd).unwrap();
connection.send_command(&chars_cmd).unwrap();
//sleep(FRAME_PACING / 10);
}
}