Forum

CSQC Mouse Control

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

CSQC Mouse Control

Postby Error » Wed Apr 08, 2009 9:52 am

I'm confused about how to get a mouse on the screen in csqc. I only see 2 builtins that are probably used for such a task. I've said it before and I'll say it again! WE NEED MORE CSQC TUTORIALS :)

vector () getmousepos = #344;
void (float f) setwantsmousemove = #343;
User avatar
Error
InsideQC Staff
 
Posts: 865
Joined: Fri Nov 05, 2004 5:15 am
Location: VA, USA

Postby Spike » Wed Apr 08, 2009 10:12 am

float(float event, float parama, float paramb) CSQC_InputEvent;
event is one of: 0:key pressed, 1:key released, 2:mouse move.
mouse movement is not yet notified. Call getmousepos to find where the cursor currently is.
This is called if setwantskeys was last called with the parameter true.
This func returns a value. "false" signalize that engine *should* take care of the keypress, a return value of true will make the engine otherwise ignore the event ever happened. This helps to use only keys that are really needed.
With keyboard events, parama is set to the keycode. The key values are as in the menu.dat (and DarkPlaces), and consistant between engines.
With mouse movement events, parama contains the X motion of the mouse, while paramb contains the Y motion of the mouse.


I'm not sure how sustainable that is.
Tbh I've no idea. My original docs don't describe any more.
If I were to design it now I'd probably make mouse events always go through InputEvent, and allow getmousepos only when explicitly enabled (thereby releasing the cursor in windowed mode, but leaving it invisible).
DP probably does it some other way.
I really can't remember how FTE works here: 'mouse movement is not yet notified' is likely still true, unfortunatly.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest