test/testmmousetablet.c
author Bob Pendleton <bob@pendleton.com>
Wed, 23 Sep 2009 02:52:11 +0000
changeset 3299 975fd903466b
parent 2736 ae653575d4af
permissions -rw-r--r--
int testmmousetable.c the arguments to main() are not compatible with what is required in SDL_main.h
Cleaned up testatomic.c to use the same syntax as every other test program.
kazeuser@2734
     1
#include <stdio.h>
kazeuser@2734
     2
#include "SDL.h"
kazeuser@2734
     3
slouken@2736
     4
SDL_Surface *screen;
slouken@2736
     5
int quit = 0;
kazeuser@2734
     6
slouken@2736
     7
int
bob@3299
     8
main(int argc, char *argv[])
kazeuser@2734
     9
{
slouken@2736
    10
    SDL_Event event;
slouken@2736
    11
    int mice;
slouken@2736
    12
    int i;
slouken@2736
    13
    printf("Initing...\n");
slouken@2736
    14
    if (SDL_Init(0) != 0) {
slouken@2736
    15
        return 1;
slouken@2736
    16
    }
slouken@2736
    17
    if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
slouken@2736
    18
        return 1;
slouken@2736
    19
    } else {
slouken@2736
    20
        screen = SDL_SetVideoMode(640, 480, 32, SDL_DOUBLEBUF);
slouken@2736
    21
    }
slouken@2736
    22
    mice = SDL_GetNumMice();
slouken@2736
    23
    printf("%d pointing devices found\n", mice);
slouken@2736
    24
    for (i = 0; i < mice; ++i) {
slouken@2736
    25
        printf("device index: %d name:%s\n", i, SDL_GetMouseName(i));
slouken@2736
    26
    }
slouken@2736
    27
    while (quit != 1) {
slouken@2736
    28
        if (SDL_PollEvent(&event) == 0) {
slouken@2736
    29
        } else {
slouken@2736
    30
            switch (event.type) {
slouken@2736
    31
            case SDL_MOUSEMOTION:
slouken@2736
    32
                printf
slouken@2736
    33
                    ("Device id: %d x: %d y: %d relx: %d rely: %d pressure: %d\n \
slouken@2736
    34
					pressure_max: %d pressure_min: %d current cursor:%d\n",
slouken@2736
    35
                     event.motion.which, event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel,
slouken@2736
    36
                     event.motion.pressure, event.motion.pressure_max, event.motion.pressure_min,
slouken@2736
    37
                     event.motion.cursor);
slouken@2736
    38
                break;
slouken@2736
    39
            case SDL_PROXIMITYIN:
slouken@2736
    40
                printf("proximity in id: %d x: %d y: %d\n",
slouken@2736
    41
                       (int) event.proximity.which, event.proximity.x,
slouken@2736
    42
                       event.proximity.y);
slouken@2736
    43
                break;
slouken@2736
    44
            case SDL_PROXIMITYOUT:
slouken@2736
    45
                printf("proximity out id: %d x: %d y: %d\n",
slouken@2736
    46
                       (int) event.proximity.which, event.proximity.x,
slouken@2736
    47
                       event.proximity.y);
slouken@2736
    48
                break;
slouken@2736
    49
            case SDL_MOUSEBUTTONDOWN:
slouken@2736
    50
                printf("mouse button down id: %d button:%d\n",
slouken@2736
    51
                       event.button.which, event.button.button);
slouken@2736
    52
                break;
slouken@2736
    53
            case SDL_MOUSEBUTTONUP:
slouken@2736
    54
                printf("mouse button up id: %d button: %d\n",
slouken@2736
    55
                       event.button.which, event.button.button);
slouken@2736
    56
                break;
slouken@2736
    57
            case SDL_QUIT:
slouken@2736
    58
                printf("Quitting\n");
slouken@2736
    59
                SDL_QuitSubSystem(SDL_INIT_VIDEO);
slouken@2736
    60
                SDL_Quit();
slouken@2736
    61
                quit = 1;
slouken@2736
    62
                break;
slouken@2736
    63
            }
slouken@2736
    64
        }
slouken@2736
    65
    }
slouken@2736
    66
    return 0;
kazeuser@2734
    67
}