sdl_context: sdl2::Sdl,
vsystem: sdl2::VideoSubsystem,
asystem: sdl2::AudioSubsystem,
+ xpos: Option<i32>,
+ ypos: Option<i32>,
acontrol: AudioControl,
vcontrol: VideoControl,
let vcontrol = VideoControl::new(None, 0, 0, 0, 0);
Self {
sdl_context, asystem, vsystem,
+ xpos: None,
+ ypos: None,
acontrol, vcontrol,
} else {
"NihAV player".to_owned()
};
- let window = self.vsystem.window(&wname, width as u32, height as u32)
- .position_centered().build().unwrap();
+ let mut builder = self.vsystem.window(&wname, width as u32, height as u32);
+ let window = if let (Some(xpos), Some(ypos)) = (self.xpos, self.ypos) {
+ builder.position(xpos, ypos).build().unwrap()
+ } else {
+ builder.position_centered().build().unwrap()
+ };
let mut canvas = window.into_canvas().build().unwrap();
let texture_creator = canvas.texture_creator();
let mut disp_q = DispQueue::new(&texture_creator, width, height, if self.has_video { FRAME_QUEUE_LEN } else { 0 });
thread::sleep(Duration::from_millis(20));
}
}
+ let (xpos, ypos) = canvas.into_window().position();
+ self.xpos = Some(xpos);
+ self.ypos = Some(ypos);
println!();
std::mem::swap(&mut self.vcontrol, &mut new_vcontrol);
new_vcontrol.finish();