pub mod audio;
pub mod console;
pub mod io;
pub mod prelude;
pub mod time;
pub mod window;
pub mod collections;
pub mod decoders;
mod parsers;
mod slice;
mod mem;
pub mod gui;
mod iterators;
pub mod math;
pub mod ogl;
pub mod text_writer;
#[cfg(feature="net")]
pub mod net;
#[cfg(feature = "extras")]
pub mod extras;
use glow::Context;
use std::{cell::RefCell, ops::Deref, rc::Rc, sync::Arc};
pub type GlowGL = Arc<Box<Context>>;
pub struct FlufflState<T> {
inner: Rc<RefCell<T>>,
}
impl<T> Clone for FlufflState<T> {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
}
}
}
impl<T> FlufflState<T> {
pub fn new(state: T) -> Self {
Self {
inner: Rc::new(RefCell::new(state)),
}
}
}
impl<T> Deref for FlufflState<T> {
type Target = Rc<RefCell<T>>;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
#[derive(Debug)]
pub enum FlufflError {
GenericError(String),
FromUtf8ParseError(String),
WindowInitError(String),
IOError(String),
}
impl From<std::io::Error> for FlufflError {
fn from(err: std::io::Error) -> Self {
FlufflError::IOError(err.to_string())
}
}
impl From<std::string::FromUtf8Error> for FlufflError {
fn from(err: std::string::FromUtf8Error) -> Self {
Self::FromUtf8ParseError(err.to_string())
}
}