I have a class that loads the drawing code for a bunch of graphics. It goes something sort of like this:
if (type == RabbitGraphic)
{
//a whole bunch of drawing code gets loaded into an object
}
else if (type == FrogGraphic)...
This file is getting quite long with the more graphics I’ve added to it and the compilation / loading the file are taking a while. I’m wondering, is there a way I can split these graphics into separate files without having to create a new object? IE is there some mechanism I can do like:
if (type == RabbitGraphic)
{
load file that has rabbit graphic code
}
Why are you trying to avoid creating a new object? It sounds to me like more OOP is what is called for here. You should have individual classes that implement the various bits of graphics code specific to each type, optionally with a parent class that implements common functionality.