Posted on 2008-04-21 18:09
RichardHe 閱讀(141)
評論(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
問題還沒解決?