• Direct3D9应用CEGUI


           #define SetWindowRect( window, x, y, width, height ) \
           {	\
    	        window->setPosition( \
    	        CEGUI::UVector2( CEGUI::UDim(0.0f, x),	\
    	        CEGUI::UDim(0.0f, y) )	\
    	        );	\
    	        window->setSize(	\
    	        CEGUI::UVector2( CEGUI::UDim(0.0f, width),	\
    	        CEGUI::UDim(0.0f, height) )	\
    	        );	\
            }
    
            CEGUI::Direct3D9Renderer* g_pRender = NULL;
            //初始化
            g_pRender = &CEGUI::Direct3D9Renderer::create( lpDevice );
    	
    	CEGUI::System& mGUISystem = CEGUI::System::create(*g_pRender);
    
    	CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>
    		(CEGUI::System::getSingleton().getResourceProvider());
    
    	rp->setResourceGroupDirectory("schemes", "../Media/gui/");
    	rp->setResourceGroupDirectory("imagesets", "../Media/gui/");
    	rp->setResourceGroupDirectory("fonts", "../Media/fonts/");
    	rp->setResourceGroupDirectory("layouts", "../Media/gui/");
    	rp->setResourceGroupDirectory("looknfeels", "../Media/gui/");
    
    	CEGUI::Imageset::setDefaultResourceGroup("imagesets");
    	CEGUI::Font::setDefaultResourceGroup("fonts");
    	CEGUI::Scheme::setDefaultResourceGroup("schemes");
    	CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
    	CEGUI::WindowManager::setDefaultResourceGroup("layouts");
    
    	CEGUI::SchemeManager::getSingleton().create(
    		(CEGUI::utf8*)"TaharezLookSkin.scheme");
    	mGUISystem.setDefaultMouseCursor(
    		(CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
    	mGUISystem.setDefaultFont((CEGUI::utf8*)"simkai");
    	CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
    
    	CEGUI::Window* sheet = wmgr.createWindow(
    		"DefaultGUISheet", "Root" ); 
    	mGUISystem.setGUISheet(sheet);
    
    	/// 创建主窗口
    	CEGUI::FrameWindow* frame = 
    		(CEGUI::FrameWindow*)wmgr.createWindow(
    		"TaharezLook/FrameWindow", "Root/Frame");
    	SetWindowRect( frame, 0, 26, 200, 400 );
    	frame->setProperty( "Alpha", "0.0" );
    	frame->setProperty( "SizingEnabled", "False" );
    	frame->setProperty( "TitlebarEnabled", "False" );
    	sheet->addChildWindow( frame );
    
    	/// 创建按钮
    	CEGUI::PushButton* mQuitButton = (CEGUI::PushButton*)wmgr.createWindow(
    		"TaharezLook/Button", "Root/Frame/QuitButton" );
    	SetWindowRect( mQuitButton, 80, 50, 100, 26 );
    	mQuitButton->setText( "ChangeModel" );
    	mQuitButton->setProperty( "InheritsAlpha", "False" );
    	frame->addChildWindow( mQuitButton );
    
    	/// 创建编辑框
    	CEGUI::MultiLineEditbox* mEditBox = (CEGUI::MultiLineEditbox*)wmgr.createWindow(
    		"TaharezLook/MultiLineEditbox", "Root/Frame/MultiEditbox" );
    	SetWindowRect( mEditBox, 5, 150, 155, 80 );
    	mEditBox->setProperty( "InheritsAlpha", "False" );
    	mEditBox->setProperty( "Alpha", "0.5" );
    	frame->addChildWindow( mEditBox );
    
    	CEGUI::ImagesetManager::getSingleton().createFromImageFile("MyImage", "72.png");
    	CEGUI::Window* mImage = wmgr.createWindow( 
    		"TaharezLook/StaticImage", "Root/Frame/StaticImage");
    	SetWindowRect( mImage, 0, 30, 50, 50 );
    	mImage->setProperty( "Image", "set:MyImage image:full_image");
    	mImage->setProperty( "InheritsAlpha", "False" );
    	frame->addChildWindow( mImage );
    
            //渲染GUI
            CEGUI::System::getSingleton().renderGUI();
    
            //销毁
            CEGUI::System::getSingleton().destroy();
    	CEGUI::Direct3D9Renderer::destroy(*g_pRender);
  • 相关阅读:
    Appium 自动测试,读书打卡
    Appium 自动测试,读书打卡(日志)
    mac下破解安装staruml软件步骤
    基于MGR方式搭建MySQL8.0一主多从集群
    vue项目npm install下载依赖时,报error code128解决方法
    解决 ASP.NET Core 部署到 IIS,更新项目时"文件夹正在使用"错误
    windows11 升级到10.0.22598.200时安装到35%提示硬件尚未准备好
    2022网易雷火游戏研发笔试ak(4月23日)
    2022腾讯2022实习生笔试ak(4月24日后台&综合)
    2022阿里笔试编程题ak口糊(4月15日)
  • 原文地址:https://www.cnblogs.com/LinuxHunter/p/1885795.html
Copyright © 2020-2023  润新知