Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ozgur), 1,421 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How do I keep the mouse inside the window and make it invisible? #294600
10/20/09 04:51
10/20/09 04:51
Joined: Oct 2009
Posts: 33
A
AlexH Offline OP
Newbie
AlexH  Offline OP
Newbie
A

Joined: Oct 2009
Posts: 33
So far I have set mouse_mode to 0 and enable_mouse to 0 but the mouse still is visible and can move outside the window.

How can I capture the mouse and make it invisible.

Edit:
Okay I just found out that mouse_pointer must be 0 to make the mouse invisible, any ways to trap the mouse inside the window?

Last edited by AlexH; 10/22/09 21:37.
Re: How do I keep the mouse inside the window and make it invisible? [Re: AlexH] #294866
10/21/09 16:17
10/21/09 16:17
Joined: Oct 2009
Posts: 33
A
AlexH Offline OP
Newbie
AlexH  Offline OP
Newbie
A

Joined: Oct 2009
Posts: 33
Shameless bump.

Re: How do I keep the mouse inside the window and make it invisible? [Re: AlexH] #294895
10/21/09 19:36
10/21/09 19:36
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Impossible, sry.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: How do I keep the mouse inside the window and make it invisible? [Re: Superku] #294902
10/21/09 20:33
10/21/09 20:33
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
this isnt impossible but you need to use some winapi function and that isnt that easy for beginners.
i have much problems myself with it.

ClipCursor is the thing you search (never tested if it works)

also i belief i tought there was a dll that can do the job

hope someone better in winapi can help you

flits


"empty"
Re: How do I keep the mouse inside the window and make it invisible? [Re: flits] #295078
10/22/09 21:22
10/22/09 21:22
Joined: Oct 2009
Posts: 33
A
AlexH Offline OP
Newbie
AlexH  Offline OP
Newbie
A

Joined: Oct 2009
Posts: 33
Sorry but, what the hell? Virtually every game and its grandma has this functionality. Is this some sort of crude joke?

Originally Posted By: H.F.Pohl
Impossible, sry.

Thanks for the useless post.

Last edited by AlexH; 10/22/09 21:23.
Re: How do I keep the mouse inside the window and make it invisible? [Re: AlexH] #295118
10/23/09 00:57
10/23/09 00:57
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I know a lot about C-Script and much about lite-C pure mode and it's not possible without advanced commands, you wanted an answer.
Code your one mouse script by moving a PANEL according to mouse_force inside the window or simply switch to fullscreen.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: How do I keep the mouse inside the window and make it invisible? [Re: Superku] #295123
10/23/09 01:14
10/23/09 01:14
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
you can either use SetCursorPos and get the coordinates of the window on the screen, and set your cursor somewhere inside your window or

you could use ClipCursor and GetWindowRect duo.(ClipCursor need a RECT, you get RECT of engine window with GetWindowRect)

edit: i.e. this will trap mouse in the middle as long as you keep pressing space.

Code:
#include <acknex.h>
#include <windows.h>

void main(){
	RECT* window_rect;
	while(1){
		if(key_space){
			GetWindowRect(hWnd,window_rect);
			SetCursorPos(window_rect.left+screen_size.x/2,window_rect.top+screen_size.y/2);
		}
		wait(1);
	}	
}



Last edited by Quadraxas; 10/23/09 01:25.

3333333333
Re: How do I keep the mouse inside the window and make it invisible? [Re: Quad] #295130
10/23/09 02:04
10/23/09 02:04
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
I'd prefer the ClipCursor way...
Code:
#include <acknex.h>
#include <windows.h>

void main()
{
mouse_pointer = 0;
RECT* rect;
GetWindowRect(hWnd,rect);
ClipCursor(rect);
}



Last edited by DJBMASTER; 10/23/09 02:06.
Re: How do I keep the mouse inside the window and make it invisible? [Re: DJBMASTER] #295487
10/25/09 17:24
10/25/09 17:24
Joined: Oct 2009
Posts: 33
A
AlexH Offline OP
Newbie
AlexH  Offline OP
Newbie
A

Joined: Oct 2009
Posts: 33
Thanks for the replies, I figured out how to get clip cursor working.

I'd like to point out that GetWindowRect() returns the entire window's box (including the window title bar with the X close button).

Also you must reactivate the cursor clip when the window is moved/minimized.

I will make a wiki page on how to do this and post the link here.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1