Exemplo n.º 1
0
 private void HandleKeyboardEvents(InputEventKey key)
 {
     if (key.Scancode == KeyList.Shift.Int())
     {
         if (key.IsPressed())
         {
             _leftShiftPressed = true;
         }
         else if (!key.IsPressed() && _leftShiftPressed)
         {
             _leftShiftPressed = false;
         }
     }
 }
Exemplo n.º 2
0
    public void DoCameraZoom(Player instance, InputEventKey emb)
    {
        if (currentZoom == null)
        {
            currentZoom = new Vector2();
        }

        if (emb.IsPressed())
        {
            if (emb.Scancode == Keybinds.KEYBIND_ZOOM_IN)
            {
                if (zoomVal > instance.MinZoom)
                {
                    currentZoom.x = instance.camera.Translation.z + instance.ZoomSpeed;
                    currentZoom.y = instance.camera.Translation.y - 0.05f;
                    zoomVal      -= instance.ZoomSpeed;
                    UpdateCameraZoom(instance);
                }
            }
            else if (emb.Scancode == Keybinds.KEYBIND_ZOOM_OUT)
            {
                if (zoomVal < instance.MaxZoom)
                {
                    currentZoom.x = instance.camera.Translation.z - instance.ZoomSpeed;
                    currentZoom.y = instance.camera.Translation.y + 0.05f;
                    zoomVal      += instance.ZoomSpeed;
                    UpdateCameraZoom(instance);
                }
            }
        }
    }
Exemplo n.º 3
0
    public override void _Input(InputEvent @event)
    {
        base._Input(@event);

        if (@event is InputEventKey)
        {
            InputEventKey key_event = (InputEventKey)@event;
            if (key_event.IsPressed())
            {
                test_freq += 1;
            }
        }
    }
Exemplo n.º 4
0
    public override void _Input(InputEvent @event)
    {
        base._Input(@event);

        if (@event is InputEventKey)
        {
            InputEventKey key_event = (InputEventKey)@event;
            if (key_event.IsPressed())
            {
                _OnAnyKeyPressed();
            }
        }
    }
Exemplo n.º 5
0
    public override void _Input(InputEvent @event)
    {
        base._Input(@event);

        if (@event is InputEventKey)
        {
            InputEventKey key_event = (InputEventKey)@event;
            if (key_event.IsPressed() && key_event.Scancode == (int)KeyList.W)
            {
                changeCharRate(char_increase_rate + 0.5);
            }
        }
    }
Exemplo n.º 6
0
    private void OnKeyEvent(InputEventKey evt)
    {
        GD.Print($"OnKeyEvent. evt: {evt.Scancode}");
        if (_inProcess || !evt.IsPressed() || !evt.Alt)
        {
            return;
        }

        if (evt.Scancode == (ulong)KeyList.Key1)
        {
            ProcessActions(Game.CheatBonus(ItemShape.Bomb));
        }
        else if (evt.Scancode == (ulong)KeyList.Key2)
        {
            ProcessActions(Game.CheatBonus(ItemShape.HLine));
        }
        else if (evt.Scancode == (ulong)KeyList.Key3)
        {
            ProcessActions(Game.CheatBonus(ItemShape.VLine));
        }
    }