Mercurial > sdl-ios-xcode
comparison test/testmmousetablet.c @ 2734:dd25eabe441c
Many mouse and tablet linux test file added
author | Szymon Wilczek <kazeuser@gmail.com> |
---|---|
date | Wed, 27 Aug 2008 13:37:19 +0000 |
parents | |
children | ae653575d4af |
comparison
equal
deleted
inserted
replaced
2733:264037dd3c7a | 2734:dd25eabe441c |
---|---|
1 #include <stdio.h> | |
2 #include "SDL.h" | |
3 | |
4 SDL_Surface* screen; | |
5 int quit=0; | |
6 | |
7 int main() | |
8 { | |
9 SDL_Event event; | |
10 int mice; | |
11 int i; | |
12 printf("Initing...\n"); | |
13 if (SDL_Init(0)!=0) { | |
14 return 1; | |
15 } | |
16 if (SDL_InitSubSystem(SDL_INIT_VIDEO)!=0) { | |
17 return 1; | |
18 } | |
19 else { | |
20 screen = SDL_SetVideoMode(640, 480, 32, SDL_DOUBLEBUF); | |
21 } | |
22 mice = SDL_GetNumMice(); | |
23 printf("%d pointing devices found\n", mice); | |
24 for(i=0; i<mice; ++i) { | |
25 printf("device index: %d name:%s\n",i,SDL_GetMouseName(i)); | |
26 } | |
27 while(quit!=1) { | |
28 if(SDL_PollEvent(&event)==0) {} | |
29 else { | |
30 switch (event.type) { | |
31 case SDL_MOUSEMOTION: | |
32 printf("Device id: %d x: %d y: %d relx: %d rely: %d pressure: %d\n \ | |
33 pressure_max: %d pressure_min: %d current cursor:%d\n", event.motion.which, event.motion.x,\ | |
34 event.motion.y, event.motion.xrel, event.motion.yrel, event.motion.pressure, event.motion.pressure_max,\ | |
35 event.motion.pressure_min, event.motion.cursor); | |
36 break; | |
37 case SDL_PROXIMITYIN: | |
38 printf("proximity in id: %d x: %d y: %d\n", (int) event.proximity.which, event.proximity.x, event.proximity.y); | |
39 break; | |
40 case SDL_PROXIMITYOUT: | |
41 printf("proximity out id: %d x: %d y: %d\n", (int) event.proximity.which, event.proximity.x, event.proximity.y); | |
42 break; | |
43 case SDL_MOUSEBUTTONDOWN: | |
44 printf("mouse button down id: %d button:%d\n", event.button.which, event.button.button); | |
45 break; | |
46 case SDL_MOUSEBUTTONUP: | |
47 printf("mouse button up id: %d button: %d\n", event.button.which, event.button.button); | |
48 break; | |
49 case SDL_QUIT: | |
50 printf("Quitting\n"); | |
51 SDL_QuitSubSystem(SDL_INIT_VIDEO); | |
52 SDL_Quit(); | |
53 quit=1; | |
54 break; | |
55 } | |
56 } | |
57 } | |
58 return 0; | |
59 } | |
60 |