Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Stupid, Clever, or Both?

Name: Anonymous 2007-10-24 2:02

I'm doing some expert programming of a tile-based game in which tile classes have references to anonymous functions that return the proper image for that tile. I figure I might as well not duplicate these. Should I make these functions onymous or just have a picture function manager that lets me get at them easily? It would be dead simple to create onymous functions for them at runtime, but it makes me feel funny to do it.

Name: Anonymous 2007-10-24 5:55

Just stick them in a hash table (or some other kind of mapping data structure, I like rb-trees myself) keyed by filename or something, and consider them read-only after they're loaded from the file. Between level changes (or something) when it's certain that no pointers to the images are around, flush the table.

No need to get fancy. "First, make it work."

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List