Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
detect keyup
#1
Hello again, im wondering what is the best way for detecting a keyup and if theres a function for that in tilengine? im making a ui element but of course when detecting input it just ends up going to the bottom of and top of the list really fast. And is there a tilenegine discord? i dont want to clog the forums with small questions lol
Reply
#2
Hi again,
Tilengine reports current button state. Detecting keydown or keyup involves detecting state transitions. For that you must keep previous value and compare it to current value, then reassign current to previous and process next frame. In pseudocode:


Code:
new = read()
if new == 1 and old == 0:
   keydown detected
elseif new == 0 and old == 1:
   keyup detected
endif
old = new

I don't have discord, but don't worry about posting small questions here Smile that's the point of the forum, to answer questions.
Reply
#3
oh ok, thank you i will give that a shot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)