【饥荒随笔】事件系统

本文通过《饥荒》游戏中的事件系统来解释事件的概念,将事件分为输入事件、SG事件和其他事件三类,并介绍了事件队列在处理事件中的作用,探讨了解决卡顿现象的策略,如拆分事件和优化处理顺序。
摘要由CSDN通过智能技术生成

来讲一讲事件

何谓事件?

事件是可以由程序检测到的动作或发生的事情。典型的事件则与程序流同步处理,也就是程序有哪里处理事件的一个或多个专用的地方,常常指一个事件循环。

典型事件的来源包括用户(谁按下一个键上的键盘)。另一个来源是一个硬件设备,如定时器。

任何程序都可以自定义设置触发事件的事情,如完成通信任务。改变其行为响应于事件的函数(被认为是事件驱动的),事件常常具有与目标互动的功能。

 

以上翻译自维基百科Event (computing) 词条,因是英文,所以有一些语句不通顺,特附上原文:

In computing, an event is an action oroccurrence detected by the program that may be handled by the program.Typically events are handled synchronously with the program flow, that is, theprogram has one or more dedicated places where events are handled, frequentlyan event loop. Typical sources of events include the user (who presses a key onthe keyboard, in other words, through a keystroke). Another source is ahardware device such as a timer. Any program can trigger its own custom set ofevents as well, e.g. to communicate the completion of a task. A computerprogram that changes its beha

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值