Jump to content


Photo

Clipcursor Dll (code-extension|lib-extension|gm6)


  • Please log in to reply
51 replies to this topic

#1 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 24 January 2007 - 06:37 PM

This Dll will clip your cursor to the area of your wish (coordinates are absolute to the screen).
That means the mouse can only move in the rectangular area you specify.

Includes: GM7 extension, GM7 extension-lib, and GM6
Filesize: 56 KB
Filetype: RAR
Url: Download

Clip will be lost when the window loses focus. Either use the step to keep the clip or use a GetFocus DLL (mine for example) to check when the focus is back, then clip. Note, you might want to put the initialise code into a script of its own.

Edited by Daniel-Dane, 18 August 2008 - 05:45 PM.

  • 0

#2 Hay44444

Hay44444

    GMC Member

  • New Member
  • 181 posts

Posted 24 January 2007 - 07:37 PM

This is soooooooo cool, I got a few uses for this already,
Ill post you in my credits, keep up the great job,
I love it!!!
  • 0

#3 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 24 January 2007 - 07:46 PM

Thanks for the quite surprisingly huge feedback, I am glad that it is for use, I actually wrote it for another member.
  • 0

#4 Chrishowarth

Chrishowarth

    GMC Member

  • Validating
  • 208 posts

Posted 24 January 2007 - 08:01 PM

Isn't this easily possible with GML?

#5 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 24 January 2007 - 08:07 PM

Why yes of course! Try and compare the following code with my DLL (GOD! It feels good saying MY DLL!):
if mouse_x < 0 window_mouse_set(0, window_mouse_get_y())

if mouse_x > room_width window_mouse_set(room_width, window_mouse_get_y())

if mouse_y < 0 window_mouse_set(window_mouse_get_x(), 0)

if mouse_y > room_height window_mouse_set(window_mouse_get_x(), room_height)

  • 0

#6 ca336458

ca336458

    GMC Member

  • New Member
  • 7 posts

Posted 25 January 2007 - 01:22 PM

ClpCurs

This Dll will clip your cursor to the area of your wish (coordinates are absolute to the screen).
A commented example is included as long with the Delphi source in a txt file as this is my first Dll and my Delphi skills are... Let's just say not good and because I hope you can tell me some (perhaps) better way.

Filesize: 10Kb.
Filetype: Zip.
Url: Download.

<{POST_SNAPBACK}>


I used this DLL in my game and man is it ever awesome!!! Thanks a million!!! I don't use it throughout my game, though. I think it's important for the player to be able to move the mouse outside the window to open other apps or click on tray icons, etc. But when they are playing a level, the cursor is clipped to prevent accidental clicking outside the windows to lose focus or make the game window disappear behind other windows. When they pause the game, finish the last level or lose all lives, then the cursor is released.
  • 0

#7 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 25 January 2007 - 02:16 PM

I am glad my customer liked it, it was made for you, you know.
That made my day ^_^.
  • 0

#8 NewDuck

NewDuck

    GMC Member

  • New Member
  • 54 posts

Posted 25 January 2007 - 04:26 PM

Strange, I actually tested the example file, but I can move my cursor outside the window??
Tested it on WinXP PRO SP2. Am I supposed to do something first to enable it?
The code you posted in GML works tho.

Edited by NewDuck, 25 January 2007 - 04:27 PM.

  • 0

#9 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 25 January 2007 - 04:55 PM

Hmm, I use XP pro (without any service packs) and for me -- And some others -- it DOES work.

Am I supposed to do something first to enable it?

Try to not click the mouse, that will disable, or just remove the glob left mouse pressed event.
  • 0

#10 NewDuck

NewDuck

    GMC Member

  • New Member
  • 54 posts

Posted 25 January 2007 - 05:04 PM

Ok, removing the global left worked.
  • 0

#11 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 25 January 2007 - 05:18 PM

And how is this compared to the GML?
  • 0

#12 NewDuck

NewDuck

    GMC Member

  • New Member
  • 54 posts

Posted 25 January 2007 - 10:50 PM

I'd say better, cuz with GML, the mouse always shakes at the window border
  • 0

#13 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 26 January 2007 - 02:48 PM

That's what this DLL is meant for.
  • 0

#14 Scronix

Scronix

    Look at my post instead.

  • New Member
  • 438 posts

Posted 26 January 2007 - 06:27 PM

Hey, this is really cool dude :blink:
  • 0

#15 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 27 January 2007 - 10:48 AM

Hey, this is really cool dude :P

<{POST_SNAPBACK}>

Thanks, I am glad my first DLL is good (^^,).
  • 0

#16 coolsmile

coolsmile

    Programmer

  • New Member
  • 1346 posts

Posted 27 January 2007 - 08:07 PM

Very nice, you can do this with gml, but this way is a lot better :P
  • 0

#17 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 29 January 2007 - 11:23 AM

I have also made a dll like this and I am using it for clipping the cursor at 1,1,1,1
position in order to show a video using a dll without having the cursor showing above it.

Nice start. :unsure:

Edited by Sindarin, 29 January 2007 - 11:23 AM.

  • 0
GM 8.1 / GM:HTML5 User

#18 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 29 January 2007 - 12:19 PM

Very nice, you can do this with gml, but this way is a lot better :unsure:

<{POST_SNAPBACK}>

That was the intention with the DLL.

I have also made a dll like this and I am using it for clipping the cursor at 1,1,1,1
position in order to show a video using a dll without having the cursor showing above it.

<{POST_SNAPBACK}>

Why not 0,0,0,0? Or even better, out of the screen?

Nice start. :(

<{POST_SNAPBACK}>

Thanks!
  • 0

#19 coolsmile

coolsmile

    Programmer

  • New Member
  • 1346 posts

Posted 30 January 2007 - 12:14 AM

This is actually a very useful. You could stop people hacking your game, all you have to do is set "always have game window on top" and clip it so the mouse has to stay in your room :unsure:

It's a very simple solution to such an annoying problem
Very nicely done :(
  • 0

#20 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 30 January 2007 - 08:37 AM

Why not 0,0,0,0? Or even better, out of the screen?

0,0,0,0 - 1,1,1,1 is quite the same, but you can't clip the mouse outside the screen border nor enter values like -32,-32,-32,-32.
  • 0
GM 8.1 / GM:HTML5 User

#21 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 30 January 2007 - 04:46 PM

This is actually a very useful.  You could stop people hacking your game, all you have to do is set "always have game window on top" and clip it so the mouse has to stay in your room <_<

It's a very simple solution to such an annoying problem
Very nicely done :lol:

<{POST_SNAPBACK}>

True

Why not 0,0,0,0? Or even better, out of the screen?

0,0,0,0 - 1,1,1,1 is quite the same, but you can't clip the mouse outside the screen border nor enter values like -32,-32,-32,-32.

<{POST_SNAPBACK}>

screen_width, screen_height, screen_width, screen_height (not actual GML) is actually out of the screen because the mouse won't be seen then.
  • 0

#22 Sindarin

Sindarin

    Indie Game Developer

  • New Member
  • 1644 posts
  • Version:GM:HTML5

Posted 31 January 2007 - 08:41 AM

This is actually a very useful.  You could stop people hacking your game, all you have to do is set "always have game window on top" and clip it so the mouse has to stay in your room


You can't stop hacking from by simply restricting the mouse movement. There's also keyboard controls, shortcuts and other programs who set themselves topmost.
  • 0
GM 8.1 / GM:HTML5 User

#23 smaksak

smaksak

    It's a matter of taste

  • New Member
  • 208 posts

Posted 24 February 2007 - 05:34 PM

Simple, yet awesome.
  • 0
Who in their right mind would ever need more than 640K of RAM!?
Bill Gates, 1981

#24 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 26 February 2007 - 04:57 PM

Simple, yet awesome.

<{POST_SNAPBACK}>

Thanks, true.
  • 0

#25 Tag

Tag

    GMC Member

  • New Member
  • 61 posts

Posted 28 February 2007 - 04:00 AM

What would make this great is if you could clip the mouse to an image. This is also possible in GML which I have done to make a hexagonal color-picker. But say we are using GearGod's Skin dll... Think you could clip the mouse to a window of any shape?

This would be soo helpful to me if you could do that! :GM006:
  • 0

#26 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 28 February 2007 - 01:52 PM

The ClipCursor function/whatever can't. Only rectangular shapes.
  • 0

#27 pcnerd

pcnerd

    GMC Member

  • New Member
  • 197 posts

Posted 03 March 2007 - 04:00 AM

It works awesomely. coolish.
  • 0

#28 Ian93

Ian93

    GMC Member

  • New Member
  • 146 posts

Posted 03 March 2007 - 06:36 PM

I have a feeling that people are going to use this way more than you originally expected. This is awesome and I am definately going to use it.

-Ian

PS-Congrats on being the maker of the first GM7 extension that I ever installed!
  • 0

#29 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 03 March 2007 - 06:42 PM

It works awesomely. coolish.

<{POST_SNAPBACK}>

Thanks. :medieval:

I have a feeling that people are going to use this way more than you originally expected.

<{POST_SNAPBACK}>

Actually I only expected the one that requested it to use it. :(

PS-Congrats on being the maker of the first GM7 extension that I ever installed!

<{POST_SNAPBACK}>

Me too. :(
  • 0

#30 SquareWheel

SquareWheel

    Square Wheel Games

  • New Member
  • 851 posts
  • Version:Unknown

Posted 07 March 2007 - 02:04 AM

Not bad but pretty easy to get around. Press Alt, and use the arrow keys until you reach move or minimize. Either one will disable this from working.
  • 0
Cook Console | Editor Engine | Mass File Namer

All of my examples are publicly available and can be found at

#31 JB -Alaska Works

JB -Alaska Works

    GMC Member

  • GMC Member
  • 32 posts

Posted 07 March 2007 - 02:52 AM

The link appears to be broken to me; when I click your link http://www.rogepost.com/n/5877647300 it redirects me to http://www.rogepost.com rather than your download. This sounds interesting though and I hope I'm not missing something obvious... :D

Edited by JB -Alaska Works, 07 March 2007 - 02:52 AM.

  • 0

#32 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 07 March 2007 - 02:41 PM

Yeah, Rogepost seems to bug once and in a while. I have uploaded it to my host.

Download fixed!
  • 0

#33 SquareWheel

SquareWheel

    Square Wheel Games

  • New Member
  • 851 posts
  • Version:Unknown

Posted 10 March 2007 - 06:32 AM

Can you change it so it will keep working, even after you make the Window lose focus?
  • 0
Cook Console | Editor Engine | Mass File Namer

All of my examples are publicly available and can be found at

#34 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 10 March 2007 - 08:11 AM

For me it still works? Hmm, might look at it later. I can't register GM7 on my laptop... yet.
  • 0

#35 NaughtyCat

NaughtyCat

    GMC Member

  • New Member
  • 53 posts

Posted 11 March 2007 - 12:30 AM

I might download it...
IF :D you will give me tips on how to post your finished games on the web. :)
  • 0
I am a spriter.
I always will be.
To see some of my work, visit my topics.
Please give credit.

#36 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 11 March 2007 - 10:52 AM

Can you change it so it will keep working, even after you make the Window lose focus?

<{POST_SNAPBACK}>

It actually DOES work even after it looses its focus. Make sure not to right click (or you can remove the right click event).

I might download it...
IF ;) you will give me tips on how to post your finished games on the web. :(

<{POST_SNAPBACK}>

Lol...
http://forums.gamema...howtopic=190170
  • 0

#37 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 18 March 2007 - 12:53 PM

I take that back, the clip will be reset when the desktop becomes focused.
See post #1 for more information.

I've also added a lib and gm6-script version.
See post #1 for more information.

Edited by Daniel-Dane, 18 March 2007 - 12:53 PM.

  • 0

#38 Bill23

Bill23

    GMC Member

  • GMC Member
  • 460 posts
  • Version:GM:Studio

Posted 19 August 2007 - 05:21 PM

This is really good!

Not bad but pretty easy to get around. Press Alt, and use the arrow keys until you reach move or minimize. Either one will disable this from working.

If you don't draw the border in window mode then that won't work either.
  • 0
Posted Image
Posted ImagePosted Image

#39 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 20 August 2007 - 10:21 AM

Not bad but pretty easy to get around. Press Alt, and use the arrow keys until you reach move or minimize. Either one will disable this from working.

If you don't draw the border in window mode then that won't work either.

<{POST_SNAPBACK}>

Interesting, although just calling it every step doesn't seem to affect GM (and outside GM nothing will be slow).
  • 0

#40 Bill23

Bill23

    GMC Member

  • GMC Member
  • 460 posts
  • Version:GM:Studio

Posted 20 August 2007 - 12:00 PM

Not bad but pretty easy to get around. Press Alt, and use the arrow keys until you reach move or minimize. Either one will disable this from working.

If you don't draw the border in window mode then that won't work either.

<{POST_SNAPBACK}>

Interesting, although just calling it every step doesn't seem to affect GM (and outside GM nothing will be slow).

<{POST_SNAPBACK}>

I think you might of misunderstood what I was saying, the extension works fine when there is no border, but that method for getting around it(by pressing alt and minimizing the window) doesn't.
  • 0
Posted Image
Posted ImagePosted Image

#41 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 20 August 2007 - 01:32 PM

You mean my extension doesn't work when there is a border? And I meant, calling the clip every step doesn't seem to slow it down.
  • 0

#42 darulaz

darulaz

    GMC Member

  • New Member
  • 30 posts

Posted 10 September 2007 - 11:11 AM

Hi, i have a question... is the dll & gex file free for commerziell-games ? :snitch:
  • 0

#43 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 11 September 2007 - 05:44 PM

Yes, freeware/open source. =D
  • 0

#44 venimortem

venimortem

    GMC Member

  • New Member
  • 4 posts

Posted 18 August 2008 - 10:32 AM

Hello. ^_^; I was wondering if you could re-upload or upload the DLL file to a different site? This link seems to not work and I could really use this function right about now. ^^' I've tried everything to keep the mouse in the window, lol.
  • 0

#45 Daniel-Dane

Daniel-Dane

    GMC Member

  • New Member
  • 3581 posts

Posted 18 August 2008 - 05:46 PM

Consider it done. Note, I do not support this any more.
  • 0

#46 venimortem

venimortem

    GMC Member

  • New Member
  • 4 posts

Posted 20 August 2008 - 02:27 AM

Thank you! ^^
I have a question as well, if you don't mind answering. (if you do mind, just ignore me) Anyway, if the size of the game's window is 800x800 pixels, making it completely square, of course, and I want it to be run in full screen... is there a way to clip the cursor to the screen area being used in full screen, stopping the mouse from entering the black area around the actual game?
  • 0

#47 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 20 August 2008 - 02:58 AM

Consider it done. Note, I do not support this any more.


I wrote gmmouseext that supports the feature if you don't support this dll anymore.


venimortem, in full screen, cancel the clipping. Or reset the clip region to the area you want to cursor to stay in. I assume you don;t want it to go on the black broders.
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#48 venimortem

venimortem

    GMC Member

  • New Member
  • 4 posts

Posted 21 August 2008 - 02:42 AM

Consider it done. Note, I do not support this any more.


I wrote gmmouseext that supports the feature if you don't support this dll anymore.


venimortem, in full screen, cancel the clipping. Or reset the clip region to the area you want to cursor to stay in. I assume you don;t want it to go on the black broders.


I apologize if I'm becoming annoying, but I am still learning GM, after all. ^_^; So do you mind explaining further the best way to clip the cursor to the game while it's in full screen? Different people have different resolutions, of course, so it's not as simple as setting the clip region to the games size on my screen; others' game size would be different. So what's the most effective way to reset the clip region to the game's screen no matter what the screen resolution is?
  • 0

#49 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 21 August 2008 - 03:23 AM

Consider it done. Note, I do not support this any more.


I wrote gmmouseext that supports the feature if you don't support this dll anymore.


venimortem, in full screen, cancel the clipping. Or reset the clip region to the area you want to cursor to stay in. I assume you don;t want it to go on the black broders.


I apologize if I'm becoming annoying, but I am still learning GM, after all. ;); So do you mind explaining further the best way to clip the cursor to the game while it's in full screen? Different people have different resolutions, of course, so it's not as simple as setting the clip region to the games size on my screen; others' game size would be different. So what's the most effective way to reset the clip region to the game's screen no matter what the screen resolution is?


In full screen mode, you should just stop the clipping since the mouse will now stop at the screen edges anyway. The matter remains that you may have black borders that you dont want the mouse to go into.

You need to ask gm for the screen size and compare that to the window size and extrapolate a region based on that. I must admit, I have no idea on how to do that rght now. But I'm sure GM provides enough information to figure it out in a few tries.

The way you set the full screen and set the global settings may change the method, so I can't give you an answer that handles it all.

Edited by icuurd12b42, 21 August 2008 - 03:25 AM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#50 venimortem

venimortem

    GMC Member

  • New Member
  • 4 posts

Posted 21 August 2008 - 03:54 AM

Consider it done. Note, I do not support this any more.


I wrote gmmouseext that supports the feature if you don't support this dll anymore.


venimortem, in full screen, cancel the clipping. Or reset the clip region to the area you want to cursor to stay in. I assume you don;t want it to go on the black broders.


I apologize if I'm becoming annoying, but I am still learning GM, after all. ^_^; So do you mind explaining further the best way to clip the cursor to the game while it's in full screen? Different people have different resolutions, of course, so it's not as simple as setting the clip region to the games size on my screen; others' game size would be different. So what's the most effective way to reset the clip region to the game's screen no matter what the screen resolution is?


In full screen mode, you should just stop the clipping since the mouse will now stop at the screen edges anyway. The matter remains that you may have black borders that you dont want the mouse to go into.

You need to ask gm for the screen size and compare that to the window size and extrapolate a region based on that. I must admit, I have no idea on how to do that rght now. But I'm sure GM provides enough information to figure it out in a few tries.

The way you set the full screen and set the global settings may change the method, so I can't give you an answer that handles it all.



Alright, I'll just keep experimenting with it, then... but thank you for the help! ^^
  • 0