view TaskManager/Test/simple_render/trash/pad.cpp @ 131:805d27efafd8

fix
author gongo@charles.cr.ie.u-ryukyu.ac.jp
date Tue, 25 Nov 2008 17:24:18 +0900
parents b6858e9fe2b4
children
line wrap: on
line source

#include <iostream>
#include <SDL.h>
#include <SDL_opengl.h>
#include "pad.h"
using namespace std;

int pad(int button)
{
  Uint8 *keys=SDL_GetKeyState(NULL);
  
  if(button==UP && keys[SDLK_UP]==SDL_PRESSED)
    {
      return 1;
    }
  if(button==DOWN && keys[SDLK_DOWN]==SDL_PRESSED)
    {
      return 1;
    }
  if(button==RIGHT && keys[SDLK_RIGHT]==SDL_PRESSED)
    {
      return 1;
    }
  if(button==LEFT && keys[SDLK_LEFT]==SDL_PRESSED)
    {
      return 1;
    }
  return 0;
}