From: Charles L. <lo...@um...> - 2009-11-09 20:11:19
|
Devs, While we've tried avoiding it thus far, it's occurring to me now that we really do, in fact need an Init() function. When loading something like a Texture, we can create it in two ways: (1) MAutoPtr< MercuryAsset > a = ASSETFACTORY.Generate( "Texture", "GRAPHIC:bob.png" ); a.SetSomeParameterA(...); a.SetSomeParameterB(...), a.ChangeKey( "GRAPHIC:bob.png" ); ******* (2) <asset type="Texture" file="GRAPHIC:bob.png" SomeParameterA="..." SomeParameterB="..." /> The *******'ed line is the one in question. There is no convenient way right now to indicate to something that it should not load in the constructor, but instead load at a later time. In this case, we aren't actually changing the key. We simply need to tell the texture "Ok, time to go load now." We also can't just do this raw in the XML function, as many times we will be creating assets in code. I am not really sure how to resolve this. Maybe there could be some special parameter that gets passed to change key to indicate that it should simply be using whatever key it was passed in with? I guess the current system isn't all that bad, but I feel like it /could/ be better. Charles |