rename to timestep_alpha

This commit is contained in:
Aleksander
2025-11-13 20:23:27 +01:00
parent 1b0ebb8414
commit 4d4292255a
3 changed files with 10 additions and 10 deletions

View File

@@ -344,7 +344,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
globals: &mut globals, globals: &mut globals,
layout: &mut layout, layout: &mut layout,
debug_draw: debug_draw_enabled, debug_draw: debug_draw_enabled,
alpha: timestep.alpha, timestep_alpha: timestep.alpha,
}; };
let primitives = wgui::drawing::draw(&mut draw_params).unwrap(); let primitives = wgui::drawing::draw(&mut draw_params).unwrap();

View File

@@ -9,7 +9,7 @@ use crate::{
event::EventAlterables, event::EventAlterables,
globals::Globals, globals::Globals,
layout::Widget, layout::Widget,
renderer_vk::text::{custom_glyph::CustomGlyph, TextShadow}, renderer_vk::text::{TextShadow, custom_glyph::CustomGlyph},
stack::{self, ScissorBoundary, ScissorStack, TransformStack}, stack::{self, ScissorBoundary, ScissorStack, TransformStack},
widget::{self, ScrollbarInfo, WidgetState}, widget::{self, ScrollbarInfo, WidgetState},
}; };
@@ -173,7 +173,7 @@ pub struct DrawParams<'a> {
pub globals: &'a Globals, pub globals: &'a Globals,
pub layout: &'a mut Layout, pub layout: &'a mut Layout,
pub debug_draw: bool, pub debug_draw: bool,
pub alpha: f32, // timestep alpha, 0.0 - 1.0, used for motion interpolation if rendering above tick rate: smoother animations or scrolling pub timestep_alpha: f32, // timestep alpha, 0.0 - 1.0, used for motion interpolation if rendering above tick rate: smoother animations or scrolling
} }
pub fn has_overflow_clip(style: &taffy::Style) -> bool { pub fn has_overflow_clip(style: &taffy::Style) -> bool {
@@ -250,7 +250,7 @@ fn draw_widget(
let (scroll_shift, wants_redraw, info) = match widget::get_scrollbar_info(l) { let (scroll_shift, wants_redraw, info) = match widget::get_scrollbar_info(l) {
Some(info) => { Some(info) => {
let (scrolling, wants_redraw) = widget_state.get_scroll_shift_smooth(&info, l, params.alpha); let (scrolling, wants_redraw) = widget_state.get_scroll_shift_smooth(&info, l, params.timestep_alpha);
(scrolling, wants_redraw, Some(info)) (scrolling, wants_redraw, Some(info))
} }
None => (Vec2::default(), false, None), None => (Vec2::default(), false, None),
@@ -264,7 +264,7 @@ fn draw_widget(
state.primitives.push(primitive_debug_rect( state.primitives.push(primitive_debug_rect(
&boundary, &boundary,
&state.transform_stack.get().transform, &state.transform_stack.get().transform,
Color::new(0.0, 1.0, 1.0, 0.5 * params.alpha), Color::new(0.0, 1.0, 1.0, 0.5),
)); ));
} }
@@ -277,7 +277,7 @@ fn draw_widget(
state.primitives.push(primitive_debug_rect( state.primitives.push(primitive_debug_rect(
&boundary_relative, &boundary_relative,
&state.transform_stack.get().transform, &state.transform_stack.get().transform,
Color::new(1.0, 0.0, 1.0, params.alpha), Color::new(1.0, 0.0, 1.0, 1.0),
)); ));
} }

View File

@@ -1,7 +1,7 @@
use std::{cell::RefCell, rc::Rc}; use std::{cell::RefCell, rc::Rc};
use button::setup_custom_button; use button::setup_custom_button;
use glam::{vec2, Affine2, Vec2}; use glam::{Affine2, Vec2, vec2};
use label::setup_custom_label; use label::setup_custom_label;
use wgui::{ use wgui::{
assets::AssetPath, assets::AssetPath,
@@ -16,14 +16,14 @@ use wgui::{
layout::{Layout, LayoutParams, WidgetID}, layout::{Layout, LayoutParams, WidgetID},
parser::{CustomAttribsInfoOwned, ParserState}, parser::{CustomAttribsInfoOwned, ParserState},
renderer_vk::context::Context as WguiContext, renderer_vk::context::Context as WguiContext,
widget::{label::WidgetLabel, rectangle::WidgetRectangle, EventResult}, widget::{EventResult, label::WidgetLabel, rectangle::WidgetRectangle},
}; };
use crate::{ use crate::{
backend::input::{Haptics, HoverResult, PointerHit, PointerMode}, backend::input::{Haptics, HoverResult, PointerHit, PointerMode},
state::AppState, state::AppState,
subsystem::hid::WheelDelta, subsystem::hid::WheelDelta,
windowing::backend::{ui_transform, FrameMeta, OverlayBackend, RenderResources, ShouldRender}, windowing::backend::{FrameMeta, OverlayBackend, RenderResources, ShouldRender, ui_transform},
}; };
use super::{timer::GuiTimer, timestep::Timestep}; use super::{timer::GuiTimer, timestep::Timestep};
@@ -289,7 +289,7 @@ impl<S: 'static> OverlayBackend for GuiPanel<S> {
globals: &mut globals, globals: &mut globals,
layout: &mut self.layout, layout: &mut self.layout,
debug_draw: false, debug_draw: false,
alpha: self.timestep.alpha, timestep_alpha: self.timestep.alpha,
})?; })?;
self.context.draw( self.context.draw(
&globals.font_system, &globals.font_system,