游戏2D技术毕业论文外文文献翻译.doc

上传人:仙人指路1688 文档编号:4028740 上传时间:2023-04-01 格式:DOC 页数:6 大小:32KB
返回 下载 相关 举报
游戏2D技术毕业论文外文文献翻译.doc_第1页
第1页 / 共6页
游戏2D技术毕业论文外文文献翻译.doc_第2页
第2页 / 共6页
游戏2D技术毕业论文外文文献翻译.doc_第3页
第3页 / 共6页
游戏2D技术毕业论文外文文献翻译.doc_第4页
第4页 / 共6页
游戏2D技术毕业论文外文文献翻译.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《游戏2D技术毕业论文外文文献翻译.doc》由会员分享,可在线阅读,更多相关《游戏2D技术毕业论文外文文献翻译.doc(6页珍藏版)》请在三一办公上搜索。

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

2、 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

3、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 peop

4、le 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

5、 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 versi

6、on.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 met

7、hod 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

8、 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, be

9、cause 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 CImageLis

10、t 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

11、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,

12、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 th

13、e 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 ope

14、n 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, t

15、hen 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 t

16、he 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的性能

17、比DirectDraw低不到10%,在Window9X系统上要低20%左右,这对很多软件来说是绝对可以接受的。现在应用程序界面越做越华丽,除了支持SKIN外,很多人都想在程序中加入一些例如sprite动画这种原本用在游戏上的技术,因为这原因引入DirectX API,显然是不值得的(况且DX版本升级频繁,DX8中已经用DirectGraphic取代了DirectDraw)。本文将以笔者使用标准GDI函数实现的商业游戏为例,带你进入高品质2D动画编程领域,并且保证其设备无关性。在我们有了一个适当的时机执行更新操作了,现在就让我们试试动画吧。下面的代码将不再提供Win32的版本。为了叙述方便,我需

18、要一个播放动画的窗口,它必须是一个CWnd的派生类,假设这个类叫做CMyView,我们将在这个窗口中绘制动画。首先我们为这个类添加一个成员函数”void CMyView:RenderView()”,你可以使用上面提到的方法调用这个函数。现在准备工作都做好了,我们的动画该怎么存储呢?别提动画GIF89a格式(如果你觉得只有GIF才有动画的话,那我劝你去做美术好了,别干程序了),如果你只想要个简单的动画播放当然可以,但是如果你想要做复杂点的,交互式动画,我劝你还是别用那东西。假设我们有一个4帧的动画,怎么存储它呢?我首先想到的就是存4个BMP文件,然后读入到一个CBitmap对象数组中,但是尊敬的

19、大师Scott Meyers警告我们不要使用多态数组,因为编译器在某些情况下不能准确计算数组中对象的大小,所以下标运算符会产生可怕的效果。然后我就想到了用CBitmap指针数组,这到是不错,不过管理起来稍嫌麻烦。现在看看我最终的解决方法吧然后用它创建一个CImageList对象,让我们仔细看一下创建的方法,使用BOOL CImageList:Create( int cx, int cy, UINT nFlags, int nInitial, int nGrow );函数,前面两个参数用来指定我们一帧动画的尺寸。这样就创建了一个空的ImageList,这样做的好处是可扩展行比较强。下面我们需要把

20、那个帧序列文件Load到一个CBitmap对象中,你可以存成JPG或者GIF文件来节省容量( 如果你真正实现上面的代码的话,你会发现画面一闪一闪的,十分的不爽。很多人都会怪到GDI头上,他们又会骂MS,说GDI太慢了。其实非也任何直接写屏幕的操作都会产生闪烁,在DOS下直接写显存或者用DirectDraw API直接写Primary Surface都会闪烁,因为你每个更新显示的操作都会被用户马上看到(因为垂直回扫的原因, 或许会有延迟)。 消除闪烁最简单也是最经典的方法就是双缓冲(Double buffer)。所谓的双缓冲其实道理非常简单,就是说我们在其它地方(简单的说就是不针对屏幕,不显示出来的地方)开辟一个存储空间,我们把所有的动画都要渲染到这个地方,而不是直接渲染到屏幕上(针对屏幕的存储区域)。在GDI中,直接针对屏幕就是窗口DC,”不可见的地方”一般可以用Memory DC。在把所有动画渲染到后台缓冲之后,再一下次整体拷贝到屏幕缓冲区!在纯软件2D图形引擎中,双缓冲一般意味着在内存中开辟一个区域用来存储像素数据。而在DirectDraw中可以创建Back Surface,在把所有动画渲染到Back Suface上之后,然后使用Flip操作使其可见,Flip操作因为只是设置可见surface的地址,所以非常快速

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 办公文档 > 其他范文


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号