2 registered members (AndrewAMD, ozgur),
1,421
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
AlexH
OP
Newbie
|
OP
Newbie
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
AlexH
OP
Newbie
|
OP
Newbie
Joined: Oct 2009
Posts: 33
|
|
|
|
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
flits
User
|
User
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
AlexH
OP
Newbie
|
OP
Newbie
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? 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: Superku]
#295123
10/23/09 01:14
10/23/09 01:14
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
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.
#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
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
I'd prefer the ClipCursor way...
#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.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|