Detect key press (with input debounce and without terminal echo)


#1

Hello,

I’d like to detect key press (with input debounce and without terminal echo)
I did:

using SFML

dt = now()
dt_last = dt
td_debounce = Dates.Millisecond(500)

while true
  if is_key_pressed(KeyCode.K)
    dt = now()
    td = dt - dt_last
    if td >= td_debounce
      println("NEXT")
      dt_last = dt
    end
  end
end

But this solution require SFML.jl which is a bit overkilled.
Moreover adding more keys is not easy because I will need to put condition like

    if td >= td_debounce
      ...
    end

for each condition is_key_pressed(...).

A last point is that, terminal echo is enabled which is not something I like for my application.

Is there a way to do it for Windows, Linux and Mac OS (without too much dependencies)?

Kind regards