Browse Source

resizing window works

Johann Woelper 6 years ago
parent
commit
9d202f5e47
1 changed files with 10 additions and 15 deletions
  1. 10 15
      src/main.rs

+ 10 - 15
src/main.rs

@@ -10,6 +10,8 @@ use piston_window::*;
 // use graphics::{ Context, Graphics };
 
 fn main() {
+    let font = include_bytes!("FiraSans-Regular.ttf");
+
     let matches = App::new("Oculante")
         .arg(
             Arg::with_name("INPUT")
@@ -28,6 +30,7 @@ fn main() {
     let mut window: PistonWindow = WindowSettings::new("Oculante", [1000, 800])
         .exit_on_esc(true)
         .graphics_api(opengl)
+        .samples(4)
         .build()
         .unwrap();
 
@@ -50,16 +53,12 @@ fn main() {
             let mut reset = false;
 
 
-            //let ref font = "FiraSans-Regular.ttf";
-    
-            //let mut glyphs = Glyphs::new(font, window.create_texture_context(), TextureSettings::new()).unwrap();
 
-            let font = include_bytes!("FiraSans-Regular.ttf");
             let mut glyphs = Glyphs::from_bytes(font, window.create_texture_context(), TextureSettings::new()).unwrap();
 
-            // let maybe_glyphs = window.load_font("OpenSans-Regular.ttf");
+         
   
-            while let Some(e) = events.next(&mut window) {
+            while let Some(e) = window.next() {
                 
                 if let Some(Button::Mouse(_)) = e.press_args() {drag = true;}
                 if let Some(Button::Mouse(_)) = e.release_args() {drag = false;}
@@ -74,7 +73,7 @@ fn main() {
                         scale += 0.2;
                     } else {
                         scale -= 0.2;
-                        if scale < 0.0 {scale = 0.0;}
+                        if scale < 0.1 {scale = 0.1;}
                     }
                 });
                 e.mouse_relative(|d| {
@@ -83,9 +82,9 @@ fn main() {
                         offset.1 += d[1];
                     }
                 });
-                e.resize(|args| {
-                    println!("Resized '{}, {}'", args.window_size[0], args.window_size[1])
-                });
+                // e.resize(|args| {
+                //     println!("Resized '{}, {}'", args.window_size[0], args.window_size[1])
+                // });
     
                 window.draw_2d(&e, |c, gfx, device| {
                     clear([0.2; 4], gfx);
@@ -107,14 +106,10 @@ fn main() {
                     ).unwrap();
                     glyphs.factory.encoder.flush(device);
 
-        
-
                 });
 
-                    
-
        
-
+    
 
                 // if let Some(e) = window.next() {
                 //     window.draw_2d(&e, |c, gfx, _| {