We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Multiple Key Detect Library
Page Index Toggle Pages: 1
Multiple Key Detect Library (Read 2678 times)
Multiple Key Detect Library
Nov 17th, 2009, 2:46pm
 
Anyone made one? I think it'd be a good project. I need multiple keystrokes all of the time and it's kind of annoying to keep adding the same 100 lines of code or whatever...
Re: Multiple Key Detect Library
Reply #1 - Nov 18th, 2009, 4:39am
 
100 lines of code? Most of the threads on the topic shown around 10 lines of code to handle the issue. I suppose you do sophisticated stuff.
It isn't so hard to make a library, perhaps you should try and release your?
Re: Multiple Key Detect Library
Reply #2 - Nov 18th, 2009, 12:45pm
 
Well, if you're trying to detect numerous keys, it starts to be cumbersome. It'd just make sense to have a library since it is so commonly used.

What do I need to do to make a library?
Re: Multiple Key Detect Library
Reply #3 - Nov 18th, 2009, 3:39pm
 
I'd suggest clarifying what you're trying to achieve and how you're going about it.  Otherwise have a look at http://dev.processing.org/libraries/
Re: Multiple Key Detect Library
Reply #4 - Nov 19th, 2009, 12:57am
 
or use the search
http://processing.org/hacks/hacks:multiplekeys

http://processing.org/discourse/yabb2/?num=1232739411
Re: Multiple Key Detect Library
Reply #5 - Nov 19th, 2009, 1:25am
 
Well, Cedric, if I understood correctly, antiquekid3 knows how to handle multiple key input, but he is annoyed to cut and paste the same code in each sketch needing it.
Indeed, sometime you have some simple code you want to use in several sketches, and currently Processing doesn't facilitate simple reuse, like looking in a shared code folder. I recall I suggested such feature long ago, as wrapping the code in a jar is sometime inconvenient, particularly if the shared code is still evolving.
Re: Multiple Key Detect Library
Reply #6 - Nov 19th, 2009, 1:30am
 
i see... i keep one copy&pasting as long as there is no other way. but it doesnt bother me alot. The question is where to start? you dont wanna have a librarie for every little snipped available that solves some little problem ... http://snippet.seltar.org/index.php
Re: Multiple Key Detect Library
Reply #7 - Nov 19th, 2009, 5:11am
 
One problem with copy & paste is that if you find a bug or improvement, you have to propagate the change on all sketches...

I wonder if Unix-like systems can just use symbolic links for .java or .pde files.
Re: Multiple Key Detect Library
Reply #8 - Nov 19th, 2009, 3:58pm
 
PhiLho  wrote on Nov 19th, 2009, 1:25am:
Well, Cedric, if I understood correctly, antiquekid3 knows how to handle multiple key input, but he is annoyed to cut and paste the same code in each sketch needing it.
Indeed, sometime you have some simple code you want to use in several sketches, and currently Processing doesn't facilitate simple reuse, like looking in a shared code folder. I recall I suggested such feature long ago, as wrapping the code in a jar is sometime inconvenient, particularly if the shared code is still evolving.


Yes, that's quite right. For example, it would seem like a waste of time to detect a-z, A-Z, 0-9, all the symbols, space, return, etc. if you're just going to use two keys in one of your programs. However, in some other programs, that might be useful; hence the need for a library.

Yeah, I hate the copy/paste stuff. Maybe I'm lazy, but it's pretty annoying to go back over each program that uses the same part when you figure out how to make something better.

The way I have handled multi-key input doesn't seem as complicated to me as what the first link showed, but I guess mine might take up a few more lines of code. But it's easier for me to understand.

Kyle
Re: Multiple Key Detect Library
Reply #9 - Nov 20th, 2009, 12:42pm
 
hmpf..maybe you try ruby ! You can simply put your class in a ruby file, and then require it on the top of your scetch..I have no clue about how to create .jar files, but it seems more complicated then the rubyish way Wink
How you even can create a larger sketch without outsourcing stuff?!I would get crazy  Smiley
Re: Multiple Key Detect Library
Reply #10 - Nov 21st, 2009, 1:43pm
 
I am working on a game library 'Glib' used to facilitate games creation with its sprite engine.
It also contains 2 input functions atm that works well with multiple keys:
- glib.KeyDown(key)
- glib.keyHit(key)

Hope to release a beta soon Wink
Re: Multiple Key Detect Library
Reply #11 - Nov 21st, 2009, 3:04pm
 
Nicolas ATEK wrote on Nov 21st, 2009, 1:43pm:
I am working on a game library 'Glib' used to facilitate games creation with its sprite engine.
It also contains 2 input functions atm that works well with multiple keys:
- glib.KeyDown(key)
- glib.keyHit(key)

Hope to release a beta soon Wink


Nice! I can't wait to try it out! That's just the thing I'm looking for, really. Let us know when you finish!
Re: Multiple Key Detect Library
Reply #12 - Nov 22nd, 2009, 1:22am
 
Nicolas, this is a good idea, but you should rename your library, GLib is already a well known name in the programming world... Smiley
Perhaps p5glib to be in the tradition of Processing libraries, or something like that.
Page Index Toggle Pages: 1