/// <summary> /// Constructor /// </summary> /// <param name="content">Access to resources</param> /// <param name="recorder">Records drum strokes</param> /// <param name="background">Background image</param> /// <param name="width">Width of the screen</param> /// <param name="height">Height of the screen</param> public DrummingView(ContentManager content, Recorder recorder, Texture2D background, int width, int height) : base(width, height) { this.background = background; this.recorder = recorder; recorder.TapeEnded += new EventHandler(Recorder_TapeEnded); // Create buttons buttons = new List<Button>(); infoButton = new Button(content.Load<Texture2D>("Images/Buttons/info"), content.Load<Texture2D>("Images/Buttons/info_pressed")); viewButton = new Button(content.Load<Texture2D>("Images/Buttons/pads"), content.Load<Texture2D>("Images/Buttons/pads_pressed")); recordButton = new AnimatedToggleButton(content.Load<Texture2D>("Images/Buttons/record"), content.Load<Texture2D>("Images/Buttons/record_pressed"), content.Load<Texture2D>("Images/Buttons/recording"), 18, 18); playButton = new Button(content.Load<Texture2D>("Images/Buttons/play"), content.Load<Texture2D>("Images/Buttons/play_pressed")); stopButton = new Button(content.Load<Texture2D>("Images/Buttons/stop"), content.Load<Texture2D>("Images/Buttons/stop_pressed")); exitButton = new Button(content.Load<Texture2D>("Images/Buttons/exit"), content.Load<Texture2D>("Images/Buttons/exit_pressed")); // Attach event handlers infoButton.Clicked += new EventHandler(InfoButton_Clicked); viewButton.Clicked += new EventHandler(viewButton_Clicked); recordButton.Clicked += new EventHandler(RecordButton_Clicked); playButton.Clicked += new EventHandler(PlayButton_Clicked); stopButton.Clicked += new EventHandler(StopButton_Clicked); exitButton.Clicked += new EventHandler(ExitButton_Clicked); playButton.Disable(); stopButton.Visible = false; // Add buttons to a list for easy looping buttons.Add(infoButton); buttons.Add(viewButton); buttons.Add(recordButton); buttons.Add(playButton); buttons.Add(stopButton); buttons.Add(exitButton); info = new InfoOverlay(new Rectangle(0, 0, width, height)); }
/// <summary> /// Constructor /// </summary> /// <param name="content">Access to resources</param> /// <param name="recorder">Records drum strokes</param> /// <param name="background">Background image</param> /// <param name="width">Width of the screen</param> /// <param name="height">Height of the screen</param> public DrummingView(ContentManager content, Recorder recorder, Texture2D background, int width, int height) : base(width, height) { this.background = background; this.recorder = recorder; recorder.TapeEnded += new EventHandler(Recorder_TapeEnded); // Create buttons buttons = new List <Button>(); infoButton = new Button(content.Load <Texture2D>("Images/Buttons/info"), content.Load <Texture2D>("Images/Buttons/info_pressed")); viewButton = new Button(content.Load <Texture2D>("Images/Buttons/pads"), content.Load <Texture2D>("Images/Buttons/pads_pressed")); recordButton = new AnimatedToggleButton(content.Load <Texture2D>("Images/Buttons/record"), content.Load <Texture2D>("Images/Buttons/record_pressed"), content.Load <Texture2D>("Images/Buttons/recording"), 18, 18); playButton = new Button(content.Load <Texture2D>("Images/Buttons/play"), content.Load <Texture2D>("Images/Buttons/play_pressed")); stopButton = new Button(content.Load <Texture2D>("Images/Buttons/stop"), content.Load <Texture2D>("Images/Buttons/stop_pressed")); exitButton = new Button(content.Load <Texture2D>("Images/Buttons/exit"), content.Load <Texture2D>("Images/Buttons/exit_pressed")); // Attach event handlers infoButton.Clicked += new EventHandler(InfoButton_Clicked); viewButton.Clicked += new EventHandler(viewButton_Clicked); recordButton.Clicked += new EventHandler(RecordButton_Clicked); playButton.Clicked += new EventHandler(PlayButton_Clicked); stopButton.Clicked += new EventHandler(StopButton_Clicked); exitButton.Clicked += new EventHandler(ExitButton_Clicked); playButton.Disable(); stopButton.Visible = false; // Add buttons to a list for easy looping buttons.Add(infoButton); buttons.Add(viewButton); buttons.Add(recordButton); buttons.Add(playButton); buttons.Add(stopButton); buttons.Add(exitButton); info = new InfoOverlay(new Rectangle(0, 0, width, height)); }