之前漏掉了,补上
CEGUITexture修改后的:
/Files/oiramario/CEGUITexture.rar这样修改后,就会报D3D或OGL的Renderer编不过了
然后具体实现请看
CEGUI 第一弹 中的补充说明
有不清楚再问我好了
posted on 2006-05-15 18:00
千里马肝 阅读(1780)
评论(17) 编辑 收藏
评论
我将那三个文件都替换了,也用一个字符串转换函数int AnsiToUtf8(char *szAnsi, char *szUtf8 )进行转码,可是中文却没显示出来,不知是怎么回事?
编译CEGUIFontManager 和 CEGUIFont_xmlHandler 出错,是否要更新啊?
to pengsl: 有重编CEGUI吗?编译后的DLL有更新吗?目录和路径对吗?
to 阿斌: 建议下载最新的0.4.1版CEGUI,然后再更新文件编译
我的是0.4.1版本,编译CEGUIFont_xmlHandler.cpp里找不到d_glyph_images这个变量,因为你改成了d_glyph_images_vector,那在这个文件里怎么改呢?
我的是0.4.1版本,按照你的方法,将字体文件和CEGUITexture文件都换掉了,并且在OGL中也添加了updateFromMemory成员函数,它的在实现文件中添加了一句glTexSubImage2D(...)代码,最后重新编译完全通过,并更新了编译后的DLL,但是还是显示不出来中文 ,不知为什么?
我想问一下int AnsiToUtf8()这个函数是不是要自己写?还有oiramLook文件夹只要放到WidgeSets文件夹下就可以了吗?
这个函数在前面提供的包里已经给出了
要显示中文必须要先将中文字进行转换
要使用oiramlook必须
// load scheme and set up defaults
SchemeManager::getSingleton().loadScheme("ui/schemes/OiramLook.scheme");
System::getSingleton().setDefaultMouseCursor("OiramLook", "MouseArrow");
请问怎样在OpenGL 模式下让editbox可以输入中文?
解决方法同上
将font和对应xmlhandel替换掉
将texture替换
使用我提供的AnsiToUtf8()将中文转换后传给editbox
这个我也知道,在demo4 中我在D3D模式下,在WM_CHAR 下面使用转换函数将输入的内容转换成utf8,这样可以输入中文,但在OpenGL模式下,使用的是键盘输入回调函数OnChar(),该函数只传递单个按键的输入,而不传递中文编码字符,因此无法将其转化,这样中文输入也显示不出,不知楼主有何方法?
WM_CHAR和OnChar()不是一个意义吗
这里的OnChar是glut的回调函数吗
@阿刚
tl_ceguiHelper::AnsiToUtf8 这个函数你找到了么? 我在包中怎么找不到?
//----------------------------------------------------------//
//Convert ansi to utf-8
long Demo4Sample::atou(char* str, int ilen)
{
wchar_t *wstr = new wchar_t[4096];
memset(wstr, 0, sizeof(wchar_t) * 4096);
long lLen = MultiByteToWideChar(CP_ACP,0,str,-1,wstr,4096);
lLen = WideCharToMultiByte ( CP_UTF8, 0, wstr, -1, str, ilen, NULL, NULL );
delete[] wstr;
return lLen;
}
我写的ansi转utf8函数,
//调用
char cText[64] = "测试一下!";
long k = atou(cText, 64);
button->setText( cText);
为什么会没有效果呢?
"测试一下!"怎么可能转换到一个long里去呢
uft是相对ansi用更多的空间去描述一个“字”
你这样做反而是在“压缩”
你对编码转换理解有问题
建议你上网搜一下utf相关的知识
参考我源码里的实现吧
在包里: include/cegui/ceguiHelper.h
你首先要了解,在olbutton.h中,定义有:
static const utf8 NormalImageName[]; //!< Name of the image to use for the left end of the button (normal).
static const utf8 HighlightImageName[]; //!< Name of the image to use for the left end of the button (hover / highlighted).
static const utf8 PushedImageName[]; //!< Name of the image to use for the left end of the button (pushed state).
static const utf8 DisabledImageName[]; //!< Name of the image to use for the left end of the button (disabled).
static const utf8 MouseCursorImageName[]; //!< Name of the image to use for the mouse cursor.
换图的话则:
// create quit button
OLButton* btn = static_cast<OLButton *>(winMgr.createWindow("OiramLook/Button", "btn1"));
fwnd1->addChildWindow(btn);
btn->setMaximumSize(Size(1.0f, 1.0f));
btn->setPosition(Point(0.02f, 0.1f));
btn->setSize(Size(0.25f, 0.1f));
btn->setText(tl_ceguiHelper::AnsiToUtf8("退出程序"));
btn->setTooltipText("Test Tip");
{
tl_ceguiWidgets *pWidgets = btn;
pWidgets->set_image(OLButton::HighlightImageName, pImage);
}
该pImage即某已载入的图片
设置按钮“高亮”图