I have searched around a bit for this but haven't found an answer.
Can I use standard KeyPresses from code somehow? As my touchEvens are processed purely in a Zexpression, I thought I might as well list standard keyboard input there as well for consistency. If its not possible the normal way with KeyPress components work very well as it is. Just curious.
Using KeyPress in Zxpression
Moderator: Moderators
Re: Using KeyPress in Zxpression
Hi Imerion,
Attached is a example that contains GetKey / GetKeyUp / GetKeyDown functions ( use WASD keys to demo ).
K
The way it is right now isn't very consistent / intuitive yes. The keyboard can only be accessed using the KeyPress component and doesn't have any script equivalent, while with the touchscreen it's the other way around ( only available from scripts, no component equivalent ).Imerion wrote:Can I use standard KeyPresses from code somehow? As my touchEvens are processed purely in a Zexpression, I thought I might as well list standard keyboard input there as well for consistency.
However, you can implement this quite easily yourself. Simply use a Repeat component with a KeyPress inside, grab a key code from a "key map" each loop and store the results in a array. Then using a ZLibrary you can wrap accessing the array into something a little more readable if you wantImerion wrote:If its not possible the normal way with KeyPress components work very well as it is.
Attached is a example that contains GetKey / GetKeyUp / GetKeyDown functions ( use WASD keys to demo ).
K
- Attachments
-
- Keys.zgeproj
- (3.58 KiB) Downloaded 402 times