Game Development Reference
In-Depth Information
If the answer to these questionsisyes,thenyoucanprobably
use the vector elements without consequence by simply exporting
them as bitmaps or caching them to the GPU first. Bitmap/GPU
caching is the process of storing a
of a graphical ele-
ment in memory on the video card of the device, thereby not
requiring the CPU to render it every frame. If the art is for an ani-
mation sequence (and therefore not static), such as a character
running or an explosion, it is not going to be a good candidate to
keep in vector graphics. It is better for this type of art be imported
as a bitmap sequence because caching relies on the content of a
DisplayObject not changing over time to recognize a savings in
resources. We
snapshot
ll look at a couple of examples of bitmap caching a
little later in this chapter.
'
Text
Text in Flash on iOS falls along similar lines as vector shapes. This
is because static text (text that is baked into the SWF rather than
editable or changeable at runtime) is actually converted to vector
shapes by the Flash compiler when creating a SWF file. All the
same rules therefore apply to static text as to vector shapes. If you
need the flexibility of editable text in the Flash IDE (and really,
who doesn
t?),trytofindawaytogroupthetextintoDisplayOb-
jects that can then be cached to the GPU. If the text is heavily treat-
ed/processed in some way (with multiple filters, for instance), or
uses a very complex, detailed font, it can still be advisable to first
flatten the text into a bitmap in a program like Fireworks or
Photoshop.
Dynamic text (or in fringe cases, Input text) is a somewhat dif-
ferent beast. Unless you
'
re treating every element in your game ico-
nically or graphically, at some point you
'
'
ll need some kind of text,
so it
re
using a text field to display some type of changing, in-game infor-
mation,likeascoreornumberoflives,thereisreallynothingto
be gained by caching it. In this case, it
'
s important that you use it as carefully as possible. If you
'
s best to pick a font that has
a relatively simple character set or a system font such as Arial or
Verdana. Sometimes fonts such as these (which are often the bane
of designers with typography experience) are not stylistically appro-
priate for the task at hand, so this is an area for aesthetic and func-
tional compromise. In some scenarios, there might be a limited
number of values a text field can have, such as when using words
instead of numbers to display a particular aspect of a game. For
instance, if you had a text field in your interface that had the
optional values of High, Medium, and Low, you could
'
this
text either as cached static text or as a pre-rendered bitmap and
simply swap out the appropriate DisplayObject at a given moment.
This limits the number of characters that must be embedded from
bake
Search Nedrilad ::




Custom Search