@Ched80: Ah! Still respect for the work!
@Dar13: I have one class
CMedia which is passed on and on throughout all
managers in the engine. This class handles object, image, sprite loading etc. Another class
CDebugger get's passed on to the
CCore Manager,
Level Manager and the
DataLoader (static & dynamic data). Other classes, like: CEntity, CCharacter etc. have their own error reporting which the CDebugger can get information from and output it to the Console. The Scripting Engine is being controlled by the Level Manager and so it is instanced there. The Scripting Engine requires registering functions, and Lua can only accept declared functions outside classes. So I use a
LuaBinder:: namespace, which contains all functions that are able to control pretty much every single
Manager. But for this I pass all the pointers to the classes registered by the Managers to the
LuaBinder:: Namespace. I got CLight, CCharacter, CParticle, etc all derived from the CEntity base, so I am able to handle them all as entities.
So if there is a Light:
EntityData.at(i) = new CLight;
And this is how I load up data from the produced files by FPSC:
(file.getInteger(); and such are part of a CRead class, to read binary from fpm files)
EntityData.at(e)->profile->iLives = file.getInteger();
EntityData.at(e)->spawn->iMax = file.getInteger();
EntityData.at(e)->spawn->iMinDelay = file.getInteger();
EntityData.at(e)->spawn->iRate = file.getInteger();
EntityData.at(e)->profile->fScale = file.getFloat();
EntityData.at(e)->profile->fConeHeight = file.getFloat();
EntityData.at(e)->profile->fConeAngle = file.getFloat();
EntityData.at(e)->profile->iStrength = file.getInteger();
I did had to addapt to the way the files are being produced by FPSC, if it would be an XML type of format, it would be WAY handier. It would be easier to check if an entity outputted is an particle or a light source etc. To do: new CLight; or new CParticle; but got that sorted now.
I don't use a singleton, it kinda defeats the purpose of an OOP programmed library. Altough you could also say that about using one Core Manager that handles/instances everything, but I see that more as a Manager. Factories are cute, just looked into them! But I think I am kinda doing that. What I understand from Factories in refference to LSE:
CEntity *node = ResManager['light']->load(somedata);
node->rotate(0,90,0);
Which is what I do in LSE but:
CEntity *node = ResManager->loadLight(somedata);
node->rotate(0,90,0);
I guess the first method is better, and indeed still have to go on designing the CMedia (ResManager).
Love to hear your thoughts on this,
Cheers,
