Added ExtensionContext #26

This commit is contained in:
2025-08-04 04:45:55 -05:00
parent 14602f95c8
commit 48397c06fa
5 changed files with 68 additions and 22 deletions
+3 -3
View File
@@ -5,7 +5,6 @@ use crate::{
extensions::Extension,
style::{Position, Transform},
widget::Widget,
Screen,
};
pub struct VelocityExtension;
@@ -43,12 +42,13 @@ impl VelocityExtension {
}
impl Extension for VelocityExtension {
fn init(&mut self, screen: Arc<Screen>) {
fn init(&mut self, ctx: &super::ExtensionContext) {
let ctx = ctx.clone();
std::thread::spawn({
move || {
let mut tick = 0;
loop {
for widget in screen.widgets.lock().unwrap().iter() {
for widget in ctx.get_widgets().iter() {
Self::apply_velocity_xy(tick, widget);
}
if tick > 1000 {