Advertisement Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Whee, String Theory

Sign in to follow this  
Evil Steve


I made a config file loader. Well, I converted some old code, so it uses a callback to read a line. That way I can easily read data from resources. I just have this code:

// Function to load a config file from a binary resource //
bool LoadConfigFromResource(CConfigFile& rConfig, const std::string& strName)
CBinaryResource* pResource;

// Load the resource //
pResource = (CBinaryResource*)CResourceManager::Get().GetResource(strName.c_str(),CResource::Binary);
return false;

// Load the config //
return false;

// Cleanup and return //
return true;

// Function to read a line from a resource. CConfigFile::Load() callback //
bool ReadLineFromResource(std::string& rLine, void* pContext)
CBinaryResource* pResource = (CBinaryResource*)pContext;
char ch;

rLine = "";

// First, Eat '\r' & '\n' //
do {
if(!pResource->ReadByte((BYTE&)ch)) return false;
} while((ch == '\r') || (ch == '\n'));

// Read up to next '\r' or '\n' //
do {
rLine += ch;
if(!pResource->ReadByte((BYTE&)ch)) return (rLine.length() != 0);
} while((ch != '\r') && (ch != '\n'));
return true;

And I also edited my CBinaryResource class slightly, to include a position member. That lets you read from it in a more sane way, using fread()like functions.
I also started a bit of work on my animation classes. At the moment, I have CAnimation, which holds a series of frames and delays which make up one animation (e.g. a walk loop or an idle loop), and a CAnimationSet class which holds all of a characters animations (a walk animation, idle animation, etc etc).
I currently load an animation from a config file, the sample one I'm using is this:

# General character information
Width = 64
Height = 128

# Animations this character can do
# Format:
# AnimationName = FrameName:Delay, FrameName:Delay, ...
Walk = Walk00.bmp:100, Walk01.bmp:100, Walk02.bmp:100, Walk03.bmp:100, Walk04.bmp:100, Walk05.bmp:100
Idle = Idle00.bmp:1000

I'm loading each individual texture into each frame of the animation, and once I've loaded all of the animations, I'll composite them onto as few textures as possible (ideally 1 texture), and use texture coordinates to address each frame.
That won't be done for a while though, since I'll need to add clothing on top of the body to save on rendering stuff over and over.

In other news, I found 24 videos about string theory, which someone linked to somewhere in the lounge I think. So anyway, there's sod all on TV tonight, so I'll be watching those videos shortly.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!