Process any key press or mouse click
by Todd D. Degani · in Torque Game Engine · 05/11/2005 (3:32 pm) · 2 replies
I currently have a gui setup that has a background with an avi control as its child. The child is setup to process any key event or mouse press to stop the movie.
Now this works great as long as you press inside of the avi control, but I am trying to determine the best method for processing when these events happen over the background. I do not think there is processing for this build into the script side of things. I know there is a key to bind to "anykey" but it does not work for all keys.
Options:
1) I build the background into the avi control
2) I subclass the background and have it process mouse events like the avi control does
3) I hook into GuiMouseEventCtrl and have it execute scripts via Con::execute
4) In script I bind the anykey and mouse click events to stop the avi and then unbind the keys again when done
Any one have any suggestions?
Now this works great as long as you press inside of the avi control, but I am trying to determine the best method for processing when these events happen over the background. I do not think there is processing for this build into the script side of things. I know there is a key to bind to "anykey" but it does not work for all keys.
Options:
1) I build the background into the avi control
2) I subclass the background and have it process mouse events like the avi control does
3) I hook into GuiMouseEventCtrl and have it execute scripts via Con::execute
4) In script I bind the anykey and mouse click events to stop the avi and then unbind the keys again when done
Any one have any suggestions?
#2
05/12/2005 (6:16 pm)
Sweet, glad you got it solved. Thanks for posting the problem AND solution so cogently! :)
Torque Owner Todd D. Degani
I separated the background and the avi control so that the avi control wasn't a child of the background. Then I pushed the background then the avi control to the canvas. Finally I set the avi control as the first responder and it works as I intended.