libosu update

This commit is contained in:
Michael Zhang 2021-01-09 14:03:04 -06:00
parent f622c3cfee
commit 494021d0e1
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
9 changed files with 34 additions and 19 deletions

4
Cargo.lock generated
View file

@ -1071,8 +1071,8 @@ checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
[[package]]
name = "libosu"
version = "0.0.13"
source = "git+https://github.com/iptq/libosu?rev=dee4d05eeaba1313a17eefbbd7679a947b52fbc1#dee4d05eeaba1313a17eefbbd7679a947b52fbc1"
version = "0.0.14"
source = "git+https://github.com/iptq/libosu?rev=a54cfbdaa07265802bb47e35fbdc252337a5adcf#a54cfbdaa07265802bb47e35fbdc252337a5adcf"
dependencies = [
"anyhow",
"bitflags",

View file

@ -21,4 +21,4 @@ structopt = "0.3.21"
[dependencies.libosu]
git = "https://github.com/iptq/libosu"
rev = "dee4d05eeaba1313a17eefbbd7679a947b52fbc1"
rev = "a54cfbdaa07265802bb47e35fbdc252337a5adcf"

View file

@ -27,3 +27,7 @@ license
not sure yet, probably gpl
includes code ported from ppy/osu, which is mit-licensed
uses [libosu][1]
[1]: https://github.com/iptq/libosu

View file

@ -1,6 +1,6 @@
use libosu::{Beatmap, HitObjectKind, Point};
use libosu::{beatmap::Beatmap, hitobject::HitObjectKind, math::Point};
use crate::hit_object::HitObjectExt;
use crate::hitobject::HitObjectExt;
pub const STACK_DISTANCE: f64 = 3.0;

View file

@ -10,16 +10,19 @@ use std::path::Path;
use anyhow::Result;
use ggez::{
event::{EventHandler, KeyCode, KeyMods},
graphics::{
self, Color, DrawMode, DrawParam, FilterMode, Mesh, Rect, StrokeOptions, Text, WHITE,
},
graphics::{self, Color, DrawParam, FilterMode, Rect, Text, WHITE},
Context, GameError, GameResult,
};
use libosu::{Beatmap, HitObjectKind, Point, SpinnerInfo, Spline};
use libosu::{
beatmap::Beatmap,
hitobject::{HitObjectKind, SpinnerInfo},
math::Point,
spline::Spline,
};
use crate::audio::{AudioEngine, Sound};
use crate::beatmap::{BeatmapExt, STACK_DISTANCE};
use crate::hit_object::HitObjectExt;
use crate::hitobject::HitObjectExt;
use crate::skin::Skin;
use self::sliders::render_slider;
@ -89,7 +92,7 @@ impl Game {
}
}
fn priv_draw(&mut self, ctx: &mut Context) -> Result<()> {
fn draw_helper(&mut self, ctx: &mut Context) -> Result<()> {
// TODO: lol
graphics::clear(ctx, [0.0, 0.0, 0.0, 1.0].into());
@ -250,13 +253,16 @@ impl EventHandler for Game {
}
fn key_up_event(&mut self, _: &mut Context, keycode: KeyCode, _: KeyMods) {
if let KeyCode::Space = keycode {
self.toggle_playing();
use KeyCode::*;
match keycode {
Space => self.toggle_playing(),
Colon => {}
_ => {}
}
}
fn draw(&mut self, ctx: &mut Context) -> GameResult {
if let Err(err) = self.priv_draw(ctx) {
if let Err(err) = self.draw_helper(ctx) {
return Err(GameError::RenderError(err.to_string()));
};
Ok(())

View file

@ -6,7 +6,11 @@ use ggez::{
nalgebra::Point2,
Context,
};
use libosu::{Beatmap, HitObject, HitObjectKind, Spline};
use libosu::{
beatmap::Beatmap,
hitobject::{HitObject, HitObjectKind},
spline::Spline,
};
use crate::game::SliderCache;

View file

@ -4,9 +4,9 @@ use ggez::{
nalgebra::Point2,
Context,
};
use libosu::{HitObjectKind, TimingPointKind};
use libosu::{hitobject::HitObjectKind, timing::TimingPointKind};
use crate::hit_object::HitObjectExt;
use crate::hitobject::HitObjectExt;
use super::Game;

View file

@ -1,4 +1,4 @@
use libosu::{Color, HitObject};
use libosu::hitobject::HitObject;
pub struct HitObjectExt {
pub inner: HitObject,

View file

@ -1,5 +1,6 @@
#[macro_use]
extern crate anyhow;
#[allow(unused_macros, unused_imports)]
#[macro_use]
extern crate log;
extern crate bass_sys as bass;
@ -7,7 +8,7 @@ extern crate bass_sys as bass;
mod audio;
mod beatmap;
mod game;
mod hit_object;
mod hitobject;
mod skin;
use std::path::PathBuf;