See what's going on with flipcode!




This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.

 

  Fast Data Loading
  Submitted by



Here is a little trick that I picked up along the way that allows for data to be loaded quickly. Say for example, that you have a height map that has been saved to a file, or level data for that matter. It is possible to load the file with one simple command.

int heightMap[] = 
{
  #include "heightMap.data"
}; 



This trick will load all of the data within the "heightMap.data" file into the given array. It is important to note that the "heightMap.data" file must be properly formatted, comma delimited, however this is usually not hard to resolve. While this technique is only useful with static data files, I have found this to be a useful technique for quickly loading data until all of the loading routines are complete.

Any questions, let me know.

- Peter Dalton
pdalton@xmission.com
http://www.xmission.com/~pdalton

The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.

 

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.