Is possible to fake joy button pressed?

i need to make a function but i dont know if is possible.

the function is something like:

if joy button 8 is pressed then
if file /tmp/temp exist then
press joy button 6
fi
fi

so, if button 8 is pressed and the file /tmp/temp exist, then the program send a fake button 6 press

Hello,

It should be possible. How easy it is depends on where you want to
send this fake event. To the program itself (hint: use
SDL_PushEvent())? To another program?

– BrianOn 17 February 2012 17:08, fbs777 wrote:

i need to make a function but i dont know if is possible.

If you want to simulate inside your app, do as Brian said, use SDL_PushEvent.
But, if you want to send the event to another app, you need to look for OS specific stuff, cause there is no API for that in SDL.

fbs777 wrote:> i need to make a function but i dont know if is possible.

the function is something like:

if joy button 8 is pressed then
if file /tmp/temp exist then
press joy button 6
fi
fi

so, if button 8 is pressed and the file /tmp/temp exist, then the program send a fake button 6 press

fbs777 wrote:

i need to make a function but i dont know if is possible.

the function is something like:

if joy button 8 is pressed then
if file /tmp/temp exist then
press joy button 6
fi
fi

so, if button 8 is pressed and the file /tmp/temp exist, then the program send a fake button 6 press

Do you know what will happen when button 8 is pressed? If it’s hardcoded then you can simply call the function that it would call, otherwise I guess you could find out what button 8 is mapped to using a loop.------------------------
The Legend of Edgar. A 2D platformer for Windows and Linux. (http://www.parallelrealities.co.uk/p/legend-of-edgar.html)