Calculator Community > Calculator C

Key presses

(1/1)

kevinkore3:
There is the isKeyPressed function, but that only detects the state of the key.
Say, for example, open a text editor and hold a key. One character will show up at first, then after half a second or so a bunch will start showing up rapidly.
Is there a function to capture this type of input in the SDK or should I implement one?
I'm curious because in a program I'm making I'm using tabs to loop through things, but it just loops through everyone really fast.

Vogtinator:
That's automated key repetition and not implemented in libndls as it is more low-level (isKeyPressed reads from the keypad buffer directly).
You'll have to implement it yourself by using a counter variable and some booleans.

Legimet:
I implemented something like that in nPDF for the arrow keys. You might want to look at the source code: https://github.com/Legimet/nPDF. And you can copy my code into your project under the terms of the GPL.

kevinkore3:
On another note, is it possible to get fstream working? I'm missing basic_string.tcc (and probably other things) on my Windows machine, and my Linux laptop makes super large bogus a.outs that don't run.

Vogtinator:
You have to build the "new" SDK from source: http://github.com/ndless-nspire/Ndless
On Windows, use Cygwin, on linux it should work directly. fstream is fully supported, as is everything except threads.
See also http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction_on_Linux

Navigation

[0] Message Index

Go to full version