Ejemplo n.º 1
0
        private static void InterpretKeyPress()
        {
            Direction moveViewportDir = Direction.None;

            int key = NCurses.GetChar();

            switch (key)
            {
            case CursesKey.ESC:
                _exit = true;
                break;

            case ' ':
                _routine.NextTimeUnit();
                _dirty = true;
                break;

            // Backspace can be 3 different key-codes, depending on platform
            case CursesKey.BACKSPACE:
            case '\b':
            case 127:
                _routine.LastTimeUnit();
                _dirty = true;
                break;

            case CursesKey.LEFT:
                moveViewportDir = Direction.Left;
                break;

            case CursesKey.RIGHT:
                moveViewportDir = Direction.Right;
                break;

            case CursesKey.UP:
                moveViewportDir = Direction.Up;
                break;

            case CursesKey.DOWN:
                moveViewportDir = Direction.Down;
                break;

            case '+':
                _mapView.NextView();
                _dirty = true;
                break;

            case '-':
                _mapView.PreviousView();
                _dirty = true;
                break;

            default:
                _routine.InterpretKeyPress(key);
                break;
            }

            if (moveViewportDir != Direction.None)
            {
                _dirty = _mapView.CenterViewOn(_mapView.CurrentViewport.ViewArea.Center + moveViewportDir);
            }
        }