コード例 #1
0
ファイル: PercussionMenu.cs プロジェクト: nagyist/drumkit-wp
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="closeImg">Image for closing button</param>
 public PercussionMenu(Texture2D closeImg)
 {
     Buttons = new List<Button>();
     show = new TimerCallback(ShowCallback);
     hide = new TimerCallback(HideCallback);
     close = new Button(closeImg, closeImg);
     close.Clicked += new EventHandler(Close_Clicked);
     Visible = false;
 }
コード例 #2
0
ファイル: DrummingView.cs プロジェクト: nagyist/drumkit-wp
        /// <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));
        }
コード例 #3
0
ファイル: PercussionMenu.cs プロジェクト: nagyist/drumkit-wp
 /// <summary>
 /// Adds a button to the menu
 /// </summary>        
 public void Add(Button button)
 {
     button.Opacity = 0.0f;
     Buttons.Add(button);
     angle = 360 / Buttons.Count * Math.PI / 180;
 }