Ketura
21-06-2011 00:26:10
So I've spent the last few days integrating Lua and Luabind into my project, and I figured outsourcing the createFont bit of the QuickGUI creation pipeline would be a good learning experience. I spent a few days tearing my hair out thinking my lua syntax was messed up, and then when I tried to do the same things in C++, I discovered I was having the exact same problems.
So after creating a GUIResourceManager and GUISkinEffectManager instance and using these to create a GUICore, I save the singleton pointer for the FontManager and attempt to call createFont:
Once the program hits the createFont function, it crashes. Upon investigating, I find that the local variables have some interesting values:
so, it seems the strings that I'm passing get totally lost, causing TinyXML to load a nonexistent file, causing FontManager to crash when it tries to read said nonexistent XML. It can't just be a hiccup with std::string, as you can see that the name field for the Image gets successfully inputted, in the same call. Anyone have any ideas as to why thismight be the case?
So after creating a GUIResourceManager and GUISkinEffectManager instance and using these to create a GUICore, I save the singleton pointer for the FontManager and attempt to call createFont:
GUIResourceManager* mGuiResourceManager = new GUIResourceManager();
GUISkinEffectManager* skinEffectMgr = new GUISkinEffectManager();
QuickGUI::Core* GUICore = new QuickGUI::Core(mGuiResourceManager, skinEffectMgr);
QuickGUI::FontManager* fontMgr = QuickGUI::FontManager::getSingletonPtr();
fontMgr->createFont("TimesNewRoman.14", mGuiResourceManager->getImage("TimesNewRoman.14.png"), 10,"TimesNewRoman.14.xml");
Once the program hits the createFont function, it crashes. Upon investigating, I find that the local variables have some interesting values:
Font* FontManager::createFont(const std::string& name, Image* i, unsigned int baseline, const std::string& fontXMLFile)
name = "¤ð/"
i = 0x0308a738{mName="TimesNewRoman.14.png" mOgreImage=0x00ca3d28}
baseline = 10
fontXMLFile = "|ð/"
so, it seems the strings that I'm passing get totally lost, causing TinyXML to load a nonexistent file, causing FontManager to crash when it tries to read said nonexistent XML. It can't just be a hiccup with std::string, as you can see that the name field for the Image gets successfully inputted, in the same call. Anyone have any ideas as to why thismight be the case?