src/video/nds/SDL_ndsevents.c
author Darren Alton <dalton@stevens.edu>
Sat, 06 Sep 2008 00:10:16 +0000
changeset 2749 1c5f440a60fe
parent 2735 204be4fc2726
child 2750 e3affc66d963
permissions -rw-r--r--
Initial work for NDS haptic support.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 /* Being a null driver, there's no event stream. We just define stubs for
    25    most of the API. */
    26 
    27 #include <stdio.h>
    28 #include <stdlib.h>
    29 #include <nds.h>
    30 
    31 #include "SDL.h"
    32 #include "../../events/SDL_sysevents.h"
    33 #include "../../events/SDL_events_c.h"
    34 
    35 #include "SDL_ndsvideo.h"
    36 #include "SDL_ndsevents_c.h"
    37 
    38 void
    39 NDS_PumpEvents(_THIS)
    40 {
    41     scanKeys();
    42     /* TODO: defer click-age */
    43     if (keysDown() & KEY_TOUCH) {
    44         SDL_SendMouseButton(0, SDL_PRESSED, 0);
    45     } else if (keysUp() & KEY_TOUCH) {
    46         SDL_SendMouseButton(0, SDL_RELEASED, 0);
    47     }
    48     if (keysHeld() & KEY_TOUCH) {
    49         touchPosition t = touchReadXY();
    50         SDL_SendMouseMotion(0, 0, t.px, t.py, 1); /* last arg is pressure,
    51                                                      hardcoded 1 for now */
    52     }
    53 }
    54 
    55 /* vi: set ts=4 sw=4 expandtab: */