Many mouse and tablet linux test file added
authorSzymon Wilczek <kazeuser@gmail.com>
Wed, 27 Aug 2008 13:37:19 +0000
changeset 2734dd25eabe441c
parent 2733 264037dd3c7a
child 2735 204be4fc2726
Many mouse and tablet linux test file added
test/Makefile.in
test/testmmousetablet.c
     1.1 --- a/test/Makefile.in	Tue Aug 26 11:50:37 2008 +0000
     1.2 +++ b/test/Makefile.in	Wed Aug 27 13:37:19 2008 +0000
     1.3 @@ -7,7 +7,7 @@
     1.4  CFLAGS  = @CFLAGS@
     1.5  LIBS	= @LIBS@
     1.6  
     1.7 -TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testaudioinfo$(EXE) testmultiaudio$(EXE) testalpha$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcdrom$(EXE) testcursor$(EXE) testdyngl$(EXE) testerror$(EXE) testfile$(EXE) testgamma$(EXE) testgl$(EXE) testgl2$(EXE) testhread$(EXE) testiconv$(EXE) testjoystick$(EXE) testkeys$(EXE) testlock$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testpalette$(EXE) testplatform$(EXE) testsem$(EXE) testsprite$(EXE) testsprite2$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm$(EXE) testwm2$(EXE) threadwin$(EXE) torturethread$(EXE) testloadso$(EXE) testhaptic$(EXE)
     1.8 +TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testaudioinfo$(EXE) testmultiaudio$(EXE) testalpha$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcdrom$(EXE) testcursor$(EXE) testdyngl$(EXE) testerror$(EXE) testfile$(EXE) testgamma$(EXE) testgl$(EXE) testgl2$(EXE) testhread$(EXE) testiconv$(EXE) testjoystick$(EXE) testkeys$(EXE) testlock$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testpalette$(EXE) testplatform$(EXE) testsem$(EXE) testsprite$(EXE) testsprite2$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm$(EXE) testwm2$(EXE) threadwin$(EXE) torturethread$(EXE) testloadso$(EXE) testhaptic$(EXE) testmmousetablet$(EXE) 
     1.9  
    1.10  all: Makefile $(TARGETS)
    1.11  
    1.12 @@ -128,6 +128,8 @@
    1.13  testhaptic$(EXE): $(srcdir)/testhaptic.c
    1.14  	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
    1.15  
    1.16 +testmmousetablet$(EXE): $(srcdir)/testmmousetablet.c
    1.17 +	$(CC) -o $@ $? $(CFLAGS) $(LIBS)
    1.18  
    1.19  clean:
    1.20  	rm -f $(TARGETS)
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/testmmousetablet.c	Wed Aug 27 13:37:19 2008 +0000
     2.3 @@ -0,0 +1,60 @@
     2.4 +#include <stdio.h>
     2.5 +#include "SDL.h"
     2.6 +
     2.7 +SDL_Surface* screen;
     2.8 +int quit=0;
     2.9 +
    2.10 +int main()
    2.11 +{
    2.12 +	SDL_Event event;
    2.13 +	int mice;
    2.14 +	int i;
    2.15 +	printf("Initing...\n");
    2.16 +	if (SDL_Init(0)!=0) {
    2.17 +		return 1;
    2.18 +    	}
    2.19 +	if (SDL_InitSubSystem(SDL_INIT_VIDEO)!=0) {
    2.20 +		return 1;
    2.21 +	}
    2.22 +	else {
    2.23 +		screen = SDL_SetVideoMode(640, 480, 32, SDL_DOUBLEBUF);
    2.24 +      	}
    2.25 +	mice = SDL_GetNumMice();
    2.26 +	printf("%d pointing devices found\n", mice);
    2.27 +	for(i=0; i<mice; ++i) {
    2.28 +		printf("device index: %d name:%s\n",i,SDL_GetMouseName(i));
    2.29 +	}
    2.30 +	while(quit!=1) {
    2.31 +		if(SDL_PollEvent(&event)==0) {}
    2.32 +		else {
    2.33 +			switch (event.type) {
    2.34 +				case SDL_MOUSEMOTION:
    2.35 +					printf("Device id: %d x: %d y: %d relx: %d rely: %d pressure: %d\n \
    2.36 +					pressure_max: %d pressure_min: %d current cursor:%d\n", event.motion.which, event.motion.x,\
    2.37 +				       	event.motion.y, event.motion.xrel, event.motion.yrel, event.motion.pressure, event.motion.pressure_max,\
    2.38 +				       	event.motion.pressure_min, event.motion.cursor);
    2.39 +				break;
    2.40 +				case SDL_PROXIMITYIN:
    2.41 +					printf("proximity in id: %d x: %d y: %d\n", (int) event.proximity.which, event.proximity.x, event.proximity.y);
    2.42 +				break;
    2.43 +				case SDL_PROXIMITYOUT:
    2.44 +					printf("proximity out id: %d x: %d y: %d\n", (int) event.proximity.which, event.proximity.x, event.proximity.y);
    2.45 +				break;
    2.46 +				case SDL_MOUSEBUTTONDOWN:
    2.47 +					printf("mouse button down id: %d button:%d\n", event.button.which, event.button.button);
    2.48 +				break;
    2.49 +				case SDL_MOUSEBUTTONUP:
    2.50 +					printf("mouse button up id: %d button: %d\n", event.button.which, event.button.button);
    2.51 +				break;
    2.52 +				case SDL_QUIT:
    2.53 +					printf("Quitting\n");
    2.54 +					SDL_QuitSubSystem(SDL_INIT_VIDEO);
    2.55 +					SDL_Quit();
    2.56 +					quit=1;
    2.57 +				break;
    2.58 +			}
    2.59 +		}
    2.60 +	}
    2.61 +	return 0;
    2.62 +}
    2.63 +