comparison src/th06/anm0_vm.rs @ 701:b6c351ca0a35

anm0: return the nom IResult and the list of Anm0s.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 23 Aug 2019 15:34:03 +0200
parents 598f3125cbac
children 6d4802abe134
comparison
equal deleted inserted replaced
700:ccb739c5b66c 701:b6c351ca0a35
442 fn anm_runner() { 442 fn anm_runner() {
443 let file = File::open("EoSD/CM/player01.anm").unwrap(); 443 let file = File::open("EoSD/CM/player01.anm").unwrap();
444 let mut file = io::BufReader::new(file); 444 let mut file = io::BufReader::new(file);
445 let mut buf = vec![]; 445 let mut buf = vec![];
446 file.read_to_end(&mut buf).unwrap(); 446 file.read_to_end(&mut buf).unwrap();
447 let anm0 = Anm0::from_slice(&buf).unwrap(); 447 let (_, mut anms) = Anm0::from_slice(&buf).unwrap();
448 let anm0 = anms.pop().unwrap();
448 assert_eq!(anm0.size, (256, 256)); 449 assert_eq!(anm0.size, (256, 256));
449 assert_eq!(anm0.format, 5); 450 assert_eq!(anm0.format, 5);
450 let sprite = Rc::new(RefCell::new(Sprite::new())); 451 let sprite = Rc::new(RefCell::new(Sprite::new()));
451 let prng = Rc::new(RefCell::new(Prng::new(0))); 452 let prng = Rc::new(RefCell::new(Prng::new(0)));
452 let mut anm_runner = AnmRunner::new(&anm0, 1, sprite.clone(), Rc::downgrade(&prng), 0); 453 let mut anm_runner = AnmRunner::new(&anm0, 1, sprite.clone(), Rc::downgrade(&prng), 0);