use std::sync::{Arc, Mutex};
use crate::{audio::Audio, events::{KeyboardEvent, MouseClickEvent, MouseMotionEvent, MouseWheelEvent, WindowEventHandler}, graphics::{Graphics, HasWindow}, resources::ResourceManager};
pub mod audio;
pub mod events;
pub mod graphics;
pub mod resources;
mod tests;
unsafe impl Send for Window {}
unsafe impl Sync for Window {}
pub struct Window {
pub graphics: Graphics,
pub audio: Audio,
pub resource_manager: Arc<Mutex<ResourceManager>>,
}
impl Window {
pub fn new(graphics: Graphics, resource_manager: Arc<Mutex<ResourceManager>>) -> Window {
Window {
graphics,
audio: Audio::new(),
resource_manager,
}
}
}
impl HasWindow for Window {
fn window_mut(&mut self) -> &mut Self {
self
}
}
pub struct CoreHandler;
#[async_trait::async_trait]
impl WindowEventHandler for CoreHandler {
fn update(&self, _window: &mut Window) -> anyhow::Result<()> {
Ok(())
}
fn draw(&mut self, _window: &mut Window) -> anyhow::Result<()> {
Ok(())
}
fn key_down_event(&self, _window: &mut Window, _event: KeyboardEvent) -> anyhow::Result<()> {
Ok(())
}
fn key_up_event(&self, _window: &mut Window, _event: KeyboardEvent) -> anyhow::Result<()> {
Ok(())
}
fn mouse_motion_event(
&self,
_window: &mut Window,
_event: MouseMotionEvent,
) -> anyhow::Result<()> {
Ok(())
}
fn mouse_button_down_event(
&self,
_window: &mut Window,
_event: MouseClickEvent,
) -> anyhow::Result<()> {
Ok(())
}
fn mouse_button_up_event(
&self,
_window: &mut Window,
_event: MouseClickEvent,
) -> anyhow::Result<()> {
Ok(())
}
fn mouse_wheel_event(
&self,
_window: &mut Window,
_event: MouseWheelEvent,
) -> anyhow::Result<()> {
Ok(())
}
}