toggle grid size

This commit is contained in:
Michael Zhang 2021-01-10 03:08:12 -06:00
parent 4abf19784e
commit 961e141bfc
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
4 changed files with 15 additions and 2 deletions

2
Cargo.lock generated
View file

@ -1072,7 +1072,7 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
[[package]]
name = "libosu"
version = "0.0.15"
source = "git+https://github.com/iptq/libosu?rev=7fbe7afbad55b25398062719ebaccbff0387d139#7fbe7afbad55b25398062719ebaccbff0387d139"
source = "git+https://github.com/iptq/libosu?rev=557d0a321405516f12c3939c1207c7341f796f35#557d0a321405516f12c3939c1207c7341f796f35"
dependencies = [
"anyhow",
"bitflags",

View file

@ -24,4 +24,4 @@ structopt = "0.3.21"
[dependencies.libosu]
git = "https://github.com/iptq/libosu"
rev = "7fbe7afbad55b25398062719ebaccbff0387d139"
rev = "557d0a321405516f12c3939c1207c7341f796f35"

View file

@ -59,4 +59,14 @@ impl Game {
Ok(())
}
pub(super) fn toggle_grid(&mut self) {
use libosu::enums::GridSize::*;
self.beatmap.inner.grid_size = match self.beatmap.inner.grid_size {
Tiny => Small,
Small => Medium,
Medium => Large,
Large => Tiny,
};
}
}

View file

@ -399,6 +399,9 @@ impl EventHandler for Game {
match keycode {
Space => self.toggle_playing(),
Colon => {}
G => {
self.toggle_grid();
}
_ => {}
};
}