人气 214

[游戏程序] [转帖]文字特效 [复制链接]

九艺网 2017-3-10 17:01:54

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
这篇文章由于内容过少似乎不足于成为这个系列文档中的一篇,关于包含在这篇文章里的知识点的更多介绍和例子请参照上面提供的链接,这篇文章来源于我的一个想法:在我的游戏中放置一个全屏显示的Logo画面,内容可以是版权声明等,如果要使用文本,很明显,这个文本在这个Logo上最好要是动画的.
看演示程序永远是最好的理解上面那段话最好的方式,你将在程序里看到一个动人的画面,虽然不是3D的,但是它足够简单,并且几乎现在每台计算机都支持这种方式,当然,更重要的,这种方式在速度上也会是很快的.
通常情况下,你在绘图页上输出的文本只有一种颜色,除非你做一点处理:比如你可以使用你自己写的文本绘制过程,或者使用一种不常见的字体,在我们的例子中,正是利用了本段开头谈到的只能输出一种颜色文本的这个"缺点"构造了一个新的效果,这种"绕过"缺点而把它转为优点的工作到底是怎么样进行的呢:因为文本只能是一种颜色,我们可以使它透明显示,这表明你可以透过文本看到它下面的页面内容,如果我们在它下面放置一些美观的东西,比如一些动画图片,文本显示会不会因此成为非静态的呢?如果会的话,我们就达到了绕过上面谈到的缺点而使文本显示的效果变好的目的.
这样的话,只是通过一个小小的聪明的想法,我们就在现有资源的基础上,构造了一个美好的文本显示的视觉效果,当然这只是想法而已,我们得编程使它变为现实.
We'll need some animated textures - not too difficult. Just draw some. Keep them small, otherwise they'll slow the program down.
We'll tile the animation onto one surface; make it a vertical surface to avoid the problems with wide surfaces.
We dont need to have a pre-drawn surface for the text - we can create a blank surface and draw the text on ourselves.
我们将使用到一些动画文本,
We'll use a source colour key rather than a detination colour key - as there's much better support for the source colour key.
Here's the texture we'll be using. It's going to be made up of 20 frames - 10 up, 10 down, to get everything moving smoothly. The text to be drawn will be size 20; so we need the texture to be 30 pixels high - 20 of these means that it'll be 600 pixels high in total. Not too bad. The width needs to be 300 pixels to suit our text. Overall dimensions = 600x300.

It may look small, but when the screen is at 640x480 it won't be too bad.
Download the example program - it's the only way you'll see proper animation. You can get it from the top of this page, or from the downloads page.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|小黑屋|九艺游戏动画论坛 ( 津ICP备2022000452号-1 )

GMT+8, 2024-4-19 05:38 , Processed in 0.057381 second(s), 23 queries .

Powered by Discuz! X3.4  © 2001-2017 Discuz Team.