View Full Version : How to "bind keys" from VK keycodes ?

08-08-2007, 04:21 PM

Is there a simple way to let the user parameters his own keyboard in the program.

Do I need to convert Vk keycodes to something else ?

08-08-2007, 05:45 PM
Sorry lowercase, but your question doesn't make any sense. What are you trying to achieve?

It sounds like you want your user to be able to customize what keys perform what actions. If that is the case then there are a few ways to go about it. It would help to know the compiler your using (FPC, Lazarus, Delphi) and version as well as what libraries you are/will be using.

One way to do it would be to use keyboard hooks to read the keyboard, then have a series of records that contain keys and methods that are called when those keys are signaled. In your game loop you compare to see what matches and then execute the attached method.

09-08-2007, 11:02 AM
Well, I was tired, when i wrote this...

I'm building a unit to process mouse and keyboard events using opengl (http://www.sulaco.co.za) template.

I'm trying to remap keys at runtime, but cant make it works properly, i was wondering if someone else tried to do this before ?

09-08-2007, 12:25 PM
Post the code you have so far or better yet post up a simple sample application that shows your code not working. Also, we still need to know your compiler and IDE :)

Its difficult to say whats wrong without a starting point.