Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Restrict Mouse Pointer

Author
Message
uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 14th Jul 2013 02:29
I have a Tier1 Windows desktop game using the mouse pointer. I use the pointer for various purposes one of which is to attach an object to it during game play.

Does anyone know if its possible to keep the pointer inside the game window boundaries and restrict/prevent it from exceeding the collision area of the 4 boundaries to which all dynamic game elements are restricted?

By default this is not the case of course and the pointer can escape widely outside of the game window and disappear onto the desktop while its attached object is left helpless inside the game play area with no mouse to control it. Getting it back into play in the game area is of course a pain of a gameplay issue. Of course even if the game play state is not critical the mouse pointer can leave the game screen area at any time if you move it to and past the boundaries. As my game window is only small - mobile phone size this is not hard to do and the pointer can easily be lost out of the game area.

I see a lot of games not necessarily made with AppGameKit where this happens and its a poor situation for the game playing user.

I have had a look at the commands list and so on and searched around but cant find anything specifically related to this?

Any help is appreciated.

Thank you.

haliop
User Banned
Posted: 14th Jul 2013 03:11
im trying to think of a fix
can you explain more about the object attached to the mouse?

xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 14th Jul 2013 04:44
Store the x/y coords of the mouse in an array/UDT. Update them using GetPointerX() and GetPointerY() within the loop. Compare the x/y values to boundaries you have defined, and programatically adjust the mouse position as needed using SetRawMousePosition(x, y). For added effect, hide the actual mouse cursor using SetRawMouseVisible(0) and use a custom cursor sprite in its place.
haliop
User Banned
Posted: 14th Jul 2013 06:46
ohh i didnt know there is a command SetRawousePoisiton...


if so i'll simply do :


first try works nice but not always since you can move the mouse really quick then the AppGameKit window dont get it... and your out of the app ...

now i have another fix to try , give me one sec.

haliop
User Banned
Posted: 14th Jul 2013 07:21
ok so this fix isnt working right but i think the solution is there i just cant get it to work.. i tried all kind of stuff maybe someone can help



so in here you actually always placing the mouse at 50,50 center of the screen and you use mouseMoveX and mouseMoveY to move a sprite which will act as your cursor. this way you never get out of the screen with the mouse... but i cant put my finger on what im doing wrong when i was using DarkGDK this worked but i guess i messed up the vars or something... the solution is right there but i dont know... hope one of these solutions help.

uman
Retired Moderator
20
Years of Service
User Offline
Joined: 22nd Oct 2004
Location: UK
Posted: 19th Jul 2013 06:20
Hi guys,

Thanks for the responses.

Hiding the mouse pointer would be a great idea.

I will have a look at the code examples you have given.

Thanks again.

Login to post a reply

Server time is: 2024-11-24 18:56:07
Your offset time is: 2024-11-24 18:56:07