stack before translating

This commit is contained in:
Michael Zhang 2021-01-09 15:59:39 -06:00
parent d53aff9212
commit d372c50ecf
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
3 changed files with 23 additions and 5 deletions

View file

@ -16,8 +16,6 @@ wrapper script isn't written yet, in this case i just copied bass.dll to the pro
roadmap
-------
- [ ] stacking
- [ ] fix slider overlap problem
- [ ] long term:
- [ ] new framework

View file

@ -172,8 +172,8 @@ impl Game {
let ho_time = (ho.inner.start_time.0 as f64) / 1000.0;
let stacking = ho.stacking as f32 * STACK_DISTANCE as f32;
let pos = [
PLAYFIELD_BOUNDS.x + osupx_scale_x * ho.inner.pos.0 as f32 - stacking,
PLAYFIELD_BOUNDS.y + osupx_scale_y * ho.inner.pos.1 as f32 - stacking,
PLAYFIELD_BOUNDS.x + osupx_scale_x * (ho.inner.pos.0 as f32 - stacking),
PLAYFIELD_BOUNDS.y + osupx_scale_y * (ho.inner.pos.1 as f32 - stacking),
];
let color = draw_info.color;

View file

@ -72,7 +72,7 @@ pub fn render_slider<'a>(
})
.collect::<Vec<Point2<f32>>>();
// draw slider body
// draw slider border
let canvas = Canvas::with_window_size(ctx)?;
let opts = StrokeOptions::default()
.with_line_cap(LineCap::Round)
@ -88,6 +88,26 @@ pub fn render_slider<'a>(
graphics::clear(ctx, Color::new(0.0, 0.0, 0.0, 0.0));
graphics::draw(ctx, &body, DrawParam::default())?;
graphics::set_canvas(ctx, None);
let mut border_color = graphics::WHITE;
border_color.a = color.a;
graphics::draw(ctx, &canvas, DrawParam::default().color(border_color))?;
// draw slider body
let canvas = Canvas::with_window_size(ctx)?;
let opts = StrokeOptions::default()
.with_line_cap(LineCap::Round)
.with_line_join(LineJoin::Round)
.with_line_width(cs_real as f32 * 1.8);
let body = Mesh::new_polyline(
ctx,
DrawMode::Stroke(opts),
spline_mapped.as_ref(),
graphics::WHITE,
)?;
graphics::set_canvas(ctx, Some(&canvas));
graphics::clear(ctx, Color::new(0.0, 0.0, 0.0, 0.0));
graphics::draw(ctx, &body, DrawParam::default())?;
graphics::set_canvas(ctx, None);
graphics::draw(ctx, &canvas, DrawParam::default().color(color))?;
// draw control points wireframe