annotate test/testmmousetablet.c @ 3202:3aa519a5c676

I've made so many changes I don't dare continue until I check the current stuff in. /test/testatomic.c performs absolutely basic tests to show that the function work as expected. Need a second test to do more detailed tests. /include/SDL_atomic.h provides declarations for all included functions. /src/atomic/linux/SDL_atomic.c provided all the functions. On a generic built the 64 bit functions work, but they are emulated. On a build for -march=pentium and above the 64 bit functions use native instructions /src/atomic/dummy/SDL_atomic.c emulates all the operations using SDL_mutex.h. /src/atomic/win32/SDL_atomic.c is a copy of dummy /src/atomic/macosx/SDL_atomic.s is a copy of dummy These versions of SDL_atomic.c provide a frame work for building the library with a mixture of native and emulated functions. This allows the whole library to be provided on all platforms. (I hope.) I hope this fits with the SDL philosophy of either providing a common subset or emulating when the platform is missing a feature. I have not added dummy, macosx, or win32 to the build. They are there as place holders for future work. I have modified congifure.in to compile sources in /src/atomic/linux. (The SDL configure.in file is an amazing piece of work and I hope I didn't mess it up. :-)
author Bob Pendleton <bob@pendleton.com>
date Mon, 29 Jun 2009 19:54:43 +0000
parents ae653575d4af
children 975fd903466b
rev   line source
2734
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
1 #include <stdio.h>
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
2 #include "SDL.h"
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
3
2736
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
4 SDL_Surface *screen;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
5 int quit = 0;
2734
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
6
2736
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
7 int
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
8 main()
2734
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
9 {
2736
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
10 SDL_Event event;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
11 int mice;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
12 int i;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
13 printf("Initing...\n");
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
14 if (SDL_Init(0) != 0) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
15 return 1;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
16 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
17 if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
18 return 1;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
19 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
20 screen = SDL_SetVideoMode(640, 480, 32, SDL_DOUBLEBUF);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
21 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
22 mice = SDL_GetNumMice();
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
23 printf("%d pointing devices found\n", mice);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
24 for (i = 0; i < mice; ++i) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
25 printf("device index: %d name:%s\n", i, SDL_GetMouseName(i));
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
26 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
27 while (quit != 1) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
28 if (SDL_PollEvent(&event) == 0) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
29 } else {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
30 switch (event.type) {
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
31 case SDL_MOUSEMOTION:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
32 printf
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
33 ("Device id: %d x: %d y: %d relx: %d rely: %d pressure: %d\n \
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
34 pressure_max: %d pressure_min: %d current cursor:%d\n",
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
35 event.motion.which, event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel,
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
36 event.motion.pressure, event.motion.pressure_max, event.motion.pressure_min,
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
37 event.motion.cursor);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
38 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
39 case SDL_PROXIMITYIN:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
40 printf("proximity in id: %d x: %d y: %d\n",
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
41 (int) event.proximity.which, event.proximity.x,
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
42 event.proximity.y);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
43 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
44 case SDL_PROXIMITYOUT:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
45 printf("proximity out id: %d x: %d y: %d\n",
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
46 (int) event.proximity.which, event.proximity.x,
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
47 event.proximity.y);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
48 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
49 case SDL_MOUSEBUTTONDOWN:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
50 printf("mouse button down id: %d button:%d\n",
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
51 event.button.which, event.button.button);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
52 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
53 case SDL_MOUSEBUTTONUP:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
54 printf("mouse button up id: %d button: %d\n",
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
55 event.button.which, event.button.button);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
56 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
57 case SDL_QUIT:
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
58 printf("Quitting\n");
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
59 SDL_QuitSubSystem(SDL_INIT_VIDEO);
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
60 SDL_Quit();
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
61 quit = 1;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
62 break;
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
63 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
64 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
65 }
Sam Lantinga <slouken@libsdl.org>
parents: 2734
diff changeset
66 return 0;
2734
dd25eabe441c Many mouse and tablet linux test file added
Szymon Wilczek <kazeuser@gmail.com>
parents:
diff changeset
67 }