use std::{env, path};
use ggez::*;
use mooeye::scene_manager::SceneManager;
pub fn setup_and_run() -> GameResult{
let resource_dir = if let Ok(manifest_dir) = env::var("CARGO_MANIFEST_DIR") {
let mut path = path::PathBuf::from(manifest_dir);
path.push("resources");
path
} else {
path::PathBuf::from("./resources")
};
let (mut ctx, event_loop): (ggez::context::Context, ggez::event::EventLoop<()>) =
ContextBuilder::new("Mooeye Examples", "Linus Mußmächer")
.add_resource_path(resource_dir)
.window_setup(conf::WindowSetup::default().title("Mooeye Examples"))
.window_mode(
conf::WindowMode::default()
.fullscreen_type(conf::FullscreenType::Windowed)
.resizable(true)
.dimensions(800., 600.),
)
.build()?;
ctx.gfx.add_font(
"Bahnschrift",
graphics::FontData::from_path(&ctx, "/bahnschrift.ttf")?,
);
let start_scene = super::g_selector_scene::SelectorScene::new(&ctx)?;
SceneManager::new_and_run(event_loop, ctx, start_scene)
}