mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
eframe app creation refactor (#1363)
* Change how eframe apps are created * eframe: re-export epi::* so users don't need to care about what epi is
This commit is contained in:
@@ -2,42 +2,6 @@
|
||||
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||
|
||||
fn create_display(
|
||||
event_loop: &glutin::event_loop::EventLoop<()>,
|
||||
) -> (
|
||||
glutin::WindowedContext<glutin::PossiblyCurrent>,
|
||||
glow::Context,
|
||||
) {
|
||||
let window_builder = glutin::window::WindowBuilder::new()
|
||||
.with_resizable(true)
|
||||
.with_inner_size(glutin::dpi::LogicalSize {
|
||||
width: 800.0,
|
||||
height: 600.0,
|
||||
})
|
||||
.with_title("egui_glow example");
|
||||
|
||||
let gl_window = unsafe {
|
||||
glutin::ContextBuilder::new()
|
||||
.with_depth_buffer(0)
|
||||
.with_srgb(true)
|
||||
.with_stencil_buffer(0)
|
||||
.with_vsync(true)
|
||||
.build_windowed(window_builder, event_loop)
|
||||
.unwrap()
|
||||
.make_current()
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
let gl = unsafe { glow::Context::from_loader_function(|s| gl_window.get_proc_address(s)) };
|
||||
|
||||
unsafe {
|
||||
use glow::HasContext as _;
|
||||
gl.enable(glow::FRAMEBUFFER_SRGB);
|
||||
}
|
||||
|
||||
(gl_window, gl)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut clear_color = [0.1, 0.1, 0.1];
|
||||
|
||||
@@ -116,3 +80,39 @@ fn main() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn create_display(
|
||||
event_loop: &glutin::event_loop::EventLoop<()>,
|
||||
) -> (
|
||||
glutin::WindowedContext<glutin::PossiblyCurrent>,
|
||||
glow::Context,
|
||||
) {
|
||||
let window_builder = glutin::window::WindowBuilder::new()
|
||||
.with_resizable(true)
|
||||
.with_inner_size(glutin::dpi::LogicalSize {
|
||||
width: 800.0,
|
||||
height: 600.0,
|
||||
})
|
||||
.with_title("egui_glow example");
|
||||
|
||||
let gl_window = unsafe {
|
||||
glutin::ContextBuilder::new()
|
||||
.with_depth_buffer(0)
|
||||
.with_srgb(true)
|
||||
.with_stencil_buffer(0)
|
||||
.with_vsync(true)
|
||||
.build_windowed(window_builder, event_loop)
|
||||
.unwrap()
|
||||
.make_current()
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
let gl = unsafe { glow::Context::from_loader_function(|s| gl_window.get_proc_address(s)) };
|
||||
|
||||
unsafe {
|
||||
use glow::HasContext as _;
|
||||
gl.enable(glow::FRAMEBUFFER_SRGB);
|
||||
}
|
||||
|
||||
(gl_window, gl)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user