equal
deleted
inserted
replaced
26 #include "SDL_events.h" |
26 #include "SDL_events.h" |
27 #include "SDL_events_c.h" |
27 #include "SDL_events_c.h" |
28 #include "default_cursor.h" |
28 #include "default_cursor.h" |
29 |
29 |
30 |
30 |
31 static int SDL_num_mice; |
31 static int SDL_num_mice=0; |
32 static int SDL_current_mouse; |
32 static int SDL_current_mouse=-1; |
33 static SDL_Mouse **SDL_mice; |
33 static SDL_Mouse **SDL_mice=NULL; |
34 int *SDL_IdIndex; |
34 static int *SDL_IdIndex=NULL; |
35 int SDL_highestId; |
35 static int SDL_highestId=-1; |
36 int last_x, last_y; |
36 static int last_x, last_y; |
37 int x_max, y_max; |
37 int x_max, y_max; |
38 /* Public functions */ |
38 /* Public functions */ |
39 int |
39 int |
40 SDL_MouseInit(void) |
40 SDL_MouseInit(void) |
41 { |
41 { |
54 int |
54 int |
55 SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name,int pressure_max,int pressure_min) |
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 */ |
61 if (index < 0 || index >= SDL_num_mice || SDL_mice[index]) { |
61 if (index < 0 || index >= SDL_num_mice || SDL_mice[index]) { |
62 mice = |
62 mice = |
63 (SDL_Mouse **) SDL_realloc(SDL_mice, |
63 (SDL_Mouse **) SDL_realloc(SDL_mice, |
64 (SDL_num_mice + 1) * sizeof(*mice)); |
64 (SDL_num_mice + 1) * sizeof(*mice)); |
74 if (!SDL_mice[index]) { |
74 if (!SDL_mice[index]) { |
75 SDL_OutOfMemory(); |
75 SDL_OutOfMemory(); |
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(SDL_strlen(name)*sizeof(char)); |
80 strcpy(SDL_mice[index]->name,name); |
80 SDL_strlcpy(SDL_mice[index]->name,name,255); |
81 SDL_mice[index]->pressure_max=pressure_max; |
81 SDL_mice[index]->pressure_max=pressure_max; |
82 SDL_mice[index]->pressure_min=pressure_min; |
82 SDL_mice[index]->pressure_min=pressure_min; |
83 SDL_mice[index]->cursor_shown = SDL_TRUE; |
83 SDL_mice[index]->cursor_shown = SDL_TRUE; |
84 selected_mouse = SDL_SelectMouse(index); |
84 selected_mouse = SDL_SelectMouse(index); |
85 SDL_mice[index]->cur_cursor = NULL; |
85 SDL_mice[index]->cur_cursor = NULL; |
719 } |
719 } |
720 } |
720 } |
721 return shown; |
721 return shown; |
722 } |
722 } |
723 |
723 |
724 void SDL_SetIndexId(int id, int index) |
724 int SDL_SetIndexId(int id, int index) |
725 { |
725 { |
726 if(id>SDL_highestId) |
726 if(id>SDL_highestId) |
727 { |
727 { |
728 int *indexes; |
728 int *indexes; |
729 indexes = |
729 indexes = |
739 } |
739 } |
740 else |
740 else |
741 { |
741 { |
742 SDL_IdIndex[id]=index; |
742 SDL_IdIndex[id]=index; |
743 } |
743 } |
|
744 return 1; |
744 } |
745 } |
745 |
746 |
746 int SDL_GetIndexById(int id) |
747 int SDL_GetIndexById(int id) |
747 { |
748 { |
748 if(id>SDL_highestId) |
749 if(id>SDL_highestId) |