Game Development Reference
In-Depth Information
Marmalade tackles all these issues by automatically converting every GROUP file we
load into its binary equivalent using the serialization functionality provided by the
CIwManaged class.
After the resource group has been fully loaded, the resource manager will call the
Serialise method on every instance of every resource contained within the group,
creating a file with .bin added to the original GROUP's filename. For example, the
resources in a file called images.group would be serialized to a file called images.
group.bin .
Once the serialized version of the GROUP file has been created, the resource
manager destroys the resource group and then recreates it from the newly serialized
version. This step is present as it makes catching problems, such as forgetting to
serialize a member variable of a class, easier to spot.
There is a useful ICF setting that controls the resource building process. Simply add
the following to the ICF file (refer back to Chapter 1 , Getting Started with Marmalade ,
for a discussion of what an ICF file is):
[RESMANAGER]
ResBuild=1
When set to 1 , the ResBuild setting will ensure that the resource manager always
loads the GROUP file and serializes it. By setting it to 0 , the GROUP file parsing
stage is skipped and instead any existing serialized version of the GROUP file will
be loaded directly. This can be very useful during development, to both increase
application startup time when no resources have been added or changed, and also
to match more closely the loading process on the device.
If you've made changes to the resources for your game but they aren't
appearing when you run it, the ResBuild flag is always a good first
port of call. It's amazing how easy it is to make a resource change and
forget that you've disabled resource building!
Resource handlers
There is one final part of the IwResManager API that is worth mentioning, and this is
the concept of resource handlers .
You may have wondered how the resource manager is able to load and process files
of different types. It's great that we can just list a bunch of filenames in a GROUP file,
but how exactly does a PNG format image file end up being loaded into a form that
we can use for rendering? Resource handlers, of course!
 
Search WWH ::




Custom Search