Got screen fading to work in my game using my own coroutine system from scratch. this is the c code driving it
define_flat_coroutine(fade_screen_to_black, fcr_locals(int alpha_iteration;), ptr_type(Platform) platform) { f32 dt = convert(f32, platform->time.delta_seconds); fcr_begin({ system_color_pallete(COLOR_ID_FADER).x = (1021.0f / 1024.0f); fcr->locals.alpha_iteration = 0; }); for(; fcr->locals.alpha_iteration < 23; fcr->locals.alpha_iteration++) { system_color_pallete(COLOR_ID_FADER).x -= (2.0f / 1024.0f); fcr_wait_time(.05f, dt); } fcr_end(); } ... flat_coroutine(fade_screen_to_black) screen_fader = flat_coroutine_setup(fade_screen_to_black); //in the render function //next any relevant UI if(show_black_screen) { //append the black screen flat_coroutine_run_with_args(ref(screen_fader), platform); ptr_type(Render_UI_Quad) r_quad = ui_quad_fixture_append_fixed_space_single(ui_fixture, ref(ui_quad_space), 1); r_quad->sprite_attribs.z = -1.0f; } else if (reset_black_screen) { screen_fader = flat_coroutine_setup(fade_screen_to_black); //just reset the coroutine }