test/testjoystick.c
branchgsoc2008_iphone
changeset 2433 450a9bf50c37
parent 2201 6280c111ee80
equal deleted inserted replaced
2432:daf3baf72a45 2433:450a9bf50c37
     5 #include <stdlib.h>
     5 #include <stdlib.h>
     6 #include <string.h>
     6 #include <string.h>
     7 
     7 
     8 #include "SDL.h"
     8 #include "SDL.h"
     9 
     9 
       
    10 #ifdef __IPHONEOS__
       
    11 #define SCREEN_WIDTH	320
       
    12 #define SCREEN_HEIGHT	480
       
    13 #else 
    10 #define SCREEN_WIDTH	640
    14 #define SCREEN_WIDTH	640
    11 #define SCREEN_HEIGHT	480
    15 #define SCREEN_HEIGHT	480
       
    16 #endif
    12 
    17 
    13 void
    18 void
    14 WatchJoystick(SDL_Joystick * joystick)
    19 WatchJoystick(SDL_Joystick * joystick)
    15 {
    20 {
    16     SDL_Surface *screen;
    21     SDL_Surface *screen;
   127             if (y < 0) {
   132             if (y < 0) {
   128                 y = 0;
   133                 y = 0;
   129             } else if (y > (SCREEN_HEIGHT - 16)) {
   134             } else if (y > (SCREEN_HEIGHT - 16)) {
   130                 y = SCREEN_HEIGHT - 16;
   135                 y = SCREEN_HEIGHT - 16;
   131             }
   136             }
       
   137 						
   132             axis_area[i][draw].x = (Sint16) x;
   138             axis_area[i][draw].x = (Sint16) x;
   133             axis_area[i][draw].y = (Sint16) y;
   139             axis_area[i][draw].y = (Sint16) y;
   134             axis_area[i][draw].w = 16;
   140             axis_area[i][draw].w = 16;
   135             axis_area[i][draw].h = 16;
   141             axis_area[i][draw].h = 16;
   136             SDL_FillRect(screen, &axis_area[i][draw], 0xFFFF);
   142             SDL_FillRect(screen, &axis_area[i][draw], 0xFFFF);