摘要
用C语言实现计算机动画时,往往使用一个大概时长作为画面之间的延时。该做法会使得不同画面的帧时长不相等,从而无法实现对动画速度的准确控制。针对该问题,对延时函数进行了改进,能按指定的帧时长进行自适应延时。以该理论为基础,进一步提出一种以固定帧率更新画面的编程方法,适用于编写需要按时更新画面的动画、游戏和应用程序。最后,以C语言编写控制台窗口文本界面下的"英文对话动态演示"应用程序为例,展示了该方法的应用。
To implement computer animation with C language, often use approximate duration as the delay between the frames.This will make the different time length between different frames, making it impossible to achieve accurate control over the speed of the animation. To solve this problem, the sleep function is improved and the adaptive delay can be carried out accord- ing to the specified frame time length. On this basis, further proposed a programming method to update frames with fixed frame rate, suitable for animation, games and applications. Finally, the application of this method is demonstrated by the example of "English Dialogue Dynamic Demonstration" under textual interface of the windows console in C language.
作者
耿植
GENG Zhi (Guizhou Institute of Technology, Guiyang 550003, China)
出处
《电脑知识与技术》
2017年第1期46-48,共3页
Computer Knowledge and Technology
关键词
计算机动画
帧率
延时
C语言
编程方法
computer animation
flame rate
delay
C language
programming method