




免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
毕业设计(论文)外文资料翻译学院(系): 计算机科学与技术学院 专 业: 网络工程 姓 名: 学 号: 外文出处: ai for game developers 附 件: 1.外文原文;2.外文译文。 指导教师评语: 签名: 年 月 日english text: game 2 d technology to realize the quality of the games said animation, many people will be immediately thought directx, yes directdraw are very strong, but not have to use directdraw to just go. behind the animation theory and techniques are all the same, this and end use what api not much (if the api is not too slow words). is the author of the realization of the newimage lib testing results, internal all the pixel data storage and computation are pure software to realize, the last step output to screen use gdi performance than directdraw low less than 10%, in window9x system to low 20% left and right sides, this for many software is absolutely acceptable.the application now interface more does more luxuriant, in addition to support the skin, a lot of people want to join in a program in some such as sprite animation this originally used in game technology, for this reason introducing directx api, apparently was not worth (besides dx version to upgrade frequent, with directgraphic dx8 already replaced directdraw). in this paper the author use standard to realize commercial game gdi functions as an example, take you into the high quality 2 d animation programming domain, and ensure the equipment independence.in we have a proper time to execute the update operation, now let us try animation it. the following code will no longer provide win32 version.in order to narrative is convenient, i need a play the animation window, it must be a derived class of cwnd, assuming this class is called cmyview, we will draw animation in the window. first we for the class add a member function void cmyview: : renderview (), you can use the above mentioned method calls this function.are now ready to work very well, our animation how to store? dont mention animation gif89a format (if you think only have animation gif words, i advise you to do art good, dont do programs), if you just want a simple animation playback of course, but if you want to do complex point, interactive animation, i advise you still dont use that things. assume we have a 4 frame of animation, how to store it? first thing i thought of was save four bmp file, and then read to a cbitmap object the array, but respected master scott meyers warned us not to use polymorphism arrays, because the compiler in some cases cant accurately calculate the size of the array object, so subscript operators will have dire effects. then i thought of use cbitmap pointer arrays, this to is nice, but management up a little trouble. now look at my final solution itthen use it to create a cimagelist object, let us create a careful look at the method, and usebool cimagelist: : create (int cx, int cy, uint nflags, int ninitial, int ngrow);function, the front two parameters used to specify the size of the animation to us. this created an empty imagelist, the advantage of this is extensible line is stronger. next, we need to put the frames the document load to a cbitmap object, you can be put into jpg or gif files to save capacity (if you truly achieve the above code words, you will find that screen flash, very uncomfortable. many people will blame the gdi head, and they will be called ms, said gdi is too slow. in fact not also any write directly the operation of the screen will have flash, under the video memory write directly in dos or use directdraw api to write directly primary surface will shine, because you each update the operation of the show will be users soon see (because the reason and vertical back, may have delay).eliminate flash the simplest and most classical approach is double buffer (double buffer). the so-called double buffer in fact, the truth is very simple, that is to say we in other places (simple said is not aimed at the screen, and dont show place) to open up a storage space, we put all the animation will render to this place, not the direct rendering to screen (on the screen of the storage area). in the gdi, directly to the screen is window dc, not visible place general can use memory dc. in the animation rendering all go to the backstage buffer, then a whole is copied to the buffer screen next time!in pure software 2 d graphics engine, the double buffer generally means that in memory open up a region used to store pixel data. and in the back surface directdraw can create, in all the animation rendering to back suface after on, and then use the flip operation is visible, flip operation because of just set the address of the visible surface, so very fast中文译文: 游戏2d技术说到实现游戏品质的动画,很多人会立刻想到directx,没错directdraw很强大,但是并不是必须用directdraw才行。动画后面的理论和技巧都是一样的,这和末端使用什么api没有太大关系(如果那api不是太慢的话)。就笔者实现的newimage lib的测试结果,内部所有像素数据的存储和运算都纯软件实现,最后一步输出到屏幕使用gdi的性能比directdraw低不到10%,在window9x系统上要低20%左右,这对很多软件来说是绝对可以接受的。现在应用程序界面越做越华丽,除了支持skin外,很多人都想在程序中加入一些例如sprite动画这种原本用在游戏上的技术,因为这原因引入directx api,显然是不值得的(况且dx版本升级频繁,dx8中已经用directgraphic取代了directdraw)。本文将以笔者使用标准gdi函数实现的商业游戏为例,带你进入高品质2d动画编程领域,并且保证其设备无关性。在我们有了一个适当的时机执行更新操作了,现在就让我们试试动画吧。下面的代码将不再提供win32的版本。为了叙述方便,我需要一个播放动画的窗口,它必须是一个cwnd的派生类,假设这个类叫做cmyview,我们将在这个窗口中绘制动画。首先我们为这个类添加一个成员函数”void cmyview:renderview()”,你可以使用上面提到的方法调用这个函数。现在准备工作都做好了,我们的动画该怎么存储呢?别提动画gif89a格式(如果你觉得只有gif才有动画的话,那我劝你去做美术好了,别干程序了),如果你只想要个简单的动画播放当然可以,但是如果你想要做复杂点的,交互式动画,我劝你还是别用那东西。假设我们有一个4帧的动画,怎么存储它呢?我首先想到的就是存4个bmp文件,然后读入到一个cbitmap对象数组中,但是尊敬的大师scott meyers警告我们不要使用多态数组,因为编译器在某些情况下不能准确计算数组中对象的大小,所以下标运算符会产生可怕的效果。然后我就想到了用cbitmap指针数组,这到是不错,不过管理起来稍嫌麻烦。现在看看我最终的解决方法吧然后用它创建一个cimagelist对象,让我们仔细看一下创建的方法,使用bool cimagelist:create( int cx, int cy, uint nflags, int ninitial, int ngrow );函数,前面两
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025届广东省佛山市超盈实验中学七下数学期末复习检测试题含解析
- 个人职业目标提高沟通技巧计划
- 法学概论各知识模块的复习重点试题及答案
- 强化应变能力的自我提升计划
- 快乐学习软件设计师考试的试题及答案
- 艺术展览安保工作的总结与反思计划
- 商业智能基本概念试题及答案
- 班级活动评估与效果反馈计划
- 主管年度创业精神任务计划
- 企业可持续发展与风险考量试题及答案
- 预防基坑坍塌的措施与方法
- 防范金融诈骗安全
- 急诊急救考试题及答案3
- 2025年广东清远市“人才引育”工程专项事业编制高层次人才招聘31人历年自考难、易点模拟试卷(共500题附带答案详解)
- 钢结构机电工程施工方案
- 基于计算思维培养的小学人工智能启蒙教育课程设计与实施
- 机电安装工程总承包合同
- 湘教版四年级下册科学各单元知识点复习
- 课件-2025年春季学期 形势与政策 第一讲-加快建设社会主义文化强国9
- 2025年度江西抚州高新区区属国企业公开招聘纪检监察工作人员10人高频重点模拟试卷提升(共500题附带答案详解)
- 汽车租赁挂靠协议书
评论
0/150
提交评论