1786006835

This commit is contained in:
2026-08-06 11:00:35 +02:00
parent bd63754773
commit b03e408706
2 changed files with 32 additions and 9 deletions

View File

@@ -1,18 +1,39 @@
mod rgba;
mod trekstor;
use embedded_graphics::{prelude::*, primitives::*};
use evdev::KeyCode;
use crate::trekstor::Trekstor;
fn main() {
let mut trekstor = Trekstor::new(60);
struct AppState {
x: i32,
y: i32,
}
trekstor.update(|ctx| {
fn main() {
let app_state = AppState { x: 0, y: 0 };
let mut trekstor = Trekstor::new(60, app_state);
trekstor.update(|ctx, state| {
// retuyrningf false will exit loop
if ctx.input.is_just_released(KeyCode::BTN_TOUCH) {
println!("Released {}x{}", ctx.input.x, ctx.input.y);
state.x = ctx.input.x;
state.y = ctx.input.y;
}
ctx.screen.clear((0, 0, 0, 255).into()).ok();
Rectangle::new(
Point::new(state.x, state.y),
Size::new(ctx.screen.width(), 1),
)
.into_styled(PrimitiveStyle::with_fill((255, 0, 0, 255).into()))
.draw(&mut ctx.screen)
.ok();
true
});