Giving mouse-click commands from a plugin (IMPLEMENTED)

Started by Nickenstien, Sun 02/04/2006 16:27:28

Previous topic - Next topic

Nickenstien

Hello  :)

Is there any way that I can generate Mouse-move and Mouse-Click events from my plug-in ?

I have created a plug-in that launches a Direct3D window (or full screen) and Hides the AGS window.

This lets me (or anyone using the plug-in) to run the game in a window of any resolution or a full-screen resolution that AGS does not support itself. It also lets me do all manner of lovely hardware accelarated graphical effects in the game.

However, As I am using my window rather than AGS' , I need to be able to move the AGS cursor and generate click events from within my plug-in code or I can't interact with the game (rendering the system useless)  :(  .

Could some functionality be provided to get a handle to DirectInput   (In the same way that you can access DirectDraw2 or DirectSound) ?

Or could some SetMouseMove(x, y)   SetMousePos(x, y)  &  SetMouseClick(ButtonID)    type functions be added  ?


Cheers,
            Nick.

Pumaman

You can use the SetMousePOsition function from the scripting API for SetMousePos/SetMouseMove, but I can see about adding a SimulateMouseClick method to the plugin API.

Edit by strazer:

AGS v2.72 Beta 7:
* Added new plugin API functions IncrementManagedObjectRefCount, DecrementManagedObjectRefCount, SetMousePosition, SimulateMouseClick, GetMovementPathWaypointCount, GetMovementPathLastWaypoint, GetMovementPathWaypointLocation, GetMovementPathWaypointSpeed.

lemmy101

w00t! cheers Pumaman! :) (From Nickenstien too)

Besh

#3
Great idea, hide AGS window and use D3D instead.

I tried to make the opposite, to use a D3D window for the rendering and then copy everything in the AGS window but there were some problems, "in primis" execution speed.

If it works fine you could give me some aidÃ,  ;D.
"Spread our codes to the stars,
You can rescue us all"
- Muse

lemmy101

#4
Yeah, we looked into doing this first. Worked great in windowed, but unfortunately D3D doesn't seem to like AGS stealing full-screen and basically died. I can't claim any credit for this rather novel approach Nikenstien came up with, though :)

Edit by strazer (again): No need to quote the whole post directly above yours!

Nickenstien

Quote from: Pumaman on Sun 02/04/2006 20:05:58
You can use the SetMousePOsition function from the scripting API for SetMousePos/SetMouseMove, but I can see about adding a SimulateMouseClick method to the plugin API.


That would be brilliant Pumaman  ;D


Besh - Thanks for the support, im fairly confident that this will be a popular plug-in once ive got it all sorted  :)


Nickenstien

I see that this has been added in the new release binaries. YAY   ;D

Cheers Pumaman, you're a star!

I'll see if I can get it implemented before a chicken coughs near me ;)

SMF spam blocked by CleanTalk