comparison src/events/SDL_mouse.c @ 3766:24db5d326f57 gsoc2008_manymouse

Pressure levels. Documentation http://wilku.ravenlord.ws/doku.php?id=documentation
author Szymon Wilczek <kazeuser@gmail.com>
date Sun, 06 Jul 2008 09:24:56 +0000
parents ed9b7fe8f902
children abc8acb8e3d7
comparison
equal deleted inserted replaced
3765:ed9b7fe8f902 3766:24db5d326f57
50 } 50 }
51 return SDL_mice[index]; 51 return SDL_mice[index];
52 } 52 }
53 53
54 int 54 int
55 SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name) 55 SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name,int pressure_max,int pressure_min)
56 { 56 {
57 SDL_Mouse **mice; 57 SDL_Mouse **mice;
58 int selected_mouse; 58 int selected_mouse;
59 char* temp_name; 59 char* temp_name;
60 /* Add the mouse to the list of mice */ 60 /* Add the mouse to the list of mice */
76 return -1; 76 return -1;
77 } 77 }
78 *SDL_mice[index] = *mouse; 78 *SDL_mice[index] = *mouse;
79 SDL_mice[index]->name=SDL_malloc(strlen(name)*sizeof(char)); 79 SDL_mice[index]->name=SDL_malloc(strlen(name)*sizeof(char));
80 strcpy(SDL_mice[index]->name,name); 80 strcpy(SDL_mice[index]->name,name);
81 SDL_mice[index]->pressure_max=pressure_max;
82 SDL_mice[index]->pressure_min=pressure_min;
81 SDL_mice[index]->cursor_shown = SDL_TRUE; 83 SDL_mice[index]->cursor_shown = SDL_TRUE;
82 selected_mouse = SDL_SelectMouse(index); 84 selected_mouse = SDL_SelectMouse(index);
83 SDL_mice[index]->cur_cursor = NULL; 85 SDL_mice[index]->cur_cursor = NULL;
84 SDL_mice[index]->def_cursor = 86 SDL_mice[index]->def_cursor =
85 SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH, 87 SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH,
366 } 368 }
367 if (mouse->relative_mode==SDL_TRUE && mouse->proximity==SDL_TRUE) { 369 if (mouse->relative_mode==SDL_TRUE && mouse->proximity==SDL_TRUE) {
368 /* Push the cursor around */ 370 /* Push the cursor around */
369 xrel = x - last_x; 371 xrel = x - last_x;
370 yrel = y - last_y; 372 yrel = y - last_y;
371 //x = (mouse->x + xrel);
372 //y = (mouse->y + yrel);
373 } else { 373 } else {
374 xrel = x - last_x; 374 xrel = x - last_x;
375 yrel = y - last_y; 375 yrel = y - last_y;
376 } 376 }
377 377
436 event.motion.y = mouse->y; 436 event.motion.y = mouse->y;
437 event.motion.pressure= mouse->pressure; 437 event.motion.pressure= mouse->pressure;
438 event.motion.xrel = xrel; 438 event.motion.xrel = xrel;
439 event.motion.yrel = yrel; 439 event.motion.yrel = yrel;
440 event.motion.windowID = mouse->focus; 440 event.motion.windowID = mouse->focus;
441 event.motion.pressure_max=mouse->pressure_max;
442 event.motion.pressure_min=mouse->pressure_min;
441 posted = (SDL_PushEvent(&event) > 0); 443 posted = (SDL_PushEvent(&event) > 0);
442 } 444 }
443 last_x=x; 445 last_x=x;
444 last_y=y; 446 last_y=y;
445 return posted; 447 return posted;