mouse problems

Posted By: PlaystationThree

mouse problems - 11/20/08 02:36

I've been trying to work with my mouse i.e. clicking on entities, but even something simple like:

#include <acknex.h>
#include <default.c>

function clickE(){
if(event_type == EVENT_CLICK){
sys_exit("");
}
}

action clickF(){
my.emask |= ENABLE_CLICK;
my.event = clickE;
c_updatehull(me,1);
}
function main(){
level_load(NULL);
wait(2);
ent_create("cube.mdl",vector(50,0,0),clickF);
}


it just doesn't work. I click the cube but nothing happens. Any solutions?
Posted By: heinekenbottle

Re: mouse problems - 11/20/08 03:16

do you have mouse_mode set?

You'll want a function like:

Code:
function initMouse()
{
	mouse_map = mouseMap;	//set the mouse bitmap
	mouse_mode = 2;			//mouse mode is 1 to allow for mouse_force.x/y
	while (mouse_mode > 0) // move it over the screen
  	{  
   	vec_set(mouse_pos,mouse_cursor);	//mouse map is always on the cursor location
   	wait(1);									//avoid endless loops
  	}
}


I usually call it in function main()
Posted By: PlaystationThree

Re: mouse problems - 11/20/08 04:26

Thanks a million man, it's working perfectly now. Thanks!!
© 2023 lite-C Forums