Posted on 2008-04-21 18:09
RichardHe 阅读(138)
评论(0) 编辑 收藏 引用
在老版本0.40上修改模式对话框功能.在ceguiwindow.h头文件中添加setModalState方法.参数为bool
1 void Window::setModalState(bool state)
2 {
3 bool already_modal = getModalState();
4
5 // do nothing is state is'nt changing
6 if (state != already_modal)
7 {
8 // if going modal
9 if (state)
10 {
11 activate();
12 System::getSingleton().setModalTarget(this);
13 }
14 // clear the modal target
15 else
16 {
17 System::getSingleton().setModalTarget(0);
18 }
19 }
获得状态
1 bool getModalState(void) const
2 {return (System::getSingleton().getModalTarget() == this);}
在CEGUISystem.h中同样添加两个方法
1 Window* getModalTarget(void) const {return d_modalTarget;}
2 void setModalTarget(Window* target) {d_modalTarget = target;}
windows* d_modalTarget//!< Pointer to the window that is the current modal target. NULL is there is no modal target.
在方法后面单独处理模式窗口
1 /*************************************************************************
2 Return window that should get mouse inouts when mouse it at 'pt'
3 *************************************************************************/
4 Window* System::getTargetWindow(const Point& pt) const
5 {
.....
......
....
....
11 // modal target overrules
12 if (d_modalTarget != 0 && dest_window != d_modalTarget)
13 {
14 if (!dest_window->isAncestor(d_modalTarget))
15 {
16 dest_window = d_modalTarget;
17 }
18
19 }
20
21 return dest_window;
22 }
23
再在脚本中和LUA绑定.在登陆服务器和角色选择时模式对话框都可以用.但在进入游戏主界面时所以操作不能使用,包括MOUSE和KEYBOARD
问题还没解决?