update indev version
This commit is contained in:
parent
0bf317dd6d
commit
143ef1e285
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -108,17 +108,6 @@ version = "2.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "inherent"
|
|
||||||
version = "1.0.12"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6c38228f24186d9cc68c729accb4d413be9eaed6ad07ff79e0270d9e56f3de13"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is_terminal_polyfill"
|
name = "is_terminal_polyfill"
|
||||||
version = "1.70.1"
|
version = "1.70.1"
|
||||||
|
@ -282,7 +271,6 @@ name = "servicepoint"
|
||||||
version = "0.16.0"
|
version = "0.16.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitvec",
|
"bitvec",
|
||||||
"inherent",
|
|
||||||
"log",
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rust-lzma",
|
"rust-lzma",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use servicepoint::{Bitmap, WindowMut};
|
use servicepoint::{Bitmap, Grid, GridMut, WindowMut};
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub struct Bar {
|
pub struct Bar {
|
||||||
pub progress: f64,
|
pub progress: f64,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use servicepoint::{Bitmap, CharGrid, CharGridMutExt, TILE_SIZE, WindowMut};
|
use servicepoint::{Bitmap, CharGrid, CharGridMutExt, Grid, GridMut, TILE_SIZE, WindowMut};
|
||||||
|
|
||||||
pub type BorderPattern = [bool; TILE_SIZE];
|
pub type BorderPattern = [bool; TILE_SIZE];
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ pub const OUTER_BORDER: BorderPattern = [false, false, false, true, true, false,
|
||||||
pub const INNER_BORDER: BorderPattern = [false, false, false, true, true, false, false, false];
|
pub const INNER_BORDER: BorderPattern = [false, false, false, true, true, false, false, false];
|
||||||
|
|
||||||
pub fn draw_border_panel<'c, 'b>(
|
pub fn draw_border_panel<'c, 'b>(
|
||||||
mut chars: WindowMut<'c, char, CharGrid>,
|
chars: &'c mut WindowMut<char, CharGrid>,
|
||||||
mut bitmap: WindowMut<'b, bool, Bitmap>,
|
bitmap: &'b mut WindowMut<bool, Bitmap>,
|
||||||
label: &str,
|
label: &str,
|
||||||
border_pattern: BorderPattern,
|
border_pattern: BorderPattern,
|
||||||
) -> (WindowMut<'c, char, CharGrid>, WindowMut<'b, bool, Bitmap>) {
|
) -> (WindowMut<'c, char, CharGrid>, WindowMut<'b, bool, Bitmap>) {
|
||||||
|
@ -77,17 +77,15 @@ pub fn draw_border_panel<'c, 'b>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (chars, _) = chars.split_horizontal_mut(tile_width - 1).unwrap();
|
let chars = chars
|
||||||
let (_, chars) = chars.split_horizontal_mut(1).unwrap();
|
.window_mut(1..tile_width - 1, 1..tile_height - 1)
|
||||||
let (chars, _) = chars.split_vertical_mut(tile_height - 1).unwrap();
|
.unwrap();
|
||||||
let (_, chars) = chars.split_vertical_mut(1).unwrap();
|
let bitmap = bitmap
|
||||||
|
.window_mut(
|
||||||
let (bitmap, _) = bitmap
|
TILE_SIZE..tile_width - TILE_SIZE,
|
||||||
.split_horizontal_mut(pixel_width - TILE_SIZE)
|
TILE_SIZE..tile_height - TILE_SIZE,
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let (_, bitmap) = bitmap.split_horizontal_mut(TILE_SIZE).unwrap();
|
|
||||||
let (bitmap, _) = bitmap.split_vertical_mut(pixel_height - TILE_SIZE).unwrap();
|
|
||||||
let (_, bitmap) = bitmap.split_vertical_mut(TILE_SIZE).unwrap();
|
|
||||||
|
|
||||||
(chars, bitmap)
|
(chars, bitmap)
|
||||||
}
|
}
|
||||||
|
|
40
src/game.rs
40
src/game.rs
|
@ -76,40 +76,44 @@ impl Game {
|
||||||
|
|
||||||
pub fn draw(
|
pub fn draw(
|
||||||
&self,
|
&self,
|
||||||
text_layer: WindowMut<char, CharGrid>,
|
mut text_layer: WindowMut<char, CharGrid>,
|
||||||
pixel_layer: WindowMut<bool, Bitmap>,
|
mut pixel_layer: WindowMut<bool, Bitmap>,
|
||||||
) {
|
) {
|
||||||
let (text_layer, pixel_layer) = draw_border_panel(
|
let (mut text_layer, mut pixel_layer) = draw_border_panel(
|
||||||
text_layer,
|
&mut text_layer,
|
||||||
pixel_layer,
|
&mut pixel_layer,
|
||||||
" Discordia Boot Procedure ",
|
" Discordia Boot Procedure ",
|
||||||
OUTER_BORDER,
|
OUTER_BORDER,
|
||||||
);
|
);
|
||||||
|
|
||||||
let unlocks_height = 3 + 2;
|
let unlocks_height = 3 + 2;
|
||||||
let (unlocks_text, bars_text) = text_layer.split_vertical_mut(unlocks_height).unwrap();
|
let (mut unlocks_text, bars_text) = text_layer.split_vertical_mut(unlocks_height).unwrap();
|
||||||
let (unlocks_pixel, bars_pixel) = pixel_layer
|
let (mut unlocks_pixel, bars_pixel) = pixel_layer
|
||||||
.split_vertical_mut(unlocks_height * TILE_SIZE)
|
.split_vertical_mut(unlocks_height * TILE_SIZE)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
self.unlocks.draw(unlocks_text, unlocks_pixel);
|
self.unlocks.draw(&mut unlocks_text, &mut unlocks_pixel);
|
||||||
|
|
||||||
self.draw_bars(bars_text, bars_pixel);
|
self.draw_bars(bars_text, bars_pixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_bars(
|
fn draw_bars(
|
||||||
&self,
|
&self,
|
||||||
text_layer: WindowMut<char, CharGrid>,
|
mut text_layer: WindowMut<char, CharGrid>,
|
||||||
pixel_layer: WindowMut<bool, Bitmap>,
|
mut pixel_layer: WindowMut<bool, Bitmap>,
|
||||||
) {
|
) {
|
||||||
let (mut text_layer, mut pixel_layer) =
|
let (mut text_layer, mut pixel_layer) = draw_border_panel(
|
||||||
draw_border_panel(text_layer, pixel_layer, " Processes ", INNER_BORDER);
|
&mut text_layer,
|
||||||
|
&mut pixel_layer,
|
||||||
|
" Processes ",
|
||||||
|
INNER_BORDER,
|
||||||
|
);
|
||||||
|
|
||||||
for row in self.state.rows.iter() {
|
for (index, row) in self.state.rows.iter().enumerate() {
|
||||||
let bar_window;
|
let mut bar_window = pixel_layer
|
||||||
(bar_window, pixel_layer) = pixel_layer.split_vertical_mut(TILE_SIZE).unwrap();
|
.window_mut(.., index * TILE_SIZE..index * TILE_SIZE + TILE_SIZE)
|
||||||
let label_window;
|
.unwrap();
|
||||||
(label_window, text_layer) = text_layer.split_vertical_mut(1).unwrap();
|
let mut label_window = text_layer.window_mut(.., index..index + 1).unwrap();
|
||||||
row.draw(label_window, bar_window);
|
row.draw(&mut label_window, &mut bar_window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use game::Game;
|
use game::Game;
|
||||||
use servicepoint::{
|
use servicepoint::{
|
||||||
Bitmap, BitmapCommand, CharGrid, CharGridCommand, ClearCommand, TILE_HEIGHT, TILE_WIDTH,
|
Bitmap, BitmapCommand, CharGrid, CharGridCommand, ClearCommand, GridMut, TILE_HEIGHT,
|
||||||
UdpSocketExt,
|
TILE_WIDTH, UdpSocketExt,
|
||||||
};
|
};
|
||||||
use std::{net::UdpSocket, time::Instant};
|
use std::{net::UdpSocket, time::Instant};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{Currency, bar::Bar};
|
use crate::{Currency, bar::Bar};
|
||||||
use servicepoint::{Bitmap, CharGrid, CharGridMutExt, WindowMut};
|
use servicepoint::{Bitmap, CharGrid, CharGridMutExt, Grid, WindowMut};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
@ -39,7 +39,11 @@ impl Row {
|
||||||
completions * self.productivity
|
completions * self.productivity
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw(&self, chars: WindowMut<char, CharGrid>, bitmap: WindowMut<bool, Bitmap>) {
|
pub fn draw(
|
||||||
|
&self,
|
||||||
|
chars: &mut WindowMut<char, CharGrid>,
|
||||||
|
bitmap: &mut WindowMut<bool, Bitmap>,
|
||||||
|
) {
|
||||||
if !self.enabled {
|
if !self.enabled {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,12 +67,16 @@ impl UnlockSystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw(&self, chars: WindowMut<char, CharGrid>, bitmap: WindowMut<bool, Bitmap>) {
|
pub fn draw(
|
||||||
|
&self,
|
||||||
|
chars: &mut WindowMut<char, CharGrid>,
|
||||||
|
bitmap: &mut WindowMut<bool, Bitmap>,
|
||||||
|
) {
|
||||||
let title = format!(" Stage {}/{} ", self.bought, self.total_unlock_count);
|
let title = format!(" Stage {}/{} ", self.bought, self.total_unlock_count);
|
||||||
|
|
||||||
let (chars, bitmap) = draw_border_panel(chars, bitmap, &title, INNER_BORDER);
|
let (mut chars, mut bitmap) = draw_border_panel(chars, bitmap, &title, INNER_BORDER);
|
||||||
|
|
||||||
let (all_unlocks_pixels, bitmap) = bitmap.split_vertical_mut(TILE_SIZE).unwrap();
|
let (all_unlocks_pixels, mut bitmap) = bitmap.split_vertical_mut(TILE_SIZE).unwrap();
|
||||||
self.all_unlocks_bar.draw(all_unlocks_pixels);
|
self.all_unlocks_bar.draw(all_unlocks_pixels);
|
||||||
|
|
||||||
let (next_unlocks_pixels, _) = bitmap.split_vertical_mut(TILE_SIZE).unwrap();
|
let (next_unlocks_pixels, _) = bitmap.split_vertical_mut(TILE_SIZE).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue