ToolBox(IrrlichtDevice* device) : GameEntity(device) { //IGUIElement* root = env->getRootGUIElement(); //Grab the pointer to the toolbox element if it exists (ID = 5000); search children as well. IGUIElement* e = env->getRootGUIElement()->getElementFromId(5000, true); //Remove tool box if already there if (e) e->remove(); //Create the toolbox window (ID = 5000) IGUIWindow* wnd = env->addWindow(rect<s32>(600,25,800,480), false, L"Tool BoX", 0, 5000); //Create tab control IGUITabControl* tab = env->addTabControl(rect<s32>(2,20,800-602,480-7), wnd, true, true); //Add "Scale" Tab IGUITab* t1 = tab->addTab(L"Scale"); //Add some edit boxes env->addEditBox(L"1.0", rect<s32>(40,50,130,70), true, t1, 901); env->addEditBox(L"1.0", rect<s32>(40,80,130,100), true, t1, 902); env->addEditBox(L"1.0", rect<s32>(40,110,130,130), true, t1, 903); //Add a "Set" button to "Scale" tab env->addButton(core::rect<s32>(10,150,100,190), t1, 1101, L"set"); // bring irrlicht engine logo to front, because it // now may be below the newly created toolbox //root->bringToFront(root->getElementFromId(666, true)); }
/* Finally, the third function creates a toolbox window. In this simple mesh viewer, this toolbox only contains a tab control with three edit boxes for changing the scale of the displayed model. */ void createToolBox() { // remove tool box if already there IGUIEnvironment* env = Device->getGUIEnvironment(); IGUIElement* root = env->getRootGUIElement(); IGUIElement* e = root->getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, true); if (e) e->remove(); // create the toolbox window IGUIWindow* wnd = env->addWindow(core::rect<s32>(600,45,800,480), false, L"Toolset", 0, GUI_ID_DIALOG_ROOT_WINDOW); // create tab control and tabs IGUITabControl* tab = env->addTabControl( core::rect<s32>(2,20,800-602,480-7), wnd, true, true); IGUITab* t1 = tab->addTab(L"Config"); // add some edit boxes and a button to tab one env->addStaticText(L"Scale:", core::rect<s32>(10,20,60,45), false, false, t1); env->addStaticText(L"X:", core::rect<s32>(22,48,40,66), false, false, t1); env->addEditBox(L"1.0", core::rect<s32>(40,46,130,66), true, t1, GUI_ID_X_SCALE); env->addStaticText(L"Y:", core::rect<s32>(22,82,40,96), false, false, t1); env->addEditBox(L"1.0", core::rect<s32>(40,76,130,96), true, t1, GUI_ID_Y_SCALE); env->addStaticText(L"Z:", core::rect<s32>(22,108,40,126), false, false, t1); env->addEditBox(L"1.0", core::rect<s32>(40,106,130,126), true, t1, GUI_ID_Z_SCALE); env->addButton(core::rect<s32>(10,134,85,165), t1, GUI_ID_BUTTON_SET_SCALE, L"Set"); // quick scale buttons env->addButton(core::rect<s32>(65,20,95,40), t1, GUI_ID_BUTTON_SCALE_MUL10, L"* 10"); env->addButton(core::rect<s32>(100,20,130,40), t1, GUI_ID_BUTTON_SCALE_DIV10, L"* 0.1"); updateScaleInfo(Model); // add transparency control env->addStaticText(L"GUI Transparency Control:", core::rect<s32>(10,200,150,225), true, false, t1); IGUIScrollBar* scrollbar = env->addScrollBar(true, core::rect<s32>(10,225,150,240), t1, GUI_ID_SKIN_TRANSPARENCY); scrollbar->setMax(255); scrollbar->setPos(255); // add framerate control env->addStaticText(L":", core::rect<s32>(10,240,150,265), true, false, t1); env->addStaticText(L"Framerate:", core::rect<s32>(12,240,75,265), false, false, t1); // current frame info env->addStaticText(L"", core::rect<s32>(75,240,200,265), false, false, t1, GUI_ID_ANIMATION_INFO); scrollbar = env->addScrollBar(true, core::rect<s32>(10,265,150,280), t1, GUI_ID_SKIN_ANIMATION_FPS); scrollbar->setMax(MAX_FRAMERATE); scrollbar->setMin(-MAX_FRAMERATE); scrollbar->setPos(DEFAULT_FRAMERATE); scrollbar->setSmallStep(1); }
//! Adds a tab control to the environment. IGUITabControl* CGUIEnvironment::addTabControl(const core::rect<s32>& rectangle, IGUIElement* parent, bool fillbackground, bool border, s32 id) { IGUITabControl* t = new CGUITabControl(this, parent ? parent : this, rectangle, fillbackground, border, id); t->drop(); return t; }
// Set up the gameplay interface GUI void GUIGame::setupGameplayGUI() { driver=App::getInstance()->getDevice()->getVideoDriver(); guienv=App::getInstance()->getDevice()->getGUIEnvironment(); GUIManager::getInstance()->createConsole(); IGUIInOutFader* fader=guienv->addInOutFader(); fader->setAlignment(EGUIA_UPPERLEFT,EGUIA_LOWERRIGHT,EGUIA_UPPERLEFT,EGUIA_LOWERRIGHT); fader->setVisible(false); fader->setID(GUIManager::ID_FADER); // NEW Create display size since IRRlicht return wrong values // Check the current screen size displayheight=screensize.Height; displaywidth=screensize.Width; // Create a cutscene text IGUIStaticText* guiCutsceneText = guienv->addStaticText(L"This is a standard cutscene text",core::rect<s32>(100,displayheight/2+(displayheight/4),displaywidth-10,displayheight-100),false,true,0,-1,false); guiCutsceneText->setOverrideFont(GUIManager::getInstance()->guiFontLarge28); guiCutsceneText->setAlignment(EGUIA_UPPERLEFT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT); guiCutsceneText->setVisible(false); guiCutsceneText->setID(GUIManager::ST_ID_CUTSCENE_TEXT); // This is called only in the PLAYER application #ifndef EDITOR // ---------------------------------------- guienv->getSkin()->setFont(GUIManager::getInstance()->guiFontC12); //guienv->getSkin()->setFont(guiFontCourier12); // Load textures ITexture* imgLogo = driver->getTexture(App::getInstance()->logoimage.c_str()); printf("Here is the logo: %s\n",App::getInstance()->logoimage.c_str()); //LOADER WINDOW IGUIWindow* guiLoaderWindow = guienv->addWindow(GUIManager::getInstance()->myRect(driver->getScreenSize().Width/2-300, driver->getScreenSize().Height/2-200,600,400),false,L"Loading...",0,GUIManager::WIN_LOADER); guiLoaderWindow->setDrawTitlebar(false); guiLoaderWindow->getCloseButton()->setVisible(false); guienv->addImage(imgLogo,vector2d<s32>(5,5),true,guiLoaderWindow); IGUIStaticText* guiLoaderDescription = guienv->addStaticText(L"Loading fonts...", GUIManager::getInstance()->myRect(10,350,580,40), true,true,guiLoaderWindow, GUIManager::TXT_ID_LOADER,false); //Define 2 buttons to place in the loader windows (player only) IGUIButton* guiBtGamePlay = guienv->addButton(core::rect<s32>(400,360,580,380),guiLoaderWindow, GUIManager::BT_PLAYER_START, L"PLAY GAME NOW!"); guiBtGamePlay->setVisible(false); IGUIButton* guiBtGameConfig = guienv->addButton(core::rect<s32>(20,360,200,380),guiLoaderWindow, GUIManager::BT_PLAYER_CONFIG, L"EDIT CONFIGURATION"); guiBtGameConfig->setVisible(false); App::getInstance()->quickUpdate(); GUIManager::getInstance()->loadFonts(); guiLoaderDescription->setText(L"Loading interface graphics..."); //printf("The GUI should display from here...\n"); // quick update App::getInstance()->quickUpdate(); // Buttons ITexture* imgCloseProgram = driver->getTexture("../media/art/bt_close_program.png"); ITexture* imgAbout = driver->getTexture("../media/art/bt_about.png"); ITexture* imgAbout1 = driver->getTexture("../media/art/bt_about_ghost.png"); ITexture* imgHelp = driver->getTexture("../media/art/bt_help.png"); ITexture* imgHelp1 = driver->getTexture("../media/art/bt_help_ghost.png"); ITexture* imgConfig = driver->getTexture("../media/art/bt_config.png"); ITexture* imgConfig1 = driver->getTexture("../media/art/bt_config_ghost.png"); IGUIWindow* guiMainToolWindow = guienv->addWindow(GUIManager::getInstance()->myRect(driver->getScreenSize().Width-170,0,170,46),false,0,0,GUIManager::WIN_GAMEPLAY); guiMainToolWindow->setDraggable(false); guiMainToolWindow->setDrawTitlebar(false); guiMainToolWindow->getCloseButton()->setVisible(false); guiMainToolWindow->setVisible(false); //Play Game int x = 0; mainToolbarPos.Y=5; IGUIButton* guiPlayGame= guienv->addButton(GUIManager::getInstance()->myRect(10+x,mainToolbarPos.Y,32,32), guiMainToolWindow, GUIManager::BT_ID_PLAY_GAME,L"", stringw(LANGManager::getInstance()->getText("bt_play_game")).c_str()); guiPlayGame->setImage(driver->getTexture("../media/art/bt_play_game.png")); //Stop Game IGUIButton* guiStopGame= guienv->addButton(GUIManager::getInstance()->myRect(10+x,mainToolbarPos.Y,32,32), guiMainToolWindow, GUIManager::BT_ID_STOP_GAME,L"", stringw(LANGManager::getInstance()->getText("bt_stop_game")).c_str()); guiStopGame->setImage(driver->getTexture("../media/art/bt_stop_game.png")); guiStopGame->setVisible(false); //ABOUT BUTTON x += 42; IGUIButton* guiAbout = guienv->addButton(GUIManager::getInstance()->myRect(10+x,mainToolbarPos.Y,32,32), guiMainToolWindow, GUIManager::BT_ID_ABOUT,L"", stringw(LANGManager::getInstance()->getText("bt_about")).c_str() ); guiAbout->setImage(imgAbout); guiAbout->setPressedImage(imgAbout1); // Help Button x += 42; IGUIButton* guiHelpButton = guienv->addButton(GUIManager::getInstance()->myRect(10+x,mainToolbarPos.Y,32,32), guiMainToolWindow, GUIManager::BT_ID_HELP,L"", stringw(LANGManager::getInstance()->getText("bt_help")).c_str() ); guiHelpButton->setImage(imgHelp); guiHelpButton->setPressedImage(imgHelp1); // Close program x += 42; IGUIButton* guiCloseProgram = guienv->addButton(GUIManager::getInstance()->myRect(10+x,mainToolbarPos.Y,32,32), guiMainToolWindow, GUIManager::BT_ID_CLOSE_PROGRAM,L"", stringw(LANGManager::getInstance()->getText("bt_close_program")).c_str() ); guiCloseProgram->setImage(imgCloseProgram); //ABOUT WINDOW IGUIWindow* guiAboutWindow = guienv->addWindow(GUIManager::getInstance()->myRect(driver->getScreenSize().Width/2 - 300,driver->getScreenSize().Height/2 - 200,600,400),false); guiAboutWindow->setDraggable(false); guiAboutWindow->setDrawTitlebar(false); guiAboutWindow->getCloseButton()->setVisible(false); guiAboutWindow->setVisible(false); guienv->addImage(driver->getTexture("../media/art/logo1.png"),position2di(guiAboutWindow->getAbsoluteClippingRect().getWidth()/2-100,10),true,guiAboutWindow); IGUIButton* guiAboutClose = guienv->addButton(GUIManager::getInstance()->myRect(guiAboutWindow->getAbsoluteClippingRect().getWidth() - 37,guiAboutWindow->getAbsoluteClippingRect().getHeight() - 37,32,32),guiAboutWindow,GUIManager::BT_ID_ABOUT_WINDOW_CLOSE); guiAboutClose->setImage(driver->getTexture("../media/art/bt_yes_32.png")); IGUIListBox* guiAboutText = guienv ->addListBox(GUIManager::getInstance()->myRect(guiAboutWindow->getAbsoluteClippingRect().getWidth()/2-250,160,500,200),guiAboutWindow); // Ask the LANGManager to fill the box with the proper Language of the about text. LANGManager::getInstance()->setAboutText(guiAboutText); // Create the Configuration window (Need to be updated) #ifndef EDITOR configWindow = new GUIConfigWindow(App::getInstance()->getDevice()); configWindow->setID(GUIManager::GCW_CONFIG_WINDOW); // Give back to the GUI Manager since it's needed for both applications GUIManager::getInstance()->setConfigWindow(configWindow); #endif // --------------------------------------- #endif // --- Active game menu during play ITexture* gameplay_bar = driver->getTexture("../media/art/gameplay_bar.png"); ITexture* circle = driver->getTexture("../media/art/circle.png"); ITexture* circleMana = driver->getTexture("../media/art/circlemana.png"); ITexture* topCircle = driver->getTexture("../media/art/circle_top.png"); IGUIImage* gameplay_bar_image = NULL; if (gameplay_bar) { gameplay_bar_image = guienv->addImage(gameplay_bar,vector2d<s32>((displaywidth/2)-(gameplay_bar->getSize().Width/2),displayheight-gameplay_bar->getSize().Height),true); gameplay_bar_image->setAlignment(EGUIA_CENTER,EGUIA_CENTER,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT); gameplay_bar_image->setID(GUIManager::IMG_BAR); // The life gauge CGUIGfxStatus* lifegauge = new gui::CGUIGfxStatus(guienv, gameplay_bar_image,GUIManager::getInstance()->myRect((gameplay_bar->getSize().Width/2)-60,gameplay_bar->getSize().Height-128,128,128),-1); lifegauge->setImage(circle); lifegauge->ViewHalfLeft(); lifegauge->setID(GUIManager::IMG_LIFEGAUGE); // The mana gauge CGUIGfxStatus* managauge = new gui::CGUIGfxStatus(guienv, gameplay_bar_image,GUIManager::getInstance()->myRect((gameplay_bar->getSize().Width/2)-60,gameplay_bar->getSize().Height-128,128,128),-1); managauge->setImage(circleMana); managauge->ViewHalfRight(); managauge->setID(GUIManager::IMG_MANAGAUGE); // The image over the circle IGUIImage* circle_overlay = guienv->addImage(topCircle,vector2d<s32>((gameplay_bar->getSize().Width/2)-64,gameplay_bar->getSize().Height-128),true,gameplay_bar_image); } gameplay_bar_image->setVisible(false); ///DIALOG guiDialogImgYes = driver->getTexture("../media/art/img_yes.png"); guiDialogImgYes_s = driver->getTexture("../media/art/img_yes_s.png"); guiDialogImgNo = driver->getTexture("../media/art/img_no.png"); guiDialogImgNo_s = driver->getTexture("../media/art/img_no_s.png"); //view items if (gameplay_bar_image) { core::stringw text=LANGManager::getInstance()->getText("bt_view_items"); IGUIButton* guiBtViewItems = guienv->addButton(GUIManager::getInstance()->myRect(465,85,48,48), //displaywidth/2 + 80,displayheight - 57,48,48), gameplay_bar_image, GUIManager::BT_ID_VIEW_ITEMS,L"", text.c_str()); guiBtViewItems->setImage(driver->getTexture("../media/art/bt_view_items.png")); guiBtViewItems->setVisible(true); } //Items window IGUIWindow* guiWindowItems = guienv->addWindow(GUIManager::getInstance()->myRect(100,100,displaywidth-200,displayheight-150),false,L"",0,GUIManager::GCW_GAMEPLAY_ITEMS); guiWindowItems->getCloseButton()->setVisible(false); guiWindowItems->setDrawTitlebar(false); guiWindowItems->setDraggable(false); guiWindowItems->setAlignment(EGUIA_CENTER,EGUIA_CENTER,EGUIA_CENTER,EGUIA_CENTER); IGUITabControl * gameTabCtrl = guienv->addTabControl(core::rect<s32>(10,30,displaywidth-240,displayheight-200),guiWindowItems,false,true,-1); IGUITab * tab1 = gameTabCtrl->addTab(LANGManager::getInstance()->getText("game_stats_title").c_str()); IGUITab * tab2 = gameTabCtrl->addTab(LANGManager::getInstance()->getText("game_inventory_title").c_str()); IGUITab * tab3 = gameTabCtrl->addTab(LANGManager::getInstance()->getText("game_skills_title").c_str()); IGUITab * tab4 = gameTabCtrl->addTab(LANGManager::getInstance()->getText("game_quests_title").c_str()); nodepreview = new NodePreview(guienv,tab1,rect<s32>(440,40,740,370),-1); nodepreview->drawBackground(false); //DynamicObjectsManager::getInstance()->setActiveObject("player_template"); //guiPlayerNodePreview->setNode(DynamicObjectsManager::getInstance()->getActiveObject()->getNode()); //guiPlayerNodePreview->setNode(Player::getInstance()->getNodeRef()); //DynamicObjectsManager::getInstance()->setActiveObject("Archer"); //printf("This is the node name: %s\n",DynamicObjectsManager::getInstance()->getActiveObject()->getName()); nodepreview->setAlignment(EGUIA_UPPERLEFT,EGUIA_LOWERRIGHT,EGUIA_UPPERLEFT,EGUIA_UPPERLEFT); IGUIListBox* guiPlayerItems = guienv->addListBox(GUIManager::getInstance()->myRect(10,30,200,displayheight-340),tab2,GUIManager::LB_ID_PLAYER_ITEMS,true); ITexture* info_none = driver->getTexture("../media/editor/info_none.jpg"); IGUIImage* guiPlayerLootImage = NULL; if (info_none) guiPlayerLootImage = guienv->addImage(info_none,vector2d<s32>(220,30),true,tab2,GUIManager::IMG_LOOT); guienv->addStaticText(L"",core::rect<s32>(220,250,520,410),true,true,tab2,GUIManager::TXT_ID_LOOT_DESCRIPTION,true); //guienv->addImage(info_none,vector2d<s32>(5,5),true,tab2); core::stringc filename = "../media/dynamic_objects/"; IGUIButton* guiBtUseItem = guienv->addButton(GUIManager::getInstance()->myRect(10,displayheight-300,32,32), tab2, GUIManager::BT_ID_USE_ITEM, L"", stringw(LANGManager::getInstance()->getText("bt_use_item")).c_str()); guiBtUseItem->setImage(driver->getTexture("../media/art/bt_yes_32.png")); IGUIButton* guiBtDropItem = guienv->addButton(GUIManager::getInstance()->myRect(52,displayheight-300,32,32), tab2, GUIManager::BT_ID_DROP_ITEM, L"", stringw(LANGManager::getInstance()->getText("bt_drop_item")).c_str()); guiBtDropItem->setImage(driver->getTexture("../media/art/bt_no_32.png")); IGUIButton* guiBtCloseItemsWindow = guienv->addButton(GUIManager::getInstance()->myRect(displaywidth-210-32,displayheight-160 - 32,32,32), guiWindowItems, GUIManager::BT_ID_CLOSE_ITEMS_WINDOW, L"", stringw(LANGManager::getInstance()->getText("bt_close_items_window")).c_str()); guiBtCloseItemsWindow->setImage(driver->getTexture("../media/art/bt_arrow_32.png")); guiWindowItems->setVisible(false); // TExt GUI for player stats IGUIStaticText* guiPlayerMoney = guienv->addStaticText(L"GOLD:129",GUIManager::getInstance()->myRect(15,displayheight-300,300,32),false,false,tab1, GUIManager::ST_ID_PLAYER_MONEY); guiPlayerMoney->setOverrideFont(GUIManager::getInstance()->guiFontLarge28); guiPlayerMoney->setOverrideColor(SColor(255,255,255,255)); stringc playerLifeText = LANGManager::getInstance()->getText("txt_player_life"); IGUIStaticText* guiPlayerLife=guienv->addStaticText(stringw(playerLifeText).c_str(),GUIManager::getInstance()->myRect(15,6,600,30),false,false,tab1,-1,false); guiPlayerLife->setOverrideColor(SColor(255,255,255,100)); guiPlayerLife->setOverrideFont(GUIManager::getInstance()->guiFontLarge28); guiPlayerLife->setID(GUIManager::ST_ID_PLAYER_LIFE); //Have to rework this. Currently hidden. IGUIStaticText* guiPlayerLife_Shadow=guienv->addStaticText(stringw(playerLifeText).c_str(),GUIManager::getInstance()->myRect(14,5,600,30),false,false,tab1,-1,false); guiPlayerLife_Shadow->setOverrideColor(SColor(255,30,30,30)); guiPlayerLife_Shadow->setOverrideFont(GUIManager::getInstance()->guiFontLarge28); guiPlayerLife_Shadow->setVisible(false); GUIManager::getInstance()->setElementVisible(GUIManager::ST_ID_PLAYER_LIFE, false); ////// -------------------------------- /// Define the Dialogs used in the game ////// IGUIWindow* guidialog = guienv->addWindow(GUIManager::getInstance()->myRect(10,displayheight-200,displaywidth-20,190),true,L"",0,GUIManager::GCW_DIALOG); guidialog->getCloseButton()->setVisible(false); guidialog->setDrawTitlebar(false); guidialog->setDraggable(false); guidialog->setDrawBackground(false); guidialog->setAlignment(EGUIA_UPPERLEFT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT); // Panel background is done with pictures IGUIImage* img1 = guienv->addImage(driver->getTexture("../media/art/panel_left.png"),vector2d<s32>(0,0),true,guidialog); IGUIImage* img2 = guienv->addImage(driver->getTexture("../media/art/panel_middle.png"),vector2d<s32>(51,0),true,guidialog); IGUIImage* img3 = guienv->addImage(driver->getTexture("../media/art/panel_right.png"),vector2d<s32>(581,0),true,guidialog); img2->setScaleImage(true); img2->setAlignment(EGUIA_UPPERLEFT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT); img3->setAlignment(EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT); // Text display of the panel rect<s32> textRect = rect<s32>(30,25,600,170); IGUIStaticText* txt_dialog = guienv->addStaticText(L"Hello! This is a simple test to see how the text is flowing inside the box. There is a test, test, and test of text we need to make to be sure the flowing is ok",textRect,false,false,guidialog,GUIManager::TXT_ID_DIALOG,false); txt_dialog->setOverrideFont(GUIManager::getInstance()->guiFontDialog); txt_dialog->setOverrideColor(SColor(255,255,255,255)); txt_dialog->setWordWrap(true); txt_dialog->setAlignment(EGUIA_UPPERLEFT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT); IGUIButton* guiBtDialogYes = guienv->addButton(GUIManager::getInstance()->myRect(640,30,52,52), guidialog, GUIManager::BT_ID_DIALOG_YES, L"", stringw(LANGManager::getInstance()->getText("bt_dialog_yes")).c_str()); guiBtDialogYes->setImage(guiDialogImgYes); guiBtDialogYes->setAlignment(EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT); IGUIButton* guiBtDialogCancel = guienv->addButton(GUIManager::getInstance()->myRect(640,110,52,52), guidialog, GUIManager::BT_ID_DIALOG_CANCEL, L"", stringw(LANGManager::getInstance()->getText("bt_dialog_no")).c_str()); guiBtDialogCancel->setImage(guiDialogImgNo); guiBtDialogCancel->setAlignment(EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT,EGUIA_LOWERRIGHT); guidialog->setVisible(false); }
//! constructor CGUIEditWindow::CGUIEditWindow(IGUIEnvironment* environment, core::rect<s32> rectangle, IGUIElement *parent) : IGUIWindow(environment, parent, -1, rectangle), Dragging(false), Resizing(false), SelectedElement(0), AttribEditor(0), OptionEditor(0), EnvEditor(0) { #ifdef _DEBUG setDebugName("CGUIEditWindow"); #endif // we can't tab out of this window setTabGroup(true); // we can ctrl+tab to it setTabStop(true); // the tab order number is auto-assigned setTabOrder(-1); // set window text setText(L"GUI Editor"); // return if we have no skin. IGUISkin *skin = environment->getSkin(); if (!skin) return; s32 th = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH); setRelativePosition(core::rect<s32>(50,50,250,500)); setMinSize( core::dimension2di(200,200)); IGUITabControl *TabControl = environment->addTabControl(core::rect<s32>(1,th+5,199,449), this, false, true); TabControl->setSubElement(true); TabControl->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); IGUITab* ToolsTab = TabControl->addTab(L"Tools"); //L"Texture Cache Browser" //L"Font Browser" //L"Font Generator" //L"Sprite Editor" //Environment->addGUIElement("textureCacheBrowser", this); IGUITab* OptionsTab = TabControl->addTab(L"Attributes"); IGUITabControl *AttribTabControl = environment->addTabControl(core::rect<s32>(1,1,100,100), OptionsTab, false, true); AttribTabControl->setRelativePosition( core::rect<f32>(0.0f, 0.0f, 1.0f, 1.0f)); AttribTabControl->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); IGUITab* EditorTab = AttribTabControl->addTab(L"Editor"); OptionEditor = (CGUIAttributeEditor*) environment->addGUIElement("attributeEditor", EditorTab); OptionEditor->grab(); OptionEditor->setID(EGUIEDCE_OPTION_EDITOR); OptionEditor->setRelativePosition(core::rect<f32>(0.0f, 0.0f, 1.0f, 1.0f)); OptionEditor->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); if (Parent && Parent->getParent() == Environment->getRootGUIElement()) { IGUITab* EnvTab = AttribTabControl->addTab(L"Env"); EnvEditor = (CGUIAttributeEditor*) environment->addGUIElement("attributeEditor", EnvTab); EnvEditor->grab(); EnvEditor->setID(EGUIEDCE_ENV_EDITOR); EnvEditor->setRelativePosition(core::rect<f32>(0.0f, 0.0f, 1.0f, 1.0f)); EnvEditor->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); } IGUITab* ElementTab = AttribTabControl->addTab(L"Element"); AttribEditor = (CGUIAttributeEditor*) environment->addGUIElement("attributeEditor", ElementTab); AttribEditor->grab(); AttribEditor->setID(EGUIEDCE_ATTRIB_EDITOR); AttribEditor->setRelativePosition( core::rect<f32>(0.0f, 0.0f, 1.0f, 1.0f)); AttribEditor->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); ResizeButton = environment->addButton(core::rect<s32>(199-th,449-th,199,449), this); ResizeButton->setDrawBorder(false); ResizeButton->setEnabled(false); ResizeButton->setSpriteBank(skin->getSpriteBank()); ResizeButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_RESIZE), skin->getColor(EGDC_WINDOW_SYMBOL)); ResizeButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_RESIZE), skin->getColor(EGDC_WINDOW_SYMBOL)); ResizeButton->grab(); ResizeButton->setSubElement(true); ResizeButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT); }