comparison src/events/SDL_mouse.c @ 3776:a9c2a7071874 gsoc2008_manymouse

upgraded functions
author Szymon Wilczek <kazeuser@gmail.com>
date Wed, 06 Aug 2008 08:48:43 +0000
parents 8b5b67000dc0
children 54d08ecec1cb
comparison
equal deleted inserted replaced
3775:e5011833348a 3776:a9c2a7071874
172 } 172 }
173 return SDL_current_mouse; 173 return SDL_current_mouse;
174 } 174 }
175 175
176 SDL_WindowID 176 SDL_WindowID
177 SDL_GetMouseFocusWindow() 177 SDL_GetMouseFocusWindow(int index)
178 { 178 {
179 SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); 179 SDL_Mouse *mouse = SDL_GetMouse(index);
180 180
181 if (!mouse) { 181 if (!mouse) {
182 return 0; 182 return 0;
183 } 183 }
184 return mouse->focus; 184 return mouse->focus;
194 return 1; 194 return 1;
195 } 195 }
196 } 196 }
197 197
198 int 198 int
199 SDL_SetRelativeMouseMode(SDL_bool enabled, int index) 199 SDL_SetRelativeMouseMode(int index, SDL_bool enabled)
200 { 200 {
201 SDL_Mouse *mouse = SDL_GetMouse(index); 201 SDL_Mouse *mouse = SDL_GetMouse(index);
202 202
203 if (!mouse) { 203 if (!mouse) {
204 return -1; 204 return -1;
222 } 222 }
223 return 0; 223 return 0;
224 } 224 }
225 225
226 SDL_bool 226 SDL_bool
227 SDL_GetRelativeMouseMode() 227 SDL_GetRelativeMouseMode(int index)
228 { 228 {
229 SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); 229 SDL_Mouse *mouse = SDL_GetMouse(index);
230 230
231 if (!mouse) { 231 if (!mouse) {
232 return SDL_FALSE; 232 return SDL_FALSE;
233 } 233 }
234 return mouse->relative_mode; 234 return mouse->relative_mode;
235 } 235 }
236 236
237 Uint8 237 Uint8
238 SDL_GetMouseState(int *x, int *y) 238 SDL_GetMouseState(int index, int *x, int *y)
239 { 239 {
240 SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); 240 SDL_Mouse *mouse = SDL_GetMouse(index);
241 241
242 if (!mouse) { 242 if (!mouse) {
243 if (x) { 243 if (x) {
244 *x = 0; 244 *x = 0;
245 } 245 }
257 } 257 }
258 return mouse->buttonstate; 258 return mouse->buttonstate;
259 } 259 }
260 260
261 Uint8 261 Uint8
262 SDL_GetRelativeMouseState(int *x, int *y) 262 SDL_GetRelativeMouseState(int index, int *x, int *y)
263 { 263 {
264 SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse); 264 SDL_Mouse *mouse = SDL_GetMouse(index);
265 265
266 if (!mouse) { 266 if (!mouse) {
267 if (x) { 267 if (x) {
268 *x = 0; 268 *x = 0;
269 } 269 }
492 } 492 }
493 type = SDL_MOUSEBUTTONDOWN; 493 type = SDL_MOUSEBUTTONDOWN;
494 mouse->buttonstate |= SDL_BUTTON(button); 494 mouse->buttonstate |= SDL_BUTTON(button);
495 break; 495 break;
496 case SDL_RELEASED: 496 case SDL_RELEASED:
497 //if (!(mouse->buttonstate & SDL_BUTTON(button))) {
498 // /* Ignore this event, no state change */
499 // return 0;
500 //}*/
501 type = SDL_MOUSEBUTTONUP; 497 type = SDL_MOUSEBUTTONUP;
502 mouse->buttonstate &= ~SDL_BUTTON(button); 498 mouse->buttonstate &= ~SDL_BUTTON(button);
503 break; 499 break;
504 default: 500 default:
505 /* Invalid state -- bail */ 501 /* Invalid state -- bail */
807 SDL_mice[index]->current_end=end; 803 SDL_mice[index]->current_end=end;
808 } 804 }
809 805
810 int SDL_GetCursorsNumber(int index) 806 int SDL_GetCursorsNumber(int index)
811 { 807 {
812 if(index>=SDL_num_mice) 808 SDL_Mouse* mouse = SDL_GetMouse(index);
813 { 809 if(!mouse)
814 return -1; 810 {
815 } 811 return -1;
816 if(SDL_mice[index]==NULL) 812 }
817 { 813 return mouse->total_ends;
818 return -1; 814 }
819 } 815
820 return SDL_mice[index]->total_ends; 816 int SDL_GetCurrentCursor(int index)
817 {
818 SDL_Mouse* mouse = SDL_GetMouse(index);
819 if(!mouse)
820 {
821 return -1;
822 }
823 return mouse->current_end;
821 } 824 }
822 /* vi: set ts=4 sw=4 expandtab: */ 825 /* vi: set ts=4 sw=4 expandtab: */
823 826