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


C++ Window::createChild方法代码示例

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


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

示例1: CEditBoxExit

  CEditBoxExit(int id,
	       CEGUI::Window *pParent,
	       float fButtonSize,
	       const CEGUI::String &sTitle,
	       CExit &exit) 
    : CEditBoxBase(id, pParent, fButtonSize, sTitle),
      m_Exit(exit),
      m_BackupExit(exit) {

    using namespace CEGUI;
    Combobox *pComboBox = dynamic_cast<Combobox*>(m_pWindow->createChild("OgreTray/Combobox", "ExitSelect"));
    m_pCombobox = pComboBox;
    pComboBox->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
    pComboBox->setSize(USize(UDim(1, 0), UDim(0, 3 * fButtonSize)));
    pComboBox->addItem(new ListboxTextItem("Region"));
    pComboBox->addItem(new ListboxTextItem("Enemy death"));
    pComboBox->setAutoSizeListHeightToContent(true);
    pComboBox->setReadOnly(true);
    pComboBox->subscribeEvent(Combobox::EventListSelectionAccepted,
			      Event::Subscriber(&CEditBoxExit::onListSelectionChanged, this));

    // id
    m_pContentId = m_pWindow->createChild("DefaultWindow", "id");
    m_pContentId->setPosition(UVector2(UDim(0, 0), UDim(0, fButtonSize)));
    m_pContentId->setSize(USize(UDim(1, 0), UDim(0, 2 * fButtonSize)));

    Window *pLabel = m_pContentId->createChild("OgreTray/Label", "Exitidlabel");
    pLabel->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
    pLabel->setSize(USize(UDim(0, fButtonSize), UDim(0, fButtonSize)));
    pLabel->setText("id");

    Window *pEditBox = m_pContentId->createChild("OgreTray/Editbox", "Exitid");
    pEditBox->setPosition(UVector2(UDim(0, fButtonSize), UDim(0, 0)));
    pEditBox->setSize(USize(UDim(1, -fButtonSize), UDim(0, fButtonSize)));
    pEditBox->setText(m_Exit.getID());
    
    m_pContentId->setVisible(m_Exit.getExitType() == EXIT_ENEMY_DEATH);

    // region
    m_pContentRegion = m_pWindow->createChild("DefaultWindow", "region");
    m_pContentRegion->setPosition(UVector2(UDim(0, 0), UDim(0, fButtonSize)));
    m_pContentRegion->setSize(USize(UDim(1, 0), UDim(0, 2 * fButtonSize)));

    createVector(m_pContentRegion, "pos", m_Exit.getBoundingBox().getPosition().x, m_Exit.getBoundingBox().getPosition().y, fButtonSize, 0);
    createVector(m_pContentRegion, "size", m_Exit.getBoundingBox().getSize().x, m_Exit.getBoundingBox().getSize().y, fButtonSize, fButtonSize);

    m_pContentRegion->setVisible(m_Exit.getExitType() == EXIT_REGION);
    

    // default selected exit type
    m_pCombobox->setItemSelectState(m_Exit.getExitType(), true);
  }
开发者ID:ChWick,项目名称:Mencus,代码行数:52,代码来源:EditBoxExit.hpp

示例2: main

//----------------------------------------------------------------------------//
int main(int argc, char* argv[])
{
    // Create X11 window.
    Display* dpy = XOpenDisplay(0);
    int scn = DefaultScreen(dpy);
    Window wnd = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
                                     50, 50, 480, 320, 1,
                                     BlackPixel(dpy, scn),
                                     WhitePixel(dpy, scn));

    XSelectInput(dpy, wnd, StructureNotifyMask |
                           PointerMotionMask |
                           ButtonPressMask | ButtonReleaseMask |
                           KeyPressMask | KeyReleaseMask);
    XMapWindow(dpy, wnd);

    XEvent evt;
    while (true)
    {
        XNextEvent(dpy, &evt);
        if (evt.type == MapNotify)
            break;
    }

    // EGL setup
    EGLDisplay egldpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);

    EGLint majVer, minVer;
    eglInitialize(egldpy, &majVer, &minVer);

    EGLint attrs[] =
    {
        EGL_RED_SIZE,           8,
        EGL_GREEN_SIZE,         8,
        EGL_BLUE_SIZE,          8,
        EGL_RENDERABLE_TYPE,    EGL_OPENGL_ES_BIT,
        EGL_SURFACE_TYPE,       EGL_WINDOW_BIT,
        EGL_NONE
    };

    EGLConfig config;
    EGLint numconfigs;
    eglChooseConfig(egldpy, attrs, &config, 1, &numconfigs);

    EGLSurface surface =
        eglCreateWindowSurface(egldpy, config, (NativeWindowType)wnd, 0);

    EGLContext ctx = eglCreateContext(egldpy, config, 0, 0);
    eglMakeCurrent(egldpy, surface, surface, ctx);

    eglBindAPI(EGL_OPENGL_ES_API);

    // basic gl state setup;
    glViewport(0, 0, 480, 320);
    glClearColor(0.2, 0.2, 0.2, 1);

    // CEGUI setup
    CEGUI::OpenGLESRenderer::bootstrapSystem();
    initialiseResourceGroupDirectories();
    initialiseDefaultResourceGroups();

    CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
    CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");
    CEGUI::WindowManager& winMgr(CEGUI::WindowManager::getSingleton());
    CEGUI::Window* root = winMgr.createWindow("DefaultWindow", "root");
    CEGUI::Window* fw = root->createChild("TaharezLook/FrameWindow");
    fw->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25, 0), CEGUI::UDim(0.25, 0)));
    fw->setSize(CEGUI::USize(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.5, 0)));
    fw->setText("OpenGL ES 1 Test");

    CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(root);

    // Main looop
    bool running = true;
    while (running)
    {
        while (XPending(dpy))
        {
            XNextEvent(dpy, &evt);

            switch (evt.type)
            {
            case KeyPress:
            {
                int kspkcr;
                KeySym* ks = XGetKeyboardMapping(dpy, evt.xkey.keycode, 1, &kspkcr);

                if (ks[0] == XK_Escape)
                    running = false;

                break;
            }

            case MotionNotify:
                CEGUI::System::getSingleton().getDefaultGUIContext().injectMousePosition(evt.xmotion.x, evt.xmotion.y);
                break;

            case ButtonPress:
            {
//.........这里部分代码省略.........
开发者ID:AjaxWang1989,项目名称:cegui,代码行数:101,代码来源:Sample_GLESTest.cpp

示例3: UDim

CHUD::CHUD(CEGUI::Window *pGUIRoot, CGUIToolsMenu *pGUIToolsMenu)
    : m_bShotToolIndicators(pGUIToolsMenu == NULL),
      m_pGUIToolsMenu(pGUIToolsMenu),
      m_fTimer(0),
      m_fHP(1),
      m_fMP(1)
{
    m_pHudRoot = pGUIRoot->createChild("DefaultWindow", "HudRoot");
    m_pHudRoot->setInheritsAlpha(false);
    m_pHudRoot->setAlpha(1);
    m_pHudRoot->setRiseOnClickEnabled(false);
    CEGUI::ImageManager::getSingleton().loadImageset("hud.imageset");
    ImageManager::getSingleton().loadImageset("white.imageset");
    ImageManager::getSingleton().loadImageset("hud_weapons.imageset");

    CEGUI::Window *pMain = m_pHudRoot->createChild("OgreTray/StaticText", "main");
    pMain->setRiseOnClickEnabled(false);
    pMain->setProperty("BackgroundEnabled", "false");
    pMain->setProperty("FrameEnabled", "false");
    pMain->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
    pMain->setSize(USize(UDim(1, 0), UDim(1, 0)));
    //pMain->setText("test");
    //pMain->setAlpha(0.5);

    CEGUI::Window *pTopBar = pMain->createChild("OgreTray/StaticImage", "top_bar");
    pTopBar->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0)));
    pTopBar->setSize(CEGUI::USize(CEGUI::UDim(1, 0), CEGUI::UDim(0.1667f, 0)));
    pTopBar->setProperty("Image", "hud/top_bar");
    pTopBar->setProperty("FrameEnabled","False");
    pTopBar->setProperty("BackgroundEnabled","False");
    pTopBar->setRiseOnClickEnabled(false);

    Window *pBottomBar = pMain->createChild("OgreTray/StaticImage", "bottom_bar");
    pBottomBar->setSize(USize(UDim(0.28125, 0), UDim(0.05859375, 0)));
    pBottomBar->setPosition(UVector2(UDim(0.359375, 0), UDim(0.94140625, 0)));
    pBottomBar->setProperty("Image", "hud/bottom_bar");
    pBottomBar->setProperty("FrameEnabled","False");
    pBottomBar->setProperty("BackgroundEnabled","False");
    pBottomBar->setRiseOnClickEnabled(false);

    m_pFpsText = pBottomBar->createChild("OgreTray/StaticText", "fpstext");
    m_pFpsText->setProperty("TextColours", "FFFFFFFF");
    m_pFpsText->setProperty("FrameEnabled","False");
    m_pFpsText->setProperty("BackgroundEnabled","False");
    m_pFpsText->setSize(USize(UDim(0.2, 0), UDim(0.3, 0)));
    m_pFpsText->setPosition(UVector2(UDim(0.605, 0), UDim(0.66, 0)));
    m_pFpsText->setText("00");
    m_pFpsText->setFont("dejavusans8");
    m_pFpsText->setRiseOnClickEnabled(false);

    m_pTimeText = pBottomBar->createChild("OgreTray/StaticText", "timetext");
    m_pTimeText->setProperty("TextColours", "FFFFFFFF");
    m_pTimeText->setProperty("FrameEnabled","False");
    m_pTimeText->setProperty("BackgroundEnabled","False");
    m_pTimeText->setSize(USize(UDim(0.3, 0), UDim(0.3, 0)));
    m_pTimeText->setPosition(UVector2(UDim(0.22, 0), UDim(0.66, 0)));
    m_pTimeText->setText("0:00:00");
    m_pTimeText->setFont("dejavusans8");
    m_pTimeText->setRiseOnClickEnabled(false);

    m_pHealthBar = pMain->createChild("OgreTray/StaticImage", "healthbar");
    m_pHealthBar->setProperty("ImageColours", "FFFF00FF");
    m_pHealthBar->setProperty("Image", "white/full_image");
    m_pHealthBar->setProperty("FrameEnabled","False");
    m_pHealthBar->setProperty("BackgroundEnabled","True");
    m_pHealthBar->setPosition(UVector2(UDim(0.051757813, 0), UDim(0.026041667, 0)));
    m_pHealthBar->setRiseOnClickEnabled(false);

    m_pManaBar = pMain->createChild("OgreTray/StaticImage", "manabar");
    m_pManaBar->setProperty("ImageColours", "FFFF00FF");
    m_pManaBar->setProperty("Image", "white/full_image");
    m_pManaBar->setProperty("FrameEnabled", "False");
    m_pManaBar->setProperty("BackgroundEnabled", "True");
    m_pManaBar->setPosition(UVector2(UDim(0.772460938, 0), UDim(0.026041667, 0)));
    m_pManaBar->setRiseOnClickEnabled(false);

#if ENABLE_INPUT_TOUCH != 1
    Window *pWeaponContainer = pMain->createChild("OgreTray/StaticImage", "weaponContainer");
    pWeaponContainer->setProperty("FrameEnabled", "False");
    pWeaponContainer->setProperty("BackgroundEnabled", "False");
    pWeaponContainer->setProperty("Image", "hud/weapon_indicator");
    pWeaponContainer->setPosition(UVector2(UDim(0, 0), UDim(0.908854, 0)));
    pWeaponContainer->setSize(USize(UDim(0.0683594, 0), UDim(0.091145833, 0)));

    m_pWeapon = pMain->createChild("OgreTray/StaticImage", "weapon");
    m_pWeapon->setProperty("FrameEnabled", "False");
    m_pWeapon->setProperty("BackgroundEnabled", "True");
    m_pWeapon->setPosition(UVector2(UDim(0.020507813, 0), UDim(0.936197917, 0)));
    m_pWeapon->setSize(USize(UDim(0.028320313, 0), UDim(0.037760417, 0)));
#endif

    if (m_bShotToolIndicators) {
        Window *pImg = pMain->createChild("OgreTray/StaticImage", "HPImg");
        pImg->setProperty("FrameEnabled","False");
        pImg->setProperty("BackgroundEnabled","False");
        pImg->setSize(CEGUI::USize(UDim(0, 32), UDim(0, 32)));
        pImg->setPosition(CEGUI::UVector2(CEGUI::UDim(0.8, -16), CEGUI::UDim(0.98, -24)));
        pImg->setProperty("Image", "hud_weapons/health_potion");

        m_pHealthPotionsCount = pMain->createChild("OgreTray/StaticText", "HPCount");
//.........这里部分代码省略.........
开发者ID:ChWick,项目名称:Mencus,代码行数:101,代码来源:HUD.cpp

示例4: createChild

CGUIStatistics::CGUIStatistics(Window *pRoot)
  : m_iSelectedSlot(0) {
  CInputListenerManager::getSingleton().addInputListener(this);
  // create cegui windows/buttons
  Window *pStatisticsRoot = pRoot->createChild("DefaultWindow", "GUIStatisticsRoot");
  pStatisticsRoot->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0)));
  pStatisticsRoot->setSize(CEGUI::USize(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));
  pStatisticsRoot->setInheritsAlpha(false);
  pStatisticsRoot->setAlpha(1);
  pStatisticsRoot->setRiseOnClickEnabled(false);
  pStatisticsRoot->moveToBack();
  m_pStatisticsRoot = pStatisticsRoot;

  CEGUI::Window *pBackground = pStatisticsRoot->
    createChild("OgreTray/StaticImage", "Background");
  pBackground->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0)));
  pBackground->setSize(CEGUI::USize(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));
  pBackground->setInheritsAlpha(false);
  pBackground->setAlpha(1);
  pBackground->setProperty("Image", "main_menu_background/full");
  pBackground->setProperty("FrameEnabled", "False");
  pBackground->setProperty("BackgroundEnabled", "True");
  pBackground->setRiseOnClickEnabled(false);

  CEGUI::Window *pButtonContainer = pStatisticsRoot->createChild("DefaultWindow", "ButtonContainer");
  pButtonContainer->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
  pButtonContainer->setSize(USize(UDim(1, 0), UDim(1, 0)));

  CEGUI::Window *pFinishedText = pButtonContainer->createChild("OgreTray/Titlebar", "text");
  pFinishedText->setFont("dejavusans20");
  pFinishedText->setText("unset");
  pFinishedText->setPosition(UVector2(UDim(0.05,0), UDim(0.05,0)));
  pFinishedText->setSize(USize(UDim(0.9, 0), UDim(0.1, 0)));

  CEGUI::Window *pStatisticsGroup = pButtonContainer->createChild("OgreTray/Group", "statisticsgroup");
  pStatisticsGroup->setFont("dejavusans16");
  pStatisticsGroup->setText(XMLResources::GLOBAL.getCEGUIString("Statistics"));
  pStatisticsGroup->setPosition(UVector2(UDim(0.1, 0), UDim(0.2, 0)));
  pStatisticsGroup->setSize(USize(UDim(0.8, 0), UDim(0.5, 0)));

  CEGUI::Window *pRetryButton = pButtonContainer->createChild("OgreTray/Button", "Retry");
  pRetryButton->setPosition(UVector2(UDim(0.1, 0), UDim(0.8, 0)));
  pRetryButton->setSize(USize(UDim(0.3, 0), UDim(0.15, 0)));
  pRetryButton->setFont("dejavusans16");
  pRetryButton->setText(XMLResources::GLOBAL.getCEGUIString("Retry"));
  m_pButtons[BT_RETRY] = pRetryButton;
  pRetryButton->subscribeEvent(
			       CEGUI::PushButton::EventClicked,
			       CEGUI::Event::Subscriber(&CGUIStatistics::onRetryClicked, this));


  CEGUI::Window *pToMenuButton = pButtonContainer->createChild("OgreTray/Button", "ToMenu");
  pToMenuButton->setPosition(UVector2(UDim(0.6, 0), UDim(0.8, 0)));
  pToMenuButton->setSize(USize(UDim(0.3, 0), UDim(0.15, 0)));
  pToMenuButton->setFont("dejavusans16");
  pToMenuButton->setText(XMLResources::GLOBAL.getCEGUIString("To level selection"));
  pToMenuButton->subscribeEvent(
				CEGUI::PushButton::EventClicked,
				CEGUI::Event::Subscriber(&CGUIStatistics::onToMenuClicked, this));
  m_pButtons[BT_TO_MENU] = pToMenuButton;

  for (int i = 0; i < L_COUNT; i++) {
    createLabel(i, pStatisticsGroup, false);
    createLabel(i, pStatisticsGroup, true);
  }

  hide();
}
开发者ID:ChWick,项目名称:Mencus,代码行数:68,代码来源:GUIStatistics.cpp


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