Draft 01/27/2024

This is a draft of the codebase on the date reflected above.
This commit is contained in:
2024-01-27 15:58:41 -05:00
parent b582bdd1d8
commit 44db7751e9
7 changed files with 172 additions and 0 deletions

39
vash_caster/src/lib.rs Normal file
View File

@@ -0,0 +1,39 @@
extern crate rand;
extern crate sdl2;
mod caster;
use caster::Caster;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use std::error::Error;
use std::time::Duration;
pub fn run() -> Result<(), Box<dyn Error>> {
let sdl_context = sdl2::init()?;
let video_subsystem = sdl_context.video()?;
let mut caster = Caster::init(&video_subsystem, "Vash Caster", 800, 600)?;
let mut event_pump = sdl_context.event_pump()?;
'running: loop {
for event in event_pump.poll_iter() {
match event {
Event::Quit { .. }
| Event::KeyDown {
keycode: Some(Keycode::Escape),
..
} => break 'running,
_ => {}
}
}
caster.update()?;
::std::thread::sleep(Duration::new(0, 1_000_000_000u32 / 144));
}
Ok(())
}