rustã§å¤ãªãããªã¹ãæ¸ãã
Rust1.0ãªãªã¼ã¹ãã¼ãã£ã¼ã§ã絶対ã«Pistonã使ã£ã¦ã¿ããï¼ï¼ï¼ã¨æ±ºå¿ãã¦ããæ©3ã¶æããã£ã¨Pistonã触ã£ã¦ã¿ã¾ããã
Piston触ã£ã¦ã¿ããã㪠#rustlang
— ããµ (@gifnksm) 2015, 5æ 16
ãã¥ã¼ããªã¢ã«ç·¨
Rustãªãªã¼ã¹ãã¼ãã£ã¼ã§LTãããã¦ãããhttp://cakecatz.hatenadiary.com/entry/2015/05/17/221004 ããã®è¨äºãåèã«ãPistonã®ãã¥ã¼ããªã¢ã«ãã触ã£ã¦ã¿ã¾ããããããã¼ã¸ã§ã³ãæã«æå®ããã« (=ææ°çã®pistoné¢é£ã©ã¤ãã©ãªã使ã£ã¦) å®è¡ãããã¨ããã¨ããã¥ã¼ããªã¢ã«ã®è¨æ³ã®ã¾ã¾ã§ã¯åãããã¾ãã©ã¤ãã©ãªã®æ§æèªä½ã大ããå¤ãã£ã¦ãã¾ã£ã¦ããããã ã£ããããpiston_window
ã¨ããã¦ã¼ãã£ãªã㣠(?) ã©ã¤ãã©ãªã使ã£ã¦ã¿ã¾ãããpiston_window
ã使ãã¨ããã¥ã¼ããªã¢ã«ã®ã½ã¼ã¹ã³ã¼ã ã¨ã»ã¨ãã©åããããªä½¿ãæ¹ãã§ãã¾ããã以ä¸ã¯â ãé«éã§å転ãããããã°ã©ã ã§ããå®è¡ããã¨ã¡ãã£ã¨æ¥½ããã
extern crate piston_window; use piston_window::{PistonWindow, WindowSettings, UpdateEvent, RenderEvent, Transformed, rectangle}; const GREEN: [f32; 4] = [0.5, 1.0, 0.5, 1.0]; const PURPLE: [f32; 4] = [0.5, 0.5, 1.0, 1.0]; fn main() { let window: PistonWindow = WindowSettings::new("spinning-square", [200, 200]) .exit_on_esc(true) .build() .unwrap(); let mut rot = 0.0; for e in window { if let Some(r) = e.render_args() { let square = rectangle::square(-25.0, -25.0, 50.0); e.draw_2d(|c, g| { piston_window::clear(GREEN, g); let (x, y) = ((r.draw_width / 4) as f64, (r.draw_height / 4) as f64); let transform = c.transform .trans(x, y) .rot_rad(rot); rectangle(PURPLE, square, transform, g); }); } if let Some(u) = e.update_args() { rot += 20.0 * u.dt; } } }
ãããªã¹ç·¨
ãã£ãããRustã§ã°ã©ãã£ã«ã«ãªããã°ã©ãã³ã°ããããã ãï¼ï¼ï¼ã¨ããæ°æã¡ã«ãªã£ãã®ã§ããæ軽ãªç·´ç¿ããã°ã©ã ã¨ãã¦å²ã¨ããããããã¡ãªãããªã¹ãä½ã£ã¦ã¿ã¾ããããã ããå ã® cakecatz ããã®LTã§ããããªã¹ãä½ããã¦ããã®ã§ãã¡ãã£ã¨ã²ãããããã¦ãæ®éã®ãããªã¹ã§ã¯ãªãä¸äººç§°è¦ç¹ã®ãããªã¹ãä½æãã¦ã¿ã¾ããã
ä¸äººç§°è¦ç¹ãããªã¹å¤§ä½ã§ãããã©ãæ
£ããã¨æ®éã®ãããªã¹ã¨ã»ã¨ãã©åãééã§æä½ã§ãããªããã pic.twitter.com/ClwaLWJ4M0
— ããµ (@gifnksm) 2015, 8æ 11
é常ã®ãããªã¹ã§ã¯ãåºå®ãããã¹ãã¼ã¸ã«å¯¾ãã¦ä¸ãããããªãã (ãããã¯) ãè½ã¡ã¦ãã¾ããä¸äººç§°ãããªã¹ã§ã¯ããããªããã¯åãããã¹ãã¼ã¸ãåãããã«è¦ãã¾ããæä½æ¹æ³ã¯ä»¥ä¸ã®éãããæãããã°ãæ¯éä¸ã®GitHubã®ãªã³ã¯ãããã¦ã³ãã¼ããã¦ãã¬ã¤ãã¦ã¿ã¦ãã ããï¼
â
,w
,k
: ãããªããããè¦ã¦åæ¹ã«ç§»åâ
,s
,j
: ãããªããããè¦ã¦å¾æ¹ã«ç§»åâ
,d
,l
: å³æ¹åã«æåâ
,a
,h
: å·¦æ¹åã«æåspace
: éåæ¹åã¸ã®è½ä¸ãå é
ä¸äººç§°ãããªã¹ã«ã piston_window
ã使ã£ã¦ãã¾ããpistonã ããé£ããã¨ããããããã¨ã¯ç¹ã«ãªããéã«Rustã®enum
ã使ããããã¦ããããé¢ã®æ¹ãå¤ãã£ãããªãã¨æãã¾ããããå°ãè¤éãªãã¨ããããã¨ããã¨ããããã¨é£ãããã¨ãããããããã¾ããããä»ã®ã¨ããä¸æºã¯ç¹ã«ãªãã§ããã
ãªããä¸äººç§°ãããªã¹ã«ã¯å è¡ç 究ãããã¾ãããã£ã¡ã®æ¹ãã°ã©ãã£ãã¯ã¯åã£ã¦ãã¦è¯ãæãã§ããããã¾ã§ã§ããããã«ãªãã¨ãæ´ã«æ¥½ãããªãããã§ããã