|
|
|
@ -7,6 +7,8 @@ extern crate nalgebra as na;
|
|
|
|
use glium::glutin;
|
|
|
|
use glium::glutin;
|
|
|
|
use vis_core::analyzer;
|
|
|
|
use vis_core::analyzer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use glutin::platform::run_return::EventLoopExtRunReturn;
|
|
|
|
|
|
|
|
|
|
|
|
macro_rules! shader_program {
|
|
|
|
macro_rules! shader_program {
|
|
|
|
// {{{
|
|
|
|
// {{{
|
|
|
|
($display:expr, $vert_file:expr, $frag_file:expr) => {{
|
|
|
|
($display:expr, $vert_file:expr, $frag_file:expr) => {{
|
|
|
|
@ -160,15 +162,17 @@ fn main() {
|
|
|
|
// }}}
|
|
|
|
// }}}
|
|
|
|
|
|
|
|
|
|
|
|
// Window Initialization {{{
|
|
|
|
// Window Initialization {{{
|
|
|
|
let mut events_loop = glutin::EventsLoop::new();
|
|
|
|
let mut events_loop = glutin::event_loop::EventLoop::new();
|
|
|
|
let window = glutin::WindowBuilder::new()
|
|
|
|
let window = glutin::window::WindowBuilder::new()
|
|
|
|
.with_dimensions(glutin::dpi::LogicalSize::new(
|
|
|
|
.with_inner_size(glutin::dpi::LogicalSize::new(
|
|
|
|
window_width as f64,
|
|
|
|
window_width as f64,
|
|
|
|
window_height as f64,
|
|
|
|
window_height as f64,
|
|
|
|
))
|
|
|
|
))
|
|
|
|
.with_maximized(true)
|
|
|
|
.with_maximized(true)
|
|
|
|
.with_decorations(false)
|
|
|
|
.with_decorations(false)
|
|
|
|
.with_fullscreen(Some(events_loop.get_primary_monitor()))
|
|
|
|
.with_fullscreen(Some(glutin::window::Fullscreen::Borderless(Some(
|
|
|
|
|
|
|
|
events_loop.primary_monitor().expect("No primary monitor"),
|
|
|
|
|
|
|
|
))))
|
|
|
|
.with_title("Visualizer2 - NoAmbition");
|
|
|
|
.with_title("Visualizer2 - NoAmbition");
|
|
|
|
|
|
|
|
|
|
|
|
let context = glutin::ContextBuilder::new()
|
|
|
|
let context = glutin::ContextBuilder::new()
|
|
|
|
@ -343,10 +347,10 @@ fn main() {
|
|
|
|
// Image {{{
|
|
|
|
// Image {{{
|
|
|
|
let image = image::load(
|
|
|
|
let image = image::load(
|
|
|
|
std::io::Cursor::new(&include_bytes!("logo.png")[..]),
|
|
|
|
std::io::Cursor::new(&include_bytes!("logo.png")[..]),
|
|
|
|
image::PNG,
|
|
|
|
image::ImageFormat::Png,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.unwrap()
|
|
|
|
.unwrap()
|
|
|
|
.to_rgba();
|
|
|
|
.to_rgba8();
|
|
|
|
let image_dims = image.dimensions();
|
|
|
|
let image_dims = image.dimensions();
|
|
|
|
let image = glium::texture::RawImage2d::from_raw_rgba_reversed(&image.into_raw(), image_dims);
|
|
|
|
let image = glium::texture::RawImage2d::from_raw_rgba_reversed(&image.into_raw(), image_dims);
|
|
|
|
let c3_texture = glium::texture::CompressedSrgbTexture2d::new(&display, image).unwrap();
|
|
|
|
let c3_texture = glium::texture::CompressedSrgbTexture2d::new(&display, image).unwrap();
|
|
|
|
@ -618,13 +622,14 @@ fn main() {
|
|
|
|
|
|
|
|
|
|
|
|
// Events {{{
|
|
|
|
// Events {{{
|
|
|
|
let mut closed = false;
|
|
|
|
let mut closed = false;
|
|
|
|
events_loop.poll_events(|ev| match ev {
|
|
|
|
events_loop.run_return(|ev, _, control_flow| {
|
|
|
|
glutin::Event::WindowEvent { event, .. } => match event {
|
|
|
|
match ev {
|
|
|
|
glutin::WindowEvent::CloseRequested => closed = true,
|
|
|
|
glutin::event::Event::WindowEvent { event, .. } => match event {
|
|
|
|
glutin::WindowEvent::KeyboardInput {
|
|
|
|
glutin::event::WindowEvent::CloseRequested => closed = true,
|
|
|
|
|
|
|
|
glutin::event::WindowEvent::KeyboardInput {
|
|
|
|
input:
|
|
|
|
input:
|
|
|
|
glutin::KeyboardInput {
|
|
|
|
glutin::event::KeyboardInput {
|
|
|
|
virtual_keycode: Some(glutin::VirtualKeyCode::Escape),
|
|
|
|
virtual_keycode: Some(glutin::event::VirtualKeyCode::Escape),
|
|
|
|
..
|
|
|
|
..
|
|
|
|
},
|
|
|
|
},
|
|
|
|
..
|
|
|
|
..
|
|
|
|
@ -632,6 +637,8 @@ fn main() {
|
|
|
|
_ => (),
|
|
|
|
_ => (),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_ => (),
|
|
|
|
_ => (),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
*control_flow = glutin::event_loop::ControlFlow::Exit;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if closed {
|
|
|
|
if closed {
|
|
|
|
break 'main;
|
|
|
|
break 'main;
|
|
|
|
|