Improve delta board

This commit is contained in:
hodasemi 2023-01-20 08:14:51 +01:00
parent 95e7ec72a1
commit 8a0e94b99b
2 changed files with 25 additions and 3 deletions

View file

@ -202,7 +202,27 @@ impl LeaderBoard {
.enumerate()
.find(|(_index, entry)| entry.id() == self.last_player_id)
{
let mut start_index = if index >= 2 { index - 2 } else { 0 };
let mut start_index = if index >= 2 {
if index == self.leaderboard_entries.len() - 2 {
if index >= 3 {
index - 3
} else {
index - 2
}
} else if index == self.leaderboard_entries.len() - 1 {
if index >= 4 {
index - 4
} else if index >= 3 {
index - 3
} else {
index - 2
}
} else {
index - 2
}
} else {
0
};
let max = self.leaderboard_entries.len().min(5);

View file

@ -20,11 +20,14 @@ pub struct Rendering {
impl Rendering {
pub fn new(queue: Arc<Mutex<Queue>>, swapchain: Arc<Swapchain>) -> Result<Self> {
crate::write_log!("-> Rendering ctor: begin");
let vk_images = swapchain.vk_images()?;
write_log!(format!(
"-> Rendering ctor: vk images ({})",
vk_images.len()
));
let images = match swapchain.wrap_images(&vk_images, &queue, true) {
Ok(images) => images,
Err(err) => {
@ -32,9 +35,8 @@ impl Rendering {
return Err(err);
}
};
write_log!("-> Rendering ctor: wrapped images");
write_log!("-> Rendering ctor: created render_target");
write_log!("-> Rendering ctor: wrapped images");
write_log!(format!(
"-> Rendering swapchain extents ({}, {})",