Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
167 user(s) are online (151 user(s) are browsing Forums)

Members: 0
Guests: 167

more...

Support us!

Headlines

 
  Register To Post  

Keyboard.device ?
Quite a regular
Quite a regular


See User information
Hi,

I'm looking for a method to have all the keyboards keys states in 1 array in order to reach each of them when I want.

I've made searchs over the net without real success.

For example, this link :
http://amiga.sourceforge.net/amidevhe ... ce/ex02_keyboard.device.c
Do not compile ... many errors in the IExec functions arguments ... so can it be correct if I fix these errors ?

If someone have any clue. Please share it.

Thank you.

Kindest Regards,
AmiDARK

All we have to decide is what to do with the time that is given to us.
Go to top
Re: Keyboard.device ?
Quite a regular
Quite a regular


See User information
What exactly do you want again?

cheers
tony
Go to top
Re: Keyboard.device ?
Quite a regular
Quite a regular


See User information
@TonyW:
Just to be able to know, at any time, if a key is pressed down or not.

All we have to decide is what to do with the time that is given to us.
Go to top
Re: Keyboard.device ?
Not too shy to talk
Not too shy to talk


See User information
I think the simplest way to do this would be to keep track of it yourself? Using the basic loop in the code you linked to as a base:

- Assign an array for your rawkeys
- Listen for keyboard events
- set the appropriate element to the status of the key
- Do whatever else your program does in its loop
- Repeat

There is a function in keyboard.device for reading the keyboard matrix, perhaps you could use that instead? Check out the autodocs for keyboard.device/KBD_READMATRIX and see what you think - don't think it's a particularly easy way to do it though...

Go to top
Re: Keyboard.device ?
Just popping in
Just popping in


See User information
There is a known issue that KBD_READMATRIX doesn't work on OS4, see http://amigan.1emu.net/releases/ami-code.txt

As a workaround, I changed my program so that it keeps track of all the key up/down states itself based on the received IDCMP messages. This is not the best way though, as it is possible to miss events in some situations (eg. when the program's window is inactive).

Go to top
Re: Keyboard.device ?
Not too shy to talk
Not too shy to talk


See User information
@Minuous

Yeah, that's my guess at the best solution too. Interesting about KBD_READMATRIX, I wonder if it is actually a bug, or is it simply that OS4 doesn't have access to the actual matrix where classics do? Just speculating - I don't know how it works internally...

Go to top
Re: Keyboard.device ?
Home away from home
Home away from home


See User information
@minuos
Quote:

This is not the best way though, as it is possible to miss events in some situations (eg. when the program's window is inactive).

If you need to get events that are destined for your window, you can use a commodity or perhaps a input handler (never done the latter so not sure how to set one up)


Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project