Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 559 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 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