mouse stuff

This commit is contained in:
2026-02-12 22:59:27 +01:00
parent 3db5b5e094
commit 37d834d80b
6 changed files with 357 additions and 40 deletions

View File

@@ -1,3 +1,6 @@
pub mod mouse;
mod os;
use g13_driver::{G13, G13_LCD_COLUMNS, G13_LCD_ROWS};
use mlua::{Error, ExternalResult, Lua};
use std::{
@@ -10,14 +13,18 @@ use std::{
time::{Duration, Instant},
};
use crate::os::G13Os;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let running = Arc::new(AtomicBool::new(true));
let _running = running.clone();
ctrlc::set_handler(move || _running.store(false, Ordering::SeqCst))
.expect("Error setting Ctrl-C handler");
let g13 = G13::new()?;
let os = G13Os::new();
os.run();
/*
let lua = Lua::new();
let globals = lua.globals();
let g13_table = lua.create_table()?;
@@ -172,11 +179,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
joy.set("deadzone", 40)?;
globals.set("joy", joy)?;
// load all files from dir `./scripts` for now, user configurable later or ~/.config/g13-os/*.<lua[u]>
// load all files from dir `./scripts` for now, user configurable later or ~/.config/g13-os/\*.<lua>
// for now, just main.luau
let main = fs::read_to_string("./scripts/main.luau")?;
let main = fs::read_to_string("./scripts/main.lua")?;
lua.load(main).set_name("main.luau").exec()?;
lua.load(main).set_name("main.lua").exec()?;
if lua.load("setup ~= nil").eval()? {
lua.load("setup()").exec()?;
@@ -239,6 +246,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
running.store(false, Ordering::SeqCst);
*/
Ok(())
}