diff options
author | Joe Wilm <joe@jwilm.com> | 2016-06-04 10:54:33 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-06-04 10:54:33 -0700 |
commit | f944b517fa8bea6eae62eb25fbabe1308d16ed55 (patch) | |
tree | 1173b311bf861aba8eb31eeb3ef4c35f17469f0f /src/main.rs | |
parent | c475c82c69d5d255d6236ad3b2cb6dffe2ed2e8b (diff) | |
download | r-alacritty-f944b517fa8bea6eae62eb25fbabe1308d16ed55.tar.gz r-alacritty-f944b517fa8bea6eae62eb25fbabe1308d16ed55.tar.bz2 r-alacritty-f944b517fa8bea6eae62eb25fbabe1308d16ed55.zip |
Add live-reload for shaders
Recompiling the entire program whenever a shader changes is slow, and it
can interrupt flow. Shader reloads are essentially instantaneous now. If
the new shader fails to compile, no state is changed; the previous
program continues to be used.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs index b6a36330..e5f9e0b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,7 @@ extern crate libc; extern crate glutin; extern crate cgmath; extern crate euclid; +extern crate notify; #[macro_use] mod macros; @@ -61,6 +62,7 @@ struct TermProps { cell_height: f32, sep_y: f32, height: f32, + width: f32, } fn main() { @@ -178,17 +180,18 @@ fn main() { gl::Clear(gl::COLOR_BUFFER_BIT); } + let props = TermProps { + cell_width: cell_width as f32, + sep_x: sep_x as f32, + cell_height: cell_height as f32, + sep_y: sep_y as f32, + height: height as f32, + width: width as f32, + }; + { let _sampler = meter.sampler(); - let props = TermProps { - cell_width: cell_width as f32, - sep_x: sep_x as f32, - cell_height: cell_height as f32, - sep_y: sep_y as f32, - height: height as f32, - }; - // Draw the grid renderer.render_grid(terminal.grid(), &glyph_cache, &props); @@ -199,7 +202,7 @@ fn main() { // Draw render timer let timing = format!("{:.3} usec", meter.average()); let color = Rgb { r: 0xd5, g: 0x4e, b: 0x53 }; - renderer.render_string(&timing[..], &glyph_cache, cell_width, &color); + renderer.render_string(&timing[..], &glyph_cache, &props, &color); window.swap_buffers().unwrap(); } |