i compile have error:
Code: Select all
1>main.cpp
1>e:\code\project\xmltext\main.cpp(33) : error C2664: 'const irr::io::char16 *irr::io::IIrrXMLReader<char_type,super_class>::getAttributeValue(int) const' : cannot convert parameter 1 from 'const char [8]' to 'int'
1> with
1> [
1> char_type=irr::io::char16,
1> super_class=irr::io::IXMLBase
1> ]
1> There is no context in which this conversion is possible
1>e:\code\project\xmltext\main.cpp(42) : error C2228: left of '.c_str' must have class/struct/union
1> type is 'irr::io::char16'
Code: Select all
IrrXMLReaderUTF16* xml = createIrrXMLReaderUTF16("./temp.xml");
ETEXT_FORMAT abc;
abc = xml->getSourceFormat();
char16 str;
while(xml && xml->read())
{
switch(xml->getNodeType())
{
case EXN_ELEMENT:
{
if (stringw("Button") == xml->getNodeName())
{
str = xml->getAttributeValue("caption");//here. how to get chinese string?
}
}
}
}
IGUIStaticText* txtBar;
dimension2d<int> scrSize = device->getVideoDriver()->getScreenSize();
rect<int> pos;
pos = rect<int>(scrSize.Width/2-40, scrSize.Height/2-30, scrSize.Width/2+40, scrSize.Height/2);
txtBar = device->getGUIEnvironment()->addStaticText(str.c_str(), pos, true, false);
txtBar->setBackgroundColor(SColor(200,0,0,255));
xml file(use irrxmlwriter create):
Code: Select all
<?xml version="1.0"?>
<config>
<!--comment fro temporary file!-->
<Button x="中文测试" y="y" w="w" h="h" caption="caption" uid="uid" goto="goto" method="method" oop="oop" />
</config>