SDL 学习及相关API

SDL_PeepEvents() 在事件队列中搜索特定类型的事件。

int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 mask);


Description
Checks the event queue for messages and optionally returns them.

If action is SDL_ADDEVENT, up to numevents events will be added to the back of the event queue.

If action is SDL_PEEKEVENT, up to numevents events at the front of the event queue, matching mask, will be returned and will not be removed from the queue.

If action is SDL_GETEVENT, up to numevents events at the front of the event queue, matching mask, will be returned and will be removed from the queue.

This function is thread-safe.

Return Value
This function returns the number of events actually stored, or -1 if there was an error.

 

SDL_PollEvents()函数的功能是事件轮询。首先通过SDL_PumpEvents函数来处理硬件独立的事件后,再通过SDL_PeepEvents从队列中提取事件。
另外还有两个事件处理函数:
SDL_WaitEvent()必须等到有一个事件才返回,而SDL_PollEvent 没有事件也立即返回,这样提高系统反应速度。
SDL_PeepEvents()是提出查看事件,但事件本身仍然在事件队列中。

 

SDL键盘事件

http://blog.csdn.net/noback7/article/details/7209271

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值