From: hgn Date: Mon, 24 Mar 2025 03:56:47 +0000 (+0000) Subject: fadeout the route ui over time X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=69cc398075a19d25b2bacd1e7eeab54265170cc1;p=carveJwlIkooP6JGAAIwe30JlM.git fadeout the route ui over time --- diff --git a/src/world.h b/src/world.h index 9fffb71..bd46891 100644 --- a/src/world.h +++ b/src/world.h @@ -227,7 +227,9 @@ struct world_static void *heap, *preview_heap; u32 current_run_version; - double time, rewind_from, rewind_to; + f64 last_gate_hit_time; + + double time; u32 active_trigger_volumes[8]; u32 active_trigger_volume_count; diff --git a/src/world_routes.c b/src/world_routes.c index 53d911b..c6735bb 100644 --- a/src/world_routes.c +++ b/src/world_routes.c @@ -200,6 +200,7 @@ void world_routes_activate_entry_gate( world_instance *world, ent_gate *rg ) else recording_gate->flags |= k_ent_gate_clean_pass; + _world.last_gate_hit_time = _world.time; _world.current_run_version ++; } diff --git a/src/world_routes_ui.c b/src/world_routes_ui.c index e607b90..25ac799 100644 --- a/src/world_routes_ui.c +++ b/src/world_routes_ui.c @@ -70,7 +70,7 @@ static void ent_route_imgui( ui_context *ctx, world_instance *world, ent_route * ui_px x = 0, h = route->factive * 16.0f, - base = inout_cursor[0];//(f32)vg.window_x*0.5f - route->ui_stopper; + base = inout_cursor[0]; if( route->ui_residual > 0.0f ) { @@ -82,12 +82,7 @@ static void ent_route_imgui( ui_context *ctx, world_instance *world, ent_route * x -= (f32)total * t; ui_rect rect = { base+x, inout_cursor[1], w, h }; - - v4f fadecolour; - v4_copy( route->colour, fadecolour ); - fadecolour[3] *= route->ui_residual; - - ui_fill( ctx, rect, v4_rgba(fadecolour) ); + ui_fill( ctx, rect, ui_opacity( colour, route->ui_residual ) ); x += total; } @@ -104,7 +99,7 @@ static void ent_route_imgui( ui_context *ctx, world_instance *world, ent_route * if( block->clean ) ui_outline( ctx, rect, 1, 0xff00ffff, 0 ); - if( block->best != 0.0f ) + if( (block->best != 0.0f) ) { char buf[32]; vg_str str; @@ -165,9 +160,18 @@ void world_routes_imgui( ui_context *ctx, world_instance *world ) if( skaterift.activity == k_skaterift_menu ) return; if( _world.event != k_world_event_none ) return; + ui_flush( ctx, k_ui_shader_colour, NULL ); + + f32 t = (_world.time - _world.last_gate_hit_time) / 30.0f; + f32 alpha = vg_clampf( 2.0f-t, 0.0f, 1.0f ); + vg_ui.colour[3] = alpha; + ui_point cursor = { 4, 4 }; for( u32 i=0; ient_route); i++ ) { ent_route_imgui( ctx, world, af_arritm( &world->ent_route, i ), cursor ); } + + ui_flush( ctx, k_ui_shader_colour, NULL ); + vg_ui.colour[3] = 1.0f; }