去掉ogre引擎设置的窗口
2016-12-30 11:30
232 查看
转载自:http://blog.163.com/chenkangapple@126/blog/static/12807484720098173383407/
每次运行前总会出现讨厌的Ogre界面,那怎么去除它呢?这个需要了解当初第一节时建立一个Ogre窗口的原理。
每次用Ogre时总会包含ExampleApplication.h,在这个头文件中定义了一个ExampleApplication类,其中有个这样的方法.
仔细看这段代码,发现有个
这就话的意思就是显示Ogre对话框,既然知道问题是他,那怎么修改?
在OgreRoot.h中我们可以看到有这样的方法
这个是干什么的? 不难发现,仔细观察这段代码,发现原来这个是“恢复设置”的,既然这样,那么回到原来的地方咱们把ExampleApplication.h中的那个方法修改一下:
运行自己原来写的程序,呵呵,讨厌的Ogre对话框没有了。
不过这个有个前提,你必须运行一次那个带配置窗口的示例才会有效果,为什么呢?
因为在运行那个带配置的对话框之后会生成一个ogre.cfg文件,如果没有这个文件的话,会提示有错的,因为咱们这样一改是通过这个配置文件进入到Ogre窗口的。没有铁定会报错。
如果想以后制作自己的配置窗口建议看一下restoreConfig(),saveconfig()的工作机制。
每次运行前总会出现讨厌的Ogre界面,那怎么去除它呢?这个需要了解当初第一节时建立一个Ogre窗口的原理。
每次用Ogre时总会包含ExampleApplication.h,在这个头文件中定义了一个ExampleApplication类,其中有个这样的方法.
virtual bool configure(void) { // Show the configuration dialog and initialise the system // You can skip this and use root.restoreConfig() to load configuration // settings if you were sure there are valid ones saved in ogre.cfg if(mRoot->showConfigDialog()) //这是关键地方 { // If returned true, user clicked OK so initialise // Here we choose to let the system create a default rendering window by passing 'true' mWindow = mRoot->initialise(true); return true; } else { return false; } }
仔细看这段代码,发现有个
if(mRoot->showConfigDialog()){}
这就话的意思就是显示Ogre对话框,既然知道问题是他,那怎么修改?
在OgreRoot.h中我们可以看到有这样的方法
Root::restoreConfig(void){}
这个是干什么的? 不难发现,仔细观察这段代码,发现原来这个是“恢复设置”的,既然这样,那么回到原来的地方咱们把ExampleApplication.h中的那个方法修改一下:
virtual bool configure(void) { // Show the configuration dialog and initialise the system // You can skip this and use root.restoreConfig() to load configuration // settings if you were sure there are valid ones saved in ogre.cfg // if(mRoot->showConfigDialog()) //原来的地方 if(mRoot->restoreConfig()) //现在修改后的地方 { // If returned true, user clicked OK so initialise // Here we choose to let the system create a default rendering window by passing 'true' mWindow = mRoot->initialise(true); return true; } else { return false; } }
运行自己原来写的程序,呵呵,讨厌的Ogre对话框没有了。
不过这个有个前提,你必须运行一次那个带配置窗口的示例才会有效果,为什么呢?
因为在运行那个带配置的对话框之后会生成一个ogre.cfg文件,如果没有这个文件的话,会提示有错的,因为咱们这样一改是通过这个配置文件进入到Ogre窗口的。没有铁定会报错。
如果想以后制作自己的配置窗口建议看一下restoreConfig(),saveconfig()的工作机制。
相关文章推荐
- OGRE 去掉设置窗口
- OGRE 去掉设置窗口
- 转载:OGRE一起学(十一) 去掉烦人的设置窗口
- 窗口设置为Qt::Popup时, 如何去掉窗口阴影?
- Qt编程—去掉标题栏和设置窗口透明用法
- Qt编程—去掉标题栏和设置窗口透明用法
- Qt编程—去掉标题栏和设置窗口透明用法
- Activty 设置成窗口样式后 如何去掉ActionBar
- 提示窗口(Alert)、弹出窗口去掉弹出后阴影的样式设置
- Qt编程—去掉标题栏和设置窗口透明用法
- 窗口设置为Qt::Popup时, 如何去掉窗口阴影?
- OGRE去掉弹出的配置窗口
- MFC中一些窗口风格的设置以及去掉某些窗口风格的方式
- ogre引擎配置窗口
- 去掉标题栏和设置窗口透明用法
- 设置标题和图标,设置窗口大小,设置光标
- 加速你的杀毒引擎 卡巴斯基设置教程
- 通过试验探索Access 2000/XP 数据库的最佳 NTFS 权限设置Microsoft Jet 数据库引擎打不开文件'D:\wwwroot\test\data\'。 它已经被别的用户以独占方式打开,或没有查看数据的权限。
- 去掉GaussView启动警告窗口的办法
- 自动设置窗口最小化和还原