processing4 icon indicating copy to clipboard operation
processing4 copied to clipboard

with P2D renderer `key` variable doesnt update when pressing CTRL and another key

Open grimtin10 opened this issue 2 years ago • 1 comments

Description

When using the P2D renderer the key variable doesn't update when pressing control and then another key.

Expected Behavior

Pressing control and then another key should set the key variable to CODED (65535) and then whatever other key you pressed.

Current Behavior

Pressing control and then another key doesn't update the key variable and it ends up containing CODED for both key presses and any subsequent key presses.

Steps to Reproduce

  1. Set renderer to P2D
  2. Create a keyPressed function that prints out the key variable
  3. Press control and then another key

Your Environment

  • Processing version: 4.3 (latest)
  • Operating System and OS version: Windows 10 Pro 22H2

Possible Causes / Solutions

OpenGL renderer isn't updating key variable when it should be.

grimtin10 avatar Oct 16 '23 06:10 grimtin10

Are you pressing both the keys CTRL and (any other key) simultaneously? As in CTRL+<key>? Or CTRL then <key> ? Also in-case this helps, key should contain CODED and if you want to get the value of the key, use keyCode instead of key.

// using P2D
void keyPressed() {
    if (key == CODED) {
        println((char)keyCode);
    }
}

krishna2803 avatar Dec 15 '23 20:12 krishna2803