Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 770 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Limiting cursor speed #383472
09/20/11 20:39
09/20/11 20:39
Joined: Feb 2007
Posts: 146
UK
robertbruce Offline OP
Member
robertbruce  Offline OP
Member

Joined: Feb 2007
Posts: 146
UK
Hello,

Is there a way to restrict the max speed of moving a cursor across the screen? My mouse code is below. Would appreciate any help.



function init_mouse()
{


mouse_map = arrow_bmp;


mouse_mode = 1;



mouse_spot.x = bmap_width(arrow_bmp)/2; // hot spot in the bmap center
mouse_spot.y = bmap_height(arrow_bmp)/2;

var mouse_limit_x;
var mouse_limit_y;
mouse_limit_x = (screen_size.x - bmap_width(arrow_bmp));
mouse_limit_y = (screen_size.y - bmap_width(arrow_bmp));
while (1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
wait(1);
}

}

thanks,

Rob

Re: Limiting cursor speed [Re: robertbruce] #383476
09/20/11 21:58
09/20/11 21:58
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
vec_lerp ? something similar to that should work.

Re: Limiting cursor speed [Re: lostclimate] #383487
09/20/11 22:54
09/20/11 22:54
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
Code:
vec_set(temp, vector(mouse_cursor.x, mouse_cursor.y, 0));
vec_sub(temp, vector(mouse_pos.x, mouse_pos.y, 0));
vec_normalize(temp, minv(42, vec_length(temp)));
mouse_pos.x += temp.x;
mouse_pos.y += temp.y;



Re: Limiting cursor speed [Re: robertbruce] #383567
09/21/11 22:04
09/21/11 22:04
Joined: Feb 2007
Posts: 146
UK
robertbruce Offline OP
Member
robertbruce  Offline OP
Member

Joined: Feb 2007
Posts: 146
UK
thanks to you both, will give those a try,

Rob


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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