예제 #1
0
        private void KeyUp(object source, Interface.LaunchpadKeyEventArgs e)
        {
            int x, y;

            x = e.GetX(); y = e.GetY();
            var pad = Pads[controller.GetCoordFromButton(x, y)];

            pad.MapperPressed = false;
        }
예제 #2
0
        private void LaunchpadKeyDownHandler(object source, Interface.LaunchpadKeyEventArgs e)
        {
            int x = e.GetX();
            int y = e.GetY();

            Console.WriteLine("Down {0} {1}", x, y);

            VirtualKeyCode key = GetSelectedKey(x, y);

            Thread t = new Thread(() => HandleKeyDownPressThread(key));

            t.Start();
        }
예제 #3
0
        public void onChangeDir(object sender, Interface.LaunchpadKeyEventArgs e)
        {
            if (loc)
            {
                return;
            }
            Pos pos = new Pos(e.GetX(), e.GetY());

            if ((Ldir == Direction.UP && getDirection(pos) == Direction.DOWN) || (Ldir == Direction.DOWN && getDirection(pos) == Direction.UP) || (Ldir == Direction.LEFT && getDirection(pos) == Direction.RIGHT) || (Ldir == Direction.RIGHT && getDirection(pos) == Direction.LEFT))
            {
                return;
            }
            Sdir = getDirection(pos);
        }
예제 #4
0
        private void LaunchpadKeyUpHandler(object source, Interface.LaunchpadKeyEventArgs e)
        {
            int x = e.GetX();
            int y = e.GetY();

            Console.WriteLine("Up {0} {1}", x, y);

            if (isListeningForKeys)
            {
                HandleNewKey(x, y);
            }
            else
            {
                VirtualKeyCode key = GetSelectedKey(x, y);

                Thread t = new Thread(() => HandleKeyUpPressThread(key));
                t.Start();
            }
        }
예제 #5
0
        private void KeyDown(object source, Interface.LaunchpadKeyEventArgs e)
        {
            int x, y;

            x = e.GetX(); y = e.GetY();
            var coords = controller.GetCoordFromButton(x, y);
            var pad    = Pads[coords];

            pad.MapperPressed = true;
            if (CurrentSong != null)
            {
                var currTime     = Convert.ToInt64(AudioFile.CurrentTime.TotalMilliseconds);
                var existingBeat = CurrentBeats.Where(b => (b.HitTime <= currTime + BEAT_DUR) && (b.HitTime >= currTime - BEAT_DUR) && b.x == coords.Item1 && b.y == coords.Item2).FirstOrDefault();
                if (existingBeat == null)
                {
                    //check for debounce, don't accidentally double up on beats.
                    var newBeat = new Beat(currTime, coords.Item1, coords.Item2);
                    CurrentBeats.Add(newBeat);
                }
            }
        }