#include <BGE/all>
using namespace bge;
int main(int argc,char* argv[])
{
//!初始化文件系统
FileSystem::instance()->initial(argv[0]);
//!加载压缩包
FileSystem::instance()->setResourcePackage("data.zip");
//!初始化UI管理器,设定默认字体,并设定自动删除控件
WindowManager::instance().initialize("simkai.ttf",true);
//!生成和初始化窗口设备
Device* device = bgeCreateDevice();
device->initial();
device->createWindow(640,480,bge::String("BGE Window"));
//!从资源文件加载控件包含子控件和控件属性
Window* window = WindowManager::instance().create("window.xml");
bge::WindowManager::instance().addWindow(listbox);
while(device->isRunning())
{
//!预渲染设备
device->perRender();
//!窗体更新
bge::WindowManager::instance().update();
device->swapBuffers();
device->pollEvents();
}
//!销毁窗体管理器
bge::WindowManager::instance().terminate();
//!关闭并销毁设备
device->closeWindow();
device->terminate();
device->deleteLater();
system("pause");
return 0;
}
还没做完,用法如上,很简练吧:D
什么?对整体视效不满意?
试下这个:WindowManager::instance().propertyScheme()->load("skin.xml");
想定制某个控件的视效?
Button* button = window->findChild("ok");
button->loadAppearance("button.xml","blue");