#![recursion_limit = "256"]
mod frames;
mod gpu;
mod images;
mod ime;
mod input;
mod keys;
mod os;
mod pacing;
mod platform;
mod pointer;
mod surface;
mod text_input;
mod view;
mod window;
mod windows;
use inset_embedder::{EmbedderClient, PlatformRef};
pub use images::{DecodeExecution, create_image_loader};
pub use platform::WinitPlatform;
#[derive(Clone, Debug, PartialEq)]
pub struct ImplicitViewConfig {
pub title: String,
pub logical_size: [f64; 2],
}
impl Default for ImplicitViewConfig {
fn default() -> ImplicitViewConfig {
ImplicitViewConfig {
title: "Inset".to_owned(),
logical_size: [900.0, 600.0],
}
}
}
pub struct WinitEmbedder {
pub implicit_view: Option<ImplicitViewConfig>,
}
impl Default for WinitEmbedder {
fn default() -> WinitEmbedder {
WinitEmbedder {
implicit_view: Some(ImplicitViewConfig::default()),
}
}
}
impl WinitEmbedder {
pub fn run<C: EmbedderClient + 'static>(self, start: impl FnOnce(PlatformRef) -> C + 'static) {
window::run(self, start, None);
}
pub fn run_with_image_loader<C: EmbedderClient + 'static>(
self,
make_loader: impl FnOnce(valo::ImageContext) -> valo_codec::ImageLoader + 'static,
start: impl FnOnce(PlatformRef) -> C + 'static,
) {
window::run(self, start, Some(Box::new(make_loader)));
}
}