My intention is to control a Crystalspace application by virtual gloves. That is, I want to develop a new input control. I have been making tests. For example I developed a plugin which wraps the mouse driver: It catchs the mouse events, process the information and later pass it to the applicacion. In a real case the information should be read by means of the gloves driver. I had thought the plugin to implement the “iEventHandler” interface and to read the information at the “Preproccess” phase. Is it a good idea? Also I could do it by forking a new thread, but the gloves API is strongly related to the frame-lifecycle: they need to call a specific function every frame.
Also I’m not sure how the plugin should pass the information to the applications. I had thought two ways:
- Storing the information in variables. Later the application would read the data from these variables. It is like state information. I’ve seen that some examples use “GetKeyState” to request the state of the keyboard instead of catch the keyboard events. I’ve been making tests in this way and it seems to work.
- Throwing its own events. If the plugin throws an event… When will it be catched by the application, before the “PreProccess” phase?
If my plugin is listening to Frame events too (“PreProccess”, “Proccess”, “PostProccess”, “FinalProccess”) which handler of both will be the first in proccessing the event the plugin handler or the application handler?
Thanks in advance