Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Nickenstien on Sun 02/04/2006 16:27:28

Title: Giving mouse-click commands from a plugin (IMPLEMENTED)
Post by: Nickenstien on Sun 02/04/2006 16:27:28
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.
Title: Re: Setting Mouse Cursor position (or giving mouse-move commands) from a plug-in
Post by: 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.

Edit by strazer:

AGS v2.72 Beta 7:
* Added new plugin API functions IncrementManagedObjectRefCount, DecrementManagedObjectRefCount, SetMousePosition, SimulateMouseClick, GetMovementPathWaypointCount, GetMovementPathLastWaypoint, GetMovementPathWaypointLocation, GetMovementPathWaypointSpeed.
Title: Re: Setting Mouse Cursor position (or giving mouse-move commands) from a plug-in
Post by: lemmy101 on Sun 02/04/2006 21:32:18
w00t! cheers Pumaman! :) (From Nickenstien too)
Title: Re: Giving mouse-click commands from a plugin
Post by: Besh on Sun 02/04/2006 22:31:01
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.
Title: Re: Giving mouse-click commands from a plugin
Post by: lemmy101 on Mon 03/04/2006 03:08:22
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!
Title: Re: Giving mouse-click commands from a plugin
Post by: Nickenstien on Mon 03/04/2006 19:31:57
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  :)

Title: Re: Giving mouse-click commands from a plugin (IMPLEMENTED)
Post by: Nickenstien on Mon 10/04/2006 15:25:35
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 ;)