SFML community forums
Help => Window => Topic started by: Crash47 on November 10, 2010, 10:08:58 pm
-
Hello.
Can anyone tell me the easiest way to use:
1. Mouse motion simulation.
For example:
newX = 300
newY = 500
MouseMoveTo(newX,newY)
2. Keyboard presses simulation.
For example:
newKey = "F3"
Keypress(newKey)
-
You mean creating a virtual event and send it to the OS ? Like emulating the user pressing keys of his keyboard but actually he doesn't ?
Well, you can't do that with SFML only. You have to use OS-specific API.
-
If you do your own system for handling events you can just create a sf::Event instance yourself and pass it trough that. And for really emulating that the cursor has moved, use: http://www.sfml-dev.org/documentation/1.6/classsf_1_1Window.htm#369d1764893c6fde8979fcf04142dc55
NOTE: This will only work internally within your application. No fancy OS things here :P
-
Thanks for help! :)