Open bofh69 opened 4 years ago
I'm not sure I recommend it - and I'm going to take a long, hard look at configuration - but this works:
fn main() {
// RLTK provides a simple initializer for a simple 8x8 font window of a given number of
// characters. Since that's all we need here, we'll use it!
// We're specifying that we want an 80x50 console, with a title, and a relative path
// to where it can find the font files and shader files.
// These would normally be "resources" rather than "../../resources" - but to make it
// work in the repo without duplicating, they are a relative path.
let context = Rltk::init_simple8x8(80, 50, "Hello RLTK World", "resources");
// Now we create an empty state object.
let gs: State = State {
y: 1,
going_down: true,
};
let mh = context.backend.platform.context_wrapper.as_ref().unwrap().el.available_monitors().nth(0).unwrap();
context.backend.platform.context_wrapper.as_ref().unwrap().wc.window().set_fullscreen(Some(glutin::window::Fullscreen::Borderless(mh)));
// Call into RLTK to run the main loop. This handles rendering, and calls back into State's tick
// function every cycle. The box is needed to work around lifetime handling.
rltk::main_loop(context, gs);
}
Thanks! That worked fine before main_loop is called. After, unwrap() fails when getting the context_wrapper.
I tried using context.backend.platform.context_wrapper.unwrap().wc.window().set_fullscreen(...) for the OpenGL version, but then I have a partial borrow out of the context, preventing me from calling main_loop later.
Is there a way to do this?