void UpdateText(CProfileIterator* profileIterator, bool idle) { static bool update=true; m_ctrl->SetBounds(0,0,this->GetInnerBounds().w,this->GetInnerBounds().h); // if (!update) // return; update=false; static int test = 1; test++; static double time_since_reset = 0.f; if (!idle) { time_since_reset = CProfileManager::Get_Time_Since_Reset(); } //Gwen::UnicodeString txt = Gwen::Utility::Format( L"FEM Settings %i fps", test ); { //recompute profiling data, and store profile strings char blockTime[128]; double totalTime = 0; int frames_since_reset = CProfileManager::Get_Frame_Count_Since_Reset(); profileIterator->First(); double parent_time = profileIterator->Is_Root() ? time_since_reset : profileIterator->Get_Current_Parent_Total_Time(); Gwen::Controls::TreeNode* curParent = m_node; double accumulated_time = dumpRecursive(profileIterator,m_node); Gwen::UnicodeString txt = Gwen::Utility::Format( L"Profiling: %s total time: %.3f ms, unaccounted %.3f %% :: %.3f ms", profileIterator->Get_Current_Parent_Name(), parent_time , parent_time > SIMD_EPSILON ? ((parent_time - accumulated_time) / parent_time) * 100 : 0.f, parent_time - accumulated_time); //sprintf(blockTime,"--- Profiling: %s (total running time: %.3f ms) ---", profileIterator->Get_Current_Parent_Name(), parent_time ); //displayProfileString(xOffset,yStart,blockTime); m_node->SetText(txt); //printf("%s (%.3f %%) :: %.3f ms\n", "Unaccounted:",); } static bool once1 = true; if (once1) { once1 = false; m_ctrl->ExpandAll(); } }
MyProfileWindow ( Gwen::Controls::Base* pParent) : Gwen::Controls::WindowControl( pParent ) { SetTitle( L"FEM Settings" ); SetSize( 450, 150 ); this->SetPos(0,40); // this->Dock( Gwen::Pos::Bottom); { m_ctrl = new Gwen::Controls::TreeControl( this ); m_node = m_ctrl->AddNode( L"Total Parent Time" ); //Gwen::Controls::TreeNode* pNode = ctrl->AddNode( L"Node Two" ); //pNode->AddNode( L"Node Two Inside" ); //pNode->AddNode( L"Eyes" ); //pNode->AddNode( L"Brown" )->AddNode( L"Node Two Inside" )->AddNode( L"Eyes" )->AddNode( L"Brown" ); //Gwen::Controls::TreeNode* node = ctrl->AddNode( L"Node Three" ); //m_ctrl->Dock(Gwen::Pos::Bottom); m_ctrl->ExpandAll(); m_ctrl->SetBounds( this->GetInnerBounds().x,this->GetInnerBounds().y,this->GetInnerBounds().w,this->GetInnerBounds().h); } }
GWEN_CONTROL_INLINE( TreeControl, GUnit ) { { Gwen::Controls::TreeControl* ctrl = new Gwen::Controls::TreeControl( this ); ctrl->AddNode( L"Node One" ); Gwen::Controls::TreeNode* pNode = ctrl->AddNode( L"Node Two" ); pNode->AddNode( L"Node Two Inside" ); pNode->AddNode( L"Eyes" ); pNode->AddNode( L"Brown" )->AddNode( L"Node Two Inside" )->AddNode( L"Eyes" )->AddNode( L"Brown" ); pNode->AddNode( L"More" ); pNode->AddNode( L"Nodes" ); ctrl->AddNode( L"Node Three" ); ctrl->SetBounds( 30, 30, 200, 200 ); ctrl->ExpandAll(); } { Gwen::Controls::TreeControl* ctrl = new Gwen::Controls::TreeControl( this ); ctrl->AllowMultiSelect( true ); ctrl->AddNode( L"Node One" ); Gwen::Controls::TreeNode* pNode = ctrl->AddNode( L"Node Two" ); pNode->AddNode( L"Node Two Inside" ); pNode->AddNode( L"Eyes" ); Gwen::Controls::TreeNode* pNodeTwo = pNode->AddNode( L"Brown" )->AddNode( L"Node Two Inside" )->AddNode( L"Eyes" ); pNodeTwo->AddNode( L"Brown" ); pNodeTwo->AddNode( L"Green" ); pNodeTwo->AddNode( L"Slime" ); pNodeTwo->AddNode( L"Grass" ); pNodeTwo->AddNode( L"Pipe" ); pNode->AddNode( L"More" ); pNode->AddNode( L"Nodes" ); ctrl->AddNode( L"Node Three" ); ctrl->SetBounds( 240, 30, 200, 200 ); ctrl->ExpandAll(); } }
MyProfileWindow ( Gwen::Controls::Base* pParent) : Gwen::Controls::WindowControl( pParent ), profIter(0) { SetTitle( L"Time Profiler" ); SetSize( 450, 450 ); this->SetPos(10,400); // this->Dock( Gwen::Pos::Bottom); { m_ctrl = new Gwen::Controls::TreeControl( this ); m_node = m_ctrl->AddNode( L"Total Parent Time" ); //Gwen::Controls::TreeNode* pNode = ctrl->AddNode( L"Node Two" ); //pNode->AddNode( L"Node Two Inside" ); //pNode->AddNode( L"Eyes" ); //pNode->AddNode( L"Brown" )->AddNode( L"Node Two Inside" )->AddNode( L"Eyes" )->AddNode( L"Brown" ); //Gwen::Controls::TreeNode* node = ctrl->AddNode( L"Node Three" ); //m_ctrl->Dock(Gwen::Pos::Bottom); m_ctrl->ExpandAll(); m_ctrl->SetKeyboardInputEnabled(true); m_ctrl->SetBounds( this->GetInnerBounds().x,this->GetInnerBounds().y,this->GetInnerBounds().w,this->GetInnerBounds().h); } }
void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* renderer,float retinaScale) { m_data->m_curYposition = 20; //m_data->m_primRenderer = new GLPrimitiveRenderer(width,height); m_data->pRenderer = renderer;//new GwenOpenGL3CoreRenderer(m_data->m_primRenderer,stash,width,height,retinaScale); m_data->skin.SetRender( m_data->pRenderer ); m_data->pCanvas= new Gwen::Controls::Canvas( &m_data->skin ); m_data->pCanvas->SetSize( width,height); m_data->pCanvas->SetDrawBackground( false); m_data->pCanvas->SetBackgroundColor( Gwen::Color( 150, 170, 170, 255 ) ); MyTestMenuBar* menubar = new MyTestMenuBar(m_data->pCanvas); m_data->m_viewMenu = menubar->m_viewMenu; m_data->m_menuItems = menubar->m_menuItems; m_data->m_menubar = menubar; Gwen::Controls::StatusBar* bar = new Gwen::Controls::StatusBar(m_data->pCanvas); m_data->m_bar = bar; m_data->m_rightStatusBar = new Gwen::Controls::Label( bar ); m_data->m_rightStatusBar->SetWidth(width/2); //m_data->m_rightStatusBar->SetText( L"Label Added to Right" ); bar->AddControl( m_data->m_rightStatusBar, true ); m_data->m_TextOutput = new Gwen::Controls::ListBox( m_data->pCanvas ); m_data->m_TextOutput->Dock( Gwen::Pos::Bottom ); m_data->m_TextOutput->SetHeight( 100 ); m_data->m_leftStatusBar = new Gwen::Controls::Label( bar ); //m_data->m_leftStatusBar->SetText( L"Label Added to Left" ); m_data->m_leftStatusBar->SetWidth(width/2); bar->AddControl( m_data->m_leftStatusBar,false); //Gwen::KeyboardFocus /*Gwen::Controls::GroupBox* box = new Gwen::Controls::GroupBox(m_data->pCanvas); box->SetText("text"); box->SetName("name"); box->SetHeight(500); */ Gwen::Controls::ScrollControl* windowRight= new Gwen::Controls::ScrollControl(m_data->pCanvas); windowRight->Dock(Gwen::Pos::Right); windowRight->SetWidth(250); windowRight->SetHeight(250); windowRight->SetScroll(false,true); m_data->m_windowRight = windowRight; //windowLeft->SetSkin( Gwen::Controls::TabControl* tab = new Gwen::Controls::TabControl(windowRight); m_data->m_tab = tab; //tab->SetHeight(300); tab->SetWidth(240); tab->SetHeight(1250); //tab->Dock(Gwen::Pos::Left); tab->Dock( Gwen::Pos::Fill ); //tab->SetMargin( Gwen::Margin( 2, 2, 2, 2 ) ); Gwen::UnicodeString str1(L"Params"); m_data->m_demoPage = tab->AddPage(str1); // Gwen::UnicodeString str2(L"OpenCL"); // tab->AddPage(str2); //Gwen::UnicodeString str3(L"page3"); // tab->AddPage(str3); //but->onPress.Add(handler, &MyHander::onButtonA); //box->Dock(Gwen::Pos::Left); /*Gwen::Controls::WindowControl* windowBottom = new Gwen::Controls::WindowControl(m_data->pCanvas); windowBottom->SetHeight(100); windowBottom->Dock(Gwen::Pos::Bottom); windowBottom->SetTitle("bottom"); */ // Gwen::Controls::Property::Text* prop = new Gwen::Controls::Property::Text(m_data->pCanvas); //prop->Dock(Gwen::Pos::Bottom); /*Gwen::Controls::SplitterBar* split = new Gwen::Controls::SplitterBar(m_data->pCanvas); split->Dock(Gwen::Pos::Center); split->SetHeight(300); split->SetWidth(300); */ /* */ Gwen::Controls::ScrollControl* windowLeft = new Gwen::Controls::ScrollControl(m_data->pCanvas); windowLeft->Dock(Gwen::Pos::Left); // windowLeft->SetTitle("title"); windowLeft->SetScroll(false, false); windowLeft->SetWidth(250); windowLeft->SetPos(50, 50); windowLeft->SetHeight(500); //windowLeft->SetClosable(false); // windowLeft->SetShouldDrawBackground(true); windowLeft->SetTabable(true); Gwen::Controls::TabControl* explorerTab = new Gwen::Controls::TabControl(windowLeft); //tab->SetHeight(300); // explorerTab->SetWidth(230); explorerTab->SetHeight(250); //tab->Dock(Gwen::Pos::Left); explorerTab->Dock(Gwen::Pos::Fill); //m_data->m_exampleInfoTextOutput->SetBounds(2, 10, 236, 400); //windowRight Gwen::UnicodeString explorerStr1(L"Explorer"); m_data->m_explorerPage = explorerTab->AddPage(explorerStr1); Gwen::UnicodeString shapesStr1(L"Test"); Gwen::Controls::TabButton* shapes = explorerTab->AddPage(shapesStr1); ///todo(erwincoumans) figure out why the HSV color picker is extremely slow //Gwen::Controls::HSVColorPicker* color = new Gwen::Controls::HSVColorPicker(shapes->GetPage()); Gwen::Controls::ColorPicker* color = new Gwen::Controls::ColorPicker(shapes->GetPage()); color->SetKeyboardInputEnabled(true); Gwen::Controls::TreeControl* ctrl = new Gwen::Controls::TreeControl(m_data->m_explorerPage->GetPage()); m_data->m_explorerTreeCtrl = ctrl; ctrl->SetKeyboardInputEnabled(true); ctrl->Focus(); ctrl->SetBounds(2, 10, 236, 300); m_data->m_exampleInfoGroupBox = new Gwen::Controls::Label( m_data->m_explorerPage->GetPage() ); m_data->m_exampleInfoGroupBox->SetPos(2, 314); m_data->m_exampleInfoGroupBox->SetHeight( 15 ); m_data->m_exampleInfoGroupBox->SetWidth(234); m_data->m_exampleInfoGroupBox->SetText("Example Description"); m_data->m_exampleInfoTextOutput = new Gwen::Controls::ListBox(m_data->m_explorerPage->GetPage()); //m_data->m_exampleInfoTextOutput->Dock( Gwen::Pos::Bottom ); m_data->m_exampleInfoTextOutput->SetPos(2, 332); m_data->m_exampleInfoTextOutput->SetHeight( 150 ); m_data->m_exampleInfoTextOutput->SetWidth(233); }
void GwenUserInterface::init(int width, int height,struct sth_stash* stash,float retinaScale) { m_data->m_curYposition = 20; m_data->m_primRenderer = new GLPrimitiveRenderer(width,height); m_data->pRenderer = new GwenOpenGL3CoreRenderer(m_data->m_primRenderer,stash,width,height,retinaScale); m_data->skin.SetRender( m_data->pRenderer ); m_data->pCanvas= new Gwen::Controls::Canvas( &m_data->skin ); m_data->pCanvas->SetSize( width,height); m_data->pCanvas->SetDrawBackground( false); m_data->pCanvas->SetBackgroundColor( Gwen::Color( 150, 170, 170, 255 ) ); MyTestMenuBar* menubar = new MyTestMenuBar(m_data->pCanvas); Gwen::Controls::StatusBar* bar = new Gwen::Controls::StatusBar(m_data->pCanvas); m_data->m_rightStatusBar = new Gwen::Controls::Label( bar ); m_data->m_rightStatusBar->SetWidth(width/2); //m_data->m_rightStatusBar->SetText( L"Label Added to Right" ); bar->AddControl( m_data->m_rightStatusBar, true ); m_data->m_leftStatusBar = new Gwen::Controls::Label( bar ); //m_data->m_leftStatusBar->SetText( L"Label Added to Left" ); m_data->m_leftStatusBar->SetWidth(width/2); bar->AddControl( m_data->m_leftStatusBar,false); //Gwen::KeyboardFocus /*Gwen::Controls::GroupBox* box = new Gwen::Controls::GroupBox(m_data->pCanvas); box->SetText("text"); box->SetName("name"); box->SetHeight(500); */ Gwen::Controls::ScrollControl* windowRight= new Gwen::Controls::ScrollControl(m_data->pCanvas); windowRight->Dock(Gwen::Pos::Right); windowRight->SetWidth(150); windowRight->SetHeight(250); windowRight->SetScroll(false,true); //windowLeft->SetSkin( Gwen::Controls::TabControl* tab = new Gwen::Controls::TabControl(windowRight); //tab->SetHeight(300); tab->SetWidth(140); tab->SetHeight(250); //tab->Dock(Gwen::Pos::Left); tab->Dock( Gwen::Pos::Fill ); //tab->SetMargin( Gwen::Margin( 2, 2, 2, 2 ) ); Gwen::UnicodeString str1(L"Main"); m_data->m_demoPage = tab->AddPage(str1); // Gwen::UnicodeString str2(L"OpenCL"); // tab->AddPage(str2); //Gwen::UnicodeString str3(L"page3"); // tab->AddPage(str3); //but->onPress.Add(handler, &MyHander::onButtonA); //box->Dock(Gwen::Pos::Left); /*Gwen::Controls::WindowControl* windowBottom = new Gwen::Controls::WindowControl(m_data->pCanvas); windowBottom->SetHeight(100); windowBottom->Dock(Gwen::Pos::Bottom); windowBottom->SetTitle("bottom"); */ // Gwen::Controls::Property::Text* prop = new Gwen::Controls::Property::Text(m_data->pCanvas); //prop->Dock(Gwen::Pos::Bottom); /*Gwen::Controls::SplitterBar* split = new Gwen::Controls::SplitterBar(m_data->pCanvas); split->Dock(Gwen::Pos::Center); split->SetHeight(300); split->SetWidth(300); */ /* */ Gwen::Controls::ScrollControl* windowLeft = new Gwen::Controls::ScrollControl(m_data->pCanvas); windowLeft->Dock(Gwen::Pos::Left); // windowLeft->SetTitle("title"); windowLeft->SetScroll(false, false); windowLeft->SetWidth(250); windowLeft->SetPos(50, 50); windowLeft->SetHeight(500); //windowLeft->SetClosable(false); // windowLeft->SetShouldDrawBackground(true); windowLeft->SetTabable(true); Gwen::Controls::TabControl* explorerTab = new Gwen::Controls::TabControl(windowLeft); //tab->SetHeight(300); // explorerTab->SetWidth(230); explorerTab->SetHeight(250); //tab->Dock(Gwen::Pos::Left); explorerTab->Dock(Gwen::Pos::Fill); Gwen::UnicodeString explorerStr1(L"Explorer"); m_data->m_explorerPage = explorerTab->AddPage(explorerStr1); Gwen::UnicodeString shapesStr1(L"Shapes"); explorerTab->AddPage(shapesStr1); Gwen::UnicodeString testStr1(L"Test"); explorerTab->AddPage(testStr1); Gwen::Controls::TreeControl* ctrl = new Gwen::Controls::TreeControl(m_data->m_explorerPage->GetPage()); m_data->m_explorerTreeCtrl = ctrl; ctrl->SetKeyboardInputEnabled(true); ctrl->Focus(); ctrl->SetBounds(2, 10, 236, 400); }