zoukankan      html  css  js  c++  java
  • osg显示CEGUI界面

    百度和google的好多例子都不能运行,贴一个自己试出来的。借鉴了cegui的自带例子。
    #include "stdafx.h"
    #include "CEGUIFirstWindow.h"
    #include "CEGUI.h"
    #include <CEGUIDefaultResourceProvider.h>


    int main(int /*argc*/, char* /*argv*/[])
    {
    // This is a basic start-up for the sample application which is
    // object orientated in nature, so we just need an instance of
    // the CEGuiSample based object and then tell that sample application
    // to run. All of the samples will use code similar to this in the
    // main/WinMain function.
    FirstWindowSample app;
    return app.run();
    }

    /*************************************************************************
    Sample specific initialisation goes here.
    ************************************************************************
    */
    bool FirstWindowSample::initialiseSample()
    {
    using namespace CEGUI;
    // Window* myRoot = WindowManager::getSingleton().loadWindowLayout( "test.layout" );
    // System::getSingleton().setGUISheet( myRoot );
    WindowManager& winMgr = WindowManager::getSingleton();

    // load scheme and set up defaults
    SchemeManager::getSingleton().create("TaharezLook.scheme");
    System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
    FontManager::getSingleton().create("DejaVuSans-10.font");

    // load an image to use as a background
    ImagesetManager::getSingleton().createFromImageFile("BackgroundImage", "GPN-2000-001437.tga");

    // here we will use a StaticImage as the root, then we can use it to place a background image
    Window* background = winMgr.createWindow("TaharezLook/StaticImage", "background_wnd");
    /*********************************************************
    * 设置地球背景
    ********************************************************
    */
    // set position and size
    background->setPosition(UVector2(cegui_reldim(0), cegui_reldim( 0)));
    background->setSize(UVector2(cegui_reldim(1), cegui_reldim( 1)));
    // disable frame and standard background
    background->setProperty("FrameEnabled", "false");
    background->setProperty("BackgroundEnabled", "false");
    // set the background image
    background->setProperty("Image", "set:BackgroundImage image:full_image");
    /*********************************************************
    * 设置地球背景
    ********************************************************
    */
    // install this as the root GUI sheet
    System::getSingleton().setGUISheet(background);

    // load the windows for Demo7 from the layout file.
    Window* sheet = winMgr.loadWindowLayout("bar_list.layout");
    // attach this to the 'real' root
    background->addChildWindow(sheet);
    }
    上一张截图

    
    
    代码中bar_list.layout即为自己用CEGUIEditor编辑的。
    其中要注意的是layout中的每个空间的属性要代码中设置的window的属性一致,不然会出错。layout中的很多属性还是没有搞清楚。其中的是否选择全屏幕的问题。总之,好好在研究研究。
    
    
  • 相关阅读:
    关于ArcGIS Server VS2010无法显示发布的地图服务
    NDK,动态链接库,JNI
    android开发中一些报错的解决方法
    查询死锁对象
    pb导入excel文件
    n_cst_ping在powerbuilder 11 中的变化,一面的程序可正常ping
    SQL拼音
    数据库优化
    android调用asp.net webservice,返回json结构
    iframe内部需要弹出浮层问题
  • 原文地址:https://www.cnblogs.com/chateldon/p/2411702.html
Copyright © 2011-2022 走看看