Re: [Alephmodular-devel] Hello
Status: Pre-Alpha
Brought to you by:
brefin
From: Chris P. <sf...@ma...> - 2002-12-27 03:13:18
|
On Thursday, December 26, 2002, at 07:05 PM, Br'fin wrote: > I'm certainly curious to know how you are doing with GetMouse and if =20= > it's giving you any other kind of problems. Well, it moves a little slowly, but the entire game moves a little = =20 slowly, and that's OK ;) I'll record my old function (just in case=99), =20= and see about a CoreGraphics-based version. Hmm, that version doesn't seem to handle the mouse as well; I see =20= what you mean about GetMouse acting slowly. My code for Carbon =20 mouse_idle() is at the end of this email - to use it: 1- "#if !TARGET_API_MAC_CARBON" out the original mouse_idle() =20 function 2- #if out the set_mouse_position() prototype and function. 3- Make get_mouse_position() call GetMouse() #if we're in Carbon Try it and see if the results you get feel any different. It =20 certainly seemed smoother to me, even if it wasn't really a good =20 solution. Perhaps the problem is with CGWarp...() instead? Oh, and "way back when," I used the keyboard too. Except that "way = =20 back when," Kindergarten was a challenge, and that's not a memory I =20 like to remember. -Sfiera ---------- #if TARGET_API_MAC_CARBON void mouse_idle( short type) { Point where; static Point last_mouse_pos; static bool inited =3D false; static long last_tick_count; long tick_count=3D TickCount(); long ticks_elapsed=3D tick_count-last_tick_count; get_mouse_location(&where); if (!inited) { last_mouse_pos =3D where; inited =3D true; } if (ticks_elapsed) { /* calculate axis deltas */ fixed vx=3D =20 INTEGER_TO_FIXED(where.h-last_mouse_pos.h)/=20 (ticks_elapsed*MAXIMUM_MOUSE_VELOCITY); fixed vy=3D - =20 INTEGER_TO_FIXED(where.v-last_mouse_pos.v)/=20 (ticks_elapsed*MAXIMUM_MOUSE_VELOCITY); /* pin and do nonlinearity */ vx=3D PIN(vx, -FIXED_ONE/2, FIXED_ONE/2), vx>>=3D 1, = vx*=3D (vx<0) ? -vx : =20 vx, vx>>=3D 14; vy=3D PIN(vy, -FIXED_ONE/2, FIXED_ONE/2), vy>>=3D 1, = vy*=3D (vy<0) ? -vy : =20 vy, vy>>=3D 14; // vx=3D PIN(vx, -FIXED_ONE/2, = FIXED_ONE/2); // vy=3D PIN(vy, -FIXED_ONE/2, = FIXED_ONE/2); snapshot_delta_yaw=3D vx; switch (type) { case _mouse_yaw_pitch: snapshot_delta_pitch=3D vy, = snapshot_delta_velocity=3D 0; break; case _mouse_yaw_velocity: snapshot_delta_velocity=3D vy, = snapshot_delta_pitch=3D 0; break; default: halt(); } snapshot_button_state=3D Button(); last_tick_count=3D tick_count; last_mouse_pos=3D where; // dprintf("%08x %08x %08x;g;", = snapshot_delta_yaw, =20 snapshot_delta_pitch, snapshot_delta_velocity); } return; } #endif= |