文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>SDL 鼠标事件处理

SDL 鼠标事件处理

时间:2010-08-21  来源:bluedrum

Andrew Huang [email protected]     一.SDL鼠标事件 ------------------------------------------------------------------     在SDL中,对鼠标事件处理,也是非常重要的。  

typedef struct{
  Uint8 type;
  Uint8 which;
  Uint8 button;
  Uint8 state;
  Uint16 x, y;
} SDL_MouseButtonEvent;

主要有如下几个事件      SDL_MOUSEBUTTONDOWN: 某个键按下。    SDL_MOUSEBUTTONUP  :某个键松开          其中 x是点击X坐标          y是点击Y坐标      button是指哪一个键(SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT, SDL_BUTTON_WHEELUP, SDL_BUTTON_WHEELDOWN)           

SDL_MOUSEMOTION 鼠标轨迹侦测事件,即鼠标划过屏幕时,有具体的反应

          

typedef struct{
  Uint8 type;
  Uint8 state;
  Uint16 x, y;
  Sint16 xrel, yrel;
} SDL_MouseMotionEvent;


在这个事件,将采用 SDL_GetMouseState()判断是按下哪一个键
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载