function ClickViaController()
{
while(joy_1)
wait(1);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
wait(1);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
}
Then in main function of project,
function main()
{
.....
....
while(GameStarted == 0)
{
if(num_joysticks > 0)
{
mouse_mode = 2;
mouse_pos.x = joy_force.x;
mouse_pos.y = joy_force.y;
SetCursorPos((int)mouse_pos.x, (int)mouse_pos.y);
if(joy_1)
ClickViaController();
}
else
mouse_mode = 4;
......
.....
}