当前位置: 首页>>代码示例>>C++>>正文


C++ FrameWindow::setText方法代码示例

本文整理汇总了C++中cegui::FrameWindow::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameWindow::setText方法的具体用法?C++ FrameWindow::setText怎么用?C++ FrameWindow::setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cegui::FrameWindow的用法示例。


在下文中一共展示了FrameWindow::setText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initializeKeyMap

GameDesktop::GameDesktop(sf::RenderWindow &screen)
  : screen_(screen),
    renderer_(CEGUI::OpenGLRenderer::bootstrapSystem())
{
  // Set up default resource groups
  CEGUI::DefaultResourceProvider *rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());

  rp->setResourceGroupDirectory("schemes", "/usr/share/cegui-0/schemes/"); 
  rp->setResourceGroupDirectory("imagesets", "/usr/share/cegui-0/imagesets/");
  rp->setResourceGroupDirectory("fonts", "/usr/share/cegui-0/fonts/");
  rp->setResourceGroupDirectory("layouts", "/usr/share/cegui-0/layouts/");
  rp->setResourceGroupDirectory("looknfeels", "/usr/share/cegui-0/looknfeel");
  rp->setResourceGroupDirectory("lua_scripts", "/usr/share/cegui-0/lua_scripts/");

  CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets");
  CEGUI::Font::setDefaultResourceGroup("fonts");
  CEGUI::Scheme::setDefaultResourceGroup("schemes");
  CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
  CEGUI::WindowManager::setDefaultResourceGroup("layouts");
  CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");

  // Set up the GUI
  CEGUI::SchemeManager::getSingleton().createFromFile("WindowsLook.scheme");
  CEGUI::FontManager::getSingleton().createFromFile("DejaVuSans-10.font");

  CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("WindowsLook/MouseArrow");

  CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
  CEGUI::Window *root = wmgr.createWindow("DefaultWindow", "root");
  root->setProperty("MousePassThroughEnabled", "True");
  CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(root);

  CEGUI::FrameWindow *fw = static_cast<CEGUI::FrameWindow*>(wmgr.createWindow("WindowsLook/FrameWindow", "testWindow"));

  root->addChild(fw);
  fw->setText("Hello World!");

  // Initialize SFML-to-CEGUI key mapping
  initializeKeyMap();
  screen_.setView(view_);
}
开发者ID:ghtyrant,项目名称:SFML_CEGUI,代码行数:41,代码来源:gamedesktop.cpp

示例2: run

    void run()
    {

        quit = false;

        CL_DisplayWindowDescription window_desc;
        window_desc.set_size(CL_Size(sizex, sizey), true);
        window_desc.set_title("Chess");
        window_desc.set_allow_resize(true);
        CL_DisplayWindow window(window_desc);

        CL_Slot slot_quit = window.sig_window_close().connect(this, &SpritesExample::on_window_close);
        window.func_window_resize().set(this, &SpritesExample::resize);

        CL_GraphicContext gc = window.get_gc();
        CL_InputDevice keyboard = window.get_ic().get_keyboard();

        CL_ResourceManager resources("resources.xml");

        CL_Image lol(gc,"Board",&resources);

        CEGUI::OpenGLRenderer & myRenderer = CEGUI::OpenGLRenderer::bootstrapSystem();

        CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();

        CEGUI::DefaultWindow* root = (CEGUI::DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");

        CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
        CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

        CEGUI::FrameWindow* wnd = (CEGUI::FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "Demo Window");

        root->addChildWindow(wnd);

        wnd->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.25f)));
        wnd->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));

        // now we set the maximum and minum sizes for the new window.  These are
        // specified using relative co-ordinates, but the important thing to note
        // is that these settings are aways relative to the display rather than the
        // parent window.
        //
        // here we set a maximum size for the FrameWindow which is equal to the size
        // of the display, and a minimum size of one tenth of the display.
        wnd->setMaxSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f)));
        wnd->setMinSize(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));

        // As a final step in the initialisation of our sample window, we set the window's
        // text to "Hello World!", so that this text will appear as the caption in the
        // FrameWindow's titlebar.
        wnd->setText("Hello World!");
        CEGUI::System::getSingleton().renderGUI();
        window.flip();

        while (!quit)
        {
            if(keyboard.get_keycode(CL_KEY_ESCAPE) == true)
                quit = true;


            CL_Colorf red(155/255.0f, 60/255.0f, 68/255.0f);
            //CL_Draw::fill(gc, CL_Rectf(0, sizey, sizex, 0), red);
            //lol.draw(gc,CL_Rectf(0,sizey,sizex,0));
            //CEGUI::System::getSingleton().renderGUI();

            //window.flip();
            CL_KeepAlive::process();
            CL_System::sleep(10);
        }
    }
开发者ID:Lalaland,项目名称:ChessV2,代码行数:70,代码来源:main.cpp

示例3: initialise


//.........这里部分代码省略.........
    // tools (where the above mapping is not available), we now alias the
    // new window type onto the original TaharezLook/FrameWindow.  This has
    // the effect that - after the alias is added - any time a window of
    // type "TaharezLook/FrameWindow" is requested, the system will create a
    // "TaharezLook/WobblyFrameWindow" instead.

    WindowFactoryManager::getSingleton().addWindowTypeAlias(
        "Vanilla/FrameWindow",  // alias name - can shadow existing types
        "Vanilla/WobblyFrameWindow"); // target type to create.

    // we will use of the WindowManager.
    WindowManager& winMgr = WindowManager::getSingleton();

    // load scheme and set up defaults
    SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
    SchemeManager::getSingleton().createFromFile("VanillaSkin.scheme");
    guiContext->getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");

    // load font and setup default if not loaded via scheme
    Font& defaultFont = FontManager::getSingleton().createFromFile("DejaVuSans-12.font");
    // Set default font for the gui context
    guiContext->setDefaultFont(&defaultFont);

    // load an image to use as a background
    if( !ImageManager::getSingleton().isDefined("SpaceBackgroundImage") )
        ImageManager::getSingleton().addFromImageFile("SpaceBackgroundImage", "SpaceBackground.jpg");

    if( !ImageManager::getSingleton().isDefined("AliasingTestImage") )
        ImageManager::getSingleton().addFromImageFile("AliasingTestImage", "Aliasing.jpg");

    // 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(USize(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", "SpaceBackgroundImage");
    // set the background window as the root window for our GUIContext
    guiContext->setRootWindow(background);

    // load the windows for the EffectsDemo from the layout file.
    Window* sheet = winMgr.loadLayoutFromFile("EffectsDemo.layout");
 
    // Get the combobox created from within the layout
    CEGUI::Combobox* effectsCombobox = static_cast<CEGUI::Combobox*>(sheet->getChild("EffectsFrameWindow/EffectsCombobox"));

    // attach this to the 'real' root
    background->addChild(sheet);
    //Initialise the render effects
    initialiseEffects(effectsCombobox->getParent());

    // Initialise the items and subscribe the event for the combobox
    initialiseEffectsCombobox(effectsCombobox);
    
    // We can switch the automatic effects mapping off now
    WindowFactoryManager::getSingleton().removeWindowTypeAlias(
        "Vanilla/FrameWindow",  // alias name - can shadow existing types
        "Vanilla/WobblyFrameWindow"); // target type to create.




    // We create a mapping for the elastic windows effect too,
    // and we will apply it to a window we create from code
    WindowFactoryManager::getSingleton().addFalagardWindowMapping(
        "Vanilla/ElasticFrameWindow",   // type to create
        "CEGUI/FrameWindow",            // 'base' widget type
        "Vanilla/FrameWindow",          // WidgetLook to use.
        "Core/FrameWindow",             // WindowRenderer to use.
        s_effectNameElastic);    // effect to use.

    // We will create another window using the effects-mapping we created before, this time directly from code
    CEGUI::FrameWindow* aliasingFrameWnd = static_cast<CEGUI::FrameWindow*>(
        WindowManager::getSingleton().createWindow("Vanilla/ElasticFrameWindow", "AliasingTestWindow") );

    // Add it to the layout root
    sheet->addChild(aliasingFrameWnd);

    // We will add an image to it using a StaticImage window
    Window* aliasingWnd = WindowManager::getSingleton().createWindow("Vanilla/StaticImage", "AliasingTestImage");
    aliasingFrameWnd->addChild(aliasingWnd);
    aliasingFrameWnd->setPosition(CEGUI::UVector2(cegui_reldim(0.05f), cegui_reldim(0.15f)));
    aliasingFrameWnd->setSize(CEGUI::USize(cegui_reldim(0.2f), cegui_reldim(0.28f)));
    aliasingFrameWnd->setSizingEnabled(true);
    aliasingFrameWnd->setCloseButtonEnabled(false);
    aliasingFrameWnd->setTitleBarEnabled(true);
    aliasingFrameWnd->setText("Elastic Window - Aliasing Testimage");

    // Image window setup
    aliasingWnd->setSize(CEGUI::USize(cegui_reldim(1.0f), cegui_reldim(1.0f)));
    aliasingWnd->setProperty("FrameEnabled", "false");
    aliasingWnd->setProperty("BackgroundEnabled", "false");
    aliasingWnd->setProperty("Image", "AliasingTestImage");

    // success!
    return true;
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:101,代码来源:EffectsDemo.cpp


注:本文中的cegui::FrameWindow::setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。