StyleSet::StyleSet(QObject* pParent) : QObject(pParent) , mpStyleSetProps(StyleSetProps::nullStyleSetProps()) { auto* pEngine = StyleEngineHost::globalStyleEngine(); QObject* p = parent(); if (p) { QQuickItem* pItem = qobject_cast<QQuickItem*>(p); if (pItem != nullptr) { connect(pItem, &QQuickItem::parentChanged, this, &StyleSet::onParentChanged); } else if (p->parent() != nullptr) { styleSheetsLogInfo() << "Parent to StyleSet is not a QQuickItem but '" << p->metaObject()->className() << "'. " << "Hierarchy changes for this component won't be detected."; if (pEngine) { Q_EMIT pEngine->exception( QString::fromLatin1("noParentChangeReports"), QString::fromLatin1("Hierarchy changes for this component won't be detected")); } } mPath = traversePathUp(p); if (!pEngine) { connect(StyleEngineHost::globalStyleEngineHost(), &StyleEngineHost::styleEngineLoaded, this, &StyleSet::onStyleEngineLoaded); } setupStyle(); } }
void StyleSet::onParentChanged(QQuickItem* pNewParent) { QObject* pParent = parent(); if (pNewParent != nullptr && pParent != nullptr) { mPath = traversePathUp(pParent); setupStyle(); Q_EMIT pathChanged(); } }
void StyleSet::onStyleEngineLoaded(StyleEngine* pEngine) { Q_ASSERT(pEngine); Q_UNUSED(pEngine); disconnect(StyleEngineHost::globalStyleEngineHost(), &StyleEngineHost::styleEngineLoaded, this, &StyleSet::onStyleEngineLoaded); setupStyle(); Q_ASSERT(mpStyleSetProps != StyleSetProps::nullStyleSetProps()); }
void StyleSet::setName(const QString& val) { if (mName != val) { mName = val; QObject* p = parent(); if (p) { mPath = traversePathUp(p); setupStyle(); } Q_EMIT nameChanged(mName); Q_EMIT pathChanged(); } }
void MainWindow::setupUI() { connectMenusAndShortcut(); setupSplitters(); s_widgetUI.buttonsFrame=createButtonsFrame(); s_widgetUI.toolboxOptionFrame=setupOptionsFrame(); setupPlots(); //Adding split layout s_widgetUI.plotSplitter->addWidget(m_plotTime); s_widgetUI.plotSplitter->addWidget(m_plotFreq); s_widgetUI.commandSplitter->addWidget(s_widgetUI.toolboxOptionFrame); s_widgetUI.commandSplitter->addWidget(s_widgetUI.buttonsFrame); //Layout all the windows ui->centralwidget->layout()->addWidget(s_widgetUI.globalSplitter); this->setWindowTitle("New Complex Generator project"); setupStyle(); }
void create(float _fontSize, bx::AllocatorI* _allocator) { m_allocator = _allocator; if (NULL == _allocator) { static bx::DefaultAllocator allocator; m_allocator = &allocator; } m_viewId = 255; m_lastScroll = 0; m_last = bx::getHPCounter(); ImGuiIO& io = ImGui::GetIO(); io.RenderDrawListsFn = renderDrawLists; io.MemAllocFn = memAlloc; io.MemFreeFn = memFree; io.DisplaySize = ImVec2(1280.0f, 720.0f); io.DeltaTime = 1.0f / 60.0f; io.IniFilename = NULL; setupStyle(true); #if defined(SCI_NAMESPACE) io.KeyMap[ImGuiKey_Tab] = (int)entry::Key::Tab; io.KeyMap[ImGuiKey_LeftArrow] = (int)entry::Key::Left; io.KeyMap[ImGuiKey_RightArrow] = (int)entry::Key::Right; io.KeyMap[ImGuiKey_UpArrow] = (int)entry::Key::Up; io.KeyMap[ImGuiKey_DownArrow] = (int)entry::Key::Down; io.KeyMap[ImGuiKey_Home] = (int)entry::Key::Home; io.KeyMap[ImGuiKey_End] = (int)entry::Key::End; io.KeyMap[ImGuiKey_Delete] = (int)entry::Key::Delete; io.KeyMap[ImGuiKey_Backspace] = (int)entry::Key::Backspace; io.KeyMap[ImGuiKey_Enter] = (int)entry::Key::Return; io.KeyMap[ImGuiKey_Escape] = (int)entry::Key::Esc; io.KeyMap[ImGuiKey_A] = (int)entry::Key::KeyA; io.KeyMap[ImGuiKey_C] = (int)entry::Key::KeyC; io.KeyMap[ImGuiKey_V] = (int)entry::Key::KeyV; io.KeyMap[ImGuiKey_X] = (int)entry::Key::KeyX; io.KeyMap[ImGuiKey_Y] = (int)entry::Key::KeyY; io.KeyMap[ImGuiKey_Z] = (int)entry::Key::KeyZ; #endif // defined(SCI_NAMESPACE) bgfx::RendererType::Enum type = bgfx::getRendererType(); m_program = bgfx::createProgram( bgfx::createEmbeddedShader(s_embeddedShaders, type, "vs_ocornut_imgui") , bgfx::createEmbeddedShader(s_embeddedShaders, type, "fs_ocornut_imgui") , true ); u_imageLodEnabled = bgfx::createUniform("u_imageLodEnabled", bgfx::UniformType::Vec4); m_imageProgram = bgfx::createProgram( bgfx::createEmbeddedShader(s_embeddedShaders, type, "vs_imgui_image") , bgfx::createEmbeddedShader(s_embeddedShaders, type, "fs_imgui_image") , true ); m_decl .begin() .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float) .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float) .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) .end(); s_tex = bgfx::createUniform("s_tex", bgfx::UniformType::Int1); uint8_t* data; int32_t width; int32_t height; { ImFontConfig config; config.FontDataOwnedByAtlas = false; config.MergeMode = false; // config.MergeGlyphCenterV = true; const ImWchar* ranges = io.Fonts->GetGlyphRangesCyrillic(); m_font[ImGui::Font::Regular] = io.Fonts->AddFontFromMemoryTTF( (void*)s_robotoRegularTtf, sizeof(s_robotoRegularTtf), _fontSize, &config, ranges); m_font[ImGui::Font::Mono ] = io.Fonts->AddFontFromMemoryTTF( (void*)s_robotoMonoRegularTtf, sizeof(s_robotoMonoRegularTtf), _fontSize-3.0f, &config, ranges); config.MergeMode = true; config.DstFont = m_font[ImGui::Font::Regular]; for (uint32_t ii = 0; ii < BX_COUNTOF(s_fontRangeMerge); ++ii) { const FontRangeMerge& frm = s_fontRangeMerge[ii]; io.Fonts->AddFontFromMemoryTTF( (void*)frm.data , (int)frm.size , _fontSize-3.0f , &config , frm.ranges ); } } io.Fonts->GetTexDataAsRGBA32(&data, &width, &height); m_texture = bgfx::createTexture2D( (uint16_t)width , (uint16_t)height , false , 1 , bgfx::TextureFormat::BGRA8 , 0 , bgfx::copy(data, width*height*4) ); ImGui::InitDockContext(); }
void compareAlignmentsSeries( int N, char files[10][255], TString alment0, TString alment) { // gSystem->Load("TTreeAnalysis_C.so"); setupStyle(); AlighnmentTTrees alignTrees[10]; char dum[100]; sprintf(dum,"%s_",alment0.Data()); importTreesFromFile(files[0], alment0, &alignTrees[0], alment0+"_"); for (Int_t i=1; i<=N; i++) { sprintf(dum,"%s_%d_",alment.Data(),i); importTreesFromFile(files[i-1], alment, &alignTrees[i], dum); alignTrees[i].DTWheels->AddFriend(alignTrees[0].DTWheels,"a"); alignTrees[i].DTChambers->AddFriend(alignTrees[0].DTChambers,"a"); alignTrees[i].DTStations->AddFriend(alignTrees[0].DTStations,"a"); //alignTrees[i].DTSuperLayers->AddFriend(alignTrees[0].DTSuperLayers,"a"); //alignTrees[i].DTLayers->AddFriend(alignTrees[0].DTLayers,"a"); alignTrees[i].CSCStations->AddFriend(alignTrees[0].CSCStations,"a"); alignTrees[i].CSCChambers->AddFriend(alignTrees[0].CSCChambers,"a"); //alignTrees[i].CSCLayers->AddFriend(alignTrees[0].CSCLayers,"a"); } /// ------ PLOTTING ------------- char histostr[100], drawstr[300], cutstr[200], hsetupstr[200]; double nbin = 20, low = -0.15, high = 0.15; TCanvas *tc = new TCanvas("test","test",500,500); // alignTrees[5].DTChambers->Draw( // "atan2(y,x)-atan2(a.y,a.x)>>h_dphi(100)","structa==2"); TCanvas *c1 = new TCanvas("c_barrel_dxloc","c_barrel_dxloc",1500,350); c1->Divide(5,1,0.001,0.001); TH1F *h_bdxloc_[6]; h_bdxloc_[5] = new TH1F("hzero","hzero",5,0.5,5.5); h_bdxloc_[5]->SetStats(0); h_bdxloc_[5]->SetLineColor(4); for (int i=-2; i<=2; i++) { sprintf(histostr,"h_bdxloc_[%d]",i+2); cout<<histostr<<endl; h_bdxloc_[i+2] = new TH1F(histostr,histostr,5,0.5,5.5); sprintf(cutstr, "structa==%d",i); sprintf(hsetupstr,"wheel %d: #Delta x;alignment #;#Delta x", i); tc->cd(); for (int f=1; f<=5; f++) { alignTrees[f].DTChambers->Draw("xhatx*dx+xhaty*dy+xhatz*dz",cutstr ); // "sqrt(x*x+y*y)*atan2(sin(atan2(y,x)-atan2(a.y,a.x)),cos(atan2(y,x)-atan2(a.y,a.x)))"); // "atan2(sin(atan2(y,x)-atan2(a.y,a.x)),cos(atan2(y,x)-atan2(a.y,a.x)))",cutstr); h_bdxloc_[i+2]->SetBinContent(f,htemp->GetMean()); h_bdxloc_[i+2]->SetBinError(f,htemp->GetRMS()); } h_bdxloc_[i+2]->SetEntries(5); setupHisto(h_bdxloc_[i+2],hsetupstr, 8); c1->cd(i+3); h_bdxloc_[i+2]->Draw(); h_bdxloc_[5]->Draw("same"); } c1->cd(); //return; TCanvas *c2 = new TCanvas("c_endcap_dxloc","c_endcap_dxloc",1200,700); c2->Divide(4,2,0.001,0.001); TH1F *h_edxloc_[10]; h_edxloc_[9] = new TH1F("hezero","hezero",5,0.5,5.5); h_edxloc_[9]->SetStats(0); h_edxloc_[9]->SetLineColor(4); int npad=1; for (int i=-4; i<=4; i++) { if (i==0) continue; sprintf(histostr,"h_edxloc_[%d]",i+4); cout<<histostr<<endl; h_edxloc_[i+4] = new TH1F(histostr,histostr,5,0.5,5.5); //sprintf(cutstr, "structa==%d&&structb==1",i); sprintf(cutstr, "structa==%d",i); sprintf(hsetupstr,"disk %d: #Delta x;alignment #;#Delta x", i); tc->cd(); for (int f=1; f<=5; f++) { alignTrees[f].CSCChambers->Draw("xhatx*dx+xhaty*dy+xhatz*dz",cutstr ); // "sqrt(x*x+y*y)*atan2(sin(atan2(y,x)-atan2(a.y,a.x)),cos(atan2(y,x)-atan2(a.y,a.x)))",cutstr); // "atan2(sin(atan2(y,x)-atan2(a.y,a.x)),cos(atan2(y,x)-atan2(a.y,a.x)))",cutstr); h_edxloc_[i+4]->SetBinContent(f,htemp->GetMean()); h_edxloc_[i+4]->SetBinError(f,htemp->GetRMS()); } h_edxloc_[i+4]->SetEntries(5); setupHisto(h_edxloc_[i+4],hsetupstr, 8); c2->cd(npad++); h_edxloc_[i+4]->Draw(); h_edxloc_[9]->Draw("same"); } c2->cd(); //c2->Print("r1.ps"); //TCanvas *tc = new TCanvas("test","test",900,900); //tc->Divide(2,2); //tc->cd(1); /// ------ END PLOTTING ------------- return; if (gROOT->IsBatch()) return; new TBrowser(); TTreeViewer *treeview = new TTreeViewer(); // char tnames[8][50] = {"DTWheels","DTStations","DTChambers","DTSuperLayers","DTLayers" ,"CSCStations" ,"CSCChambers" ,"CSCLayers"}; char tnames[8][50] = {"DTWheels","DTStations","DTChambers","CSCStations" ,"CSCChambers" }; for (int i=0;i<8;i++) { char nm[200]; sprintf(nm,"%s_%s",alment0.Data(),tnames[i]); treeview->SetTreeName(nm); } for (int i=0;i<8;i++) { char nm[200]; sprintf(nm,"%s_%s",alment.Data(),tnames[i]); treeview->SetTreeName(nm); } }
void compare2AlignmentsSame( char *filename, TString alment0="fromAlignment", TString alment1="ideal") { setupStyle(); AlighnmentTTrees alignTrees[2]; importTreesFromFile(filename, alment0, &alignTrees[0], alment0+"_"); importTreesFromFile(filename, alment1, &alignTrees[1], alment1+"_"); alignTrees[0].DTWheels->AddFriend(alignTrees[1].DTWheels,"a"); alignTrees[0].DTChambers->AddFriend(alignTrees[1].DTChambers,"a"); alignTrees[0].DTStations->AddFriend(alignTrees[1].DTStations,"a"); // alignTrees[0].DTSuperLayers->AddFriend(alignTrees[1].DTSuperLayers,"a"); // alignTrees[0].DTLayers->AddFriend(alignTrees[1].DTLayers,"a"); alignTrees[0].CSCStations->AddFriend(alignTrees[1].CSCStations,"a"); alignTrees[0].CSCChambers->AddFriend(alignTrees[1].CSCChambers,"a"); // alignTrees[0].CSCLayers->AddFriend(alignTrees[1].CSCLayers,"a"); /// ------ PLOTTING ------------- char histostr[100], histostr1[100], drawstr[300], cutstr[200], hsetupstr[200]; //double nbin = 20, low = -0.15, high = 0.15; double nbin = 20, low = -0.05, high = 0.05; TCanvas *c1 = (TCanvas*)gROOT->FindObject("c_barrel_dz"); if (c1==NULL) return; TH1F *h_1; TH1F *h_bz_[5]; for (int i=-2; i<=2; i++) { c1->cd(i+3); sprintf(histostr,"h_bz_s[%d]",i+2); sprintf(histostr1,"h_bz_[%d]",i+2); //sprintf(drawstr,"z-a.z>>%s(%d,%f,%f)",histostr,nbin,low,high); sprintf(drawstr,"xhatx*dx+xhaty*dy+xhatz*dz>>%s(%d,%f,%f)",histostr,nbin,low,high); sprintf(cutstr, "structa==%d",i); //sprintf(hsetupstr,"wheel %d: #Delta z;#Delta z;# chambers", i); sprintf(hsetupstr,"wheel %d: #Delta x;#Delta x;# chambers", i); cout<<drawstr<<endl; alignTrees[0].DTChambers->Draw(drawstr,cutstr,"same"); h_bz_[i+2] = (TH1F*) gROOT->FindObject(histostr); setupHisto(h_bz_[i+2],hsetupstr, -1, 4); h_1 = (TH1F*) gROOT->FindObjectAny(histostr1); adjustRange(h_bz_[i+2],h_1); } c1->cd(); //nbin = 20; low = -1.5; high = 1.5; nbin = 20; low = -.02; high = .02; TCanvas *c2 = (TCanvas*)gROOT->FindObject("c_endcap_dz"); if (c2==NULL) return; TH1F *h_edz_[9]; int npad=1; for (int i=-4; i<=4; i++) { if (i==0) continue; c2->cd(npad++); sprintf(histostr,"h_edz_s[%d]",i+4); sprintf(histostr1,"h_edz_[%d]",i+4); //sprintf(drawstr,"z-a.z>>%s(%d,%f,%f)",histostr,nbin,low,high); sprintf(drawstr,"xhatx*dx+xhaty*dy+xhatz*dz>>%s(%d,%f,%f)",histostr,nbin,low,high); //sprintf(cutstr, "structa==%d",i); sprintf(cutstr, "structa==%d&&(!(abs(structa)==1&&(structb==1||structb==4)))",i); //sprintf(hsetupstr,"disk %d: #Delta z;#Delta z;# chambers", i); sprintf(hsetupstr,"disk %d: #Delta x;#Delta x;# chambers", i); cout<<drawstr<<endl; alignTrees[0].CSCChambers->Draw(drawstr,cutstr,"same"); h_edz_[i+4] = (TH1F*) gROOT->FindObject(histostr); setupHisto(h_edz_[i+4],hsetupstr, -1, 4); h_1 = (TH1F*) gROOT->FindObjectAny(histostr1); adjustRange(h_edz_[i+4],h_1); } c2->cd(); //TCanvas *tc = new TCanvas("test","test",900,900); //tc->Divide(2,2); //tc->cd(1); /// ------ END PLOTTING ------------- return; if (gROOT->IsBatch()) return; new TBrowser(); TTreeViewer *treeview = new TTreeViewer(); // char tnames[8][50] = {"DTWheels","DTStations","DTChambers","DTSuperLayers","DTLayers" ,"CSCStations" ,"CSCChambers" ,"CSCLayers"}; char tnames[8][50] = {"DTWheels","DTStations","DTChambers","CSCStations" ,"CSCChambers" }; for (int i=0;i<8;i++) { char nm[200]; sprintf(nm,"%s_%s",alment0.Data(),tnames[i]); treeview->SetTreeName(nm); } for (int i=0;i<8;i++) { char nm[200]; sprintf(nm,"%s_%s",alment1.Data(),tnames[i]); treeview->SetTreeName(nm); } }
void compare2Alignments( char *filename, TString alment0="mockAlignment", TString alment1="ideal") { setupStyle(); AlighnmentTTrees alignTrees[2]; importTreesFromFile(filename, alment0, &alignTrees[0], alment0+"_"); importTreesFromFile(filename, alment1, &alignTrees[1], alment1+"_"); /* gSystem->CompileMacro("loadLookupTable.C","k"); //gSystem->Load("loadLookupTable_C.so"); loadLookupTable(); // populateDetData(atrees[0].DTWheels); for (int i=0; i<2; i++) { populateDetData(atrees[i].DTWheels); populateDetData(atrees[i].DTChambers); populateDetData(atrees[i].DTStations); populateDetData(atrees[i].DTSuperLayers); populateDetData(atrees[i].DTLayers); populateDetData(atrees[i].CSCStations); populateDetData(atrees[i].CSCChambers); populateDetData(atrees[i].CSCLayers); } AlighnmentTTreesAnalysis alignTreesAna[2]; for (int i=0; i<2; i++) { alignTreesAna[i].DTWheels.Init(alignTrees[i].DTWheels); alignTreesAna[i].DTChambers.Init(alignTrees[i].DTChambers); alignTreesAna[i].DTStations.Init(alignTrees[i].DTStations); alignTreesAna[i].DTSuperLayers.Init(alignTrees[i].DTSuperLayers); alignTreesAna[i].DTLayers.Init(alignTrees[i].DTLayers); alignTreesAna[i].CSCStations.Init(alignTrees[i].CSCStations); alignTreesAna[i].CSCChambers.Init(alignTrees[i].CSCChambers); alignTreesAna[i].CSCLayers.Init(alignTrees[i].CSCLayers); } */ alignTrees[0].DTWheels->AddFriend(alignTrees[1].DTWheels,"a"); alignTrees[0].DTChambers->AddFriend(alignTrees[1].DTChambers,"a"); alignTrees[0].DTStations->AddFriend(alignTrees[1].DTStations,"a"); // alignTrees[0].DTSuperLayers->AddFriend(alignTrees[1].DTSuperLayers,"a"); // alignTrees[0].DTLayers->AddFriend(alignTrees[1].DTLayers,"a"); alignTrees[0].CSCStations->AddFriend(alignTrees[1].CSCStations,"a"); alignTrees[0].CSCChambers->AddFriend(alignTrees[1].CSCChambers,"a"); // alignTrees[0].CSCLayers->AddFriend(alignTrees[1].CSCLayers,"a"); /// ------ PLOTTING ------------- char histostr[100], drawstr[300], cutstr[200], hsetupstr[200]; //double nbin = 20, low = -0.15, high = 0.15; double nbin = 20, low = -0.05, high = 0.05; TCanvas *c1 = new TCanvas("c_barrel_dz","c_barrel_dz",1500,350); c1->Divide(5,1,0.001,0.001); TH1F *h_bz_[5]; for (int i=-2; i<=2; i++) { c1->cd(i+3); sprintf(histostr,"h_bz_[%d]",i+2); //sprintf(drawstr,"z-a.z>>%s(%d,%f,%f)",histostr,nbin,low,high); sprintf(drawstr,"xhatx*dx+xhaty*dy+xhatz*dz>>%s(%d,%f,%f)",histostr,nbin,low,high); sprintf(cutstr, "structa==%d",i); //sprintf(hsetupstr,"wheel %d: #Delta z;#Delta z;# chambers", i); sprintf(hsetupstr,"wheel %d: #Delta x;#Delta x;# chambers", i); cout<<drawstr<<endl; alignTrees[0].DTChambers->Draw(drawstr,cutstr); h_bz_[i+2] = (TH1F*) gROOT->FindObject(histostr); setupHisto(h_bz_[i+2],hsetupstr, 3); h_bz_[i+2]->GetXaxis()->SetNdivisions(207); } c1->cd(); //nbin = 20; low = -1.5; high = 1.5; nbin = 20; low = -.02; high = .02; TCanvas *c2 = new TCanvas("c_endcap_dz","c_endcap_dz",1200,700); c2->Divide(4,2,0.001,0.001); TH1F *h_edz_[9]; int npad=1; for (int i=-4; i<=4; i++) { if (i==0) continue; c2->cd(npad++); sprintf(histostr,"h_edz_[%d]",i+4); //sprintf(drawstr,"z-a.z>>%s(%d,%f,%f)",histostr,nbin,low,high); sprintf(drawstr,"xhatx*dx+xhaty*dy+xhatz*dz>>%s(%d,%f,%f)",histostr,nbin,low,high); //sprintf(cutstr, "structa==%d",i); sprintf(cutstr, "structa==%d&&(!(structa==1&&(structb==1||structb==4)))",i); //sprintf(hsetupstr,"disk %d: #Delta z;#Delta z;# chambers", i); sprintf(hsetupstr,"disk %d: #Delta x;#Delta x;# chambers", i); cout<<drawstr<<endl; alignTrees[0].CSCChambers->Draw(drawstr,cutstr); h_edz_[i+4] = (TH1F*) gROOT->FindObject(histostr); setupHisto(h_edz_[i+4],hsetupstr, 3); h_edz_[i+4]->GetXaxis()->SetNdivisions(207); } c2->cd(); //TCanvas *tc = new TCanvas("test","test",900,900); //tc->Divide(2,2); //tc->cd(1); /// ------ END PLOTTING ------------- return; if (gROOT->IsBatch()) return; new TBrowser(); TTreeViewer *treeview = new TTreeViewer(); // char tnames[8][50] = {"DTWheels","DTStations","DTChambers","DTSuperLayers","DTLayers" ,"CSCStations" ,"CSCChambers" ,"CSCLayers"}; char tnames[8][50] = {"DTWheels","DTStations","DTChambers","CSCStations" ,"CSCChambers" }; for (int i=0;i<8;i++) { char nm[200]; sprintf(nm,"%s_%s",alment0.Data(),tnames[i]); treeview->SetTreeName(nm); } for (int i=0;i<8;i++) { char nm[200]; sprintf(nm,"%s_%s",alment1.Data(),tnames[i]); treeview->SetTreeName(nm); } }
void create(float _fontSize, bx::AllocatorI* _allocator) { m_viewId = 255; m_allocator = _allocator; m_lastScroll = 0; m_last = bx::getHPCounter(); ImGuiIO& io = ImGui::GetIO(); io.RenderDrawListsFn = renderDrawLists; if (NULL != m_allocator) { io.MemAllocFn = memAlloc; io.MemFreeFn = memFree; } io.DisplaySize = ImVec2(1280.0f, 720.0f); io.DeltaTime = 1.0f / 60.0f; io.IniFilename = NULL; setupStyle(true); #if defined(SCI_NAMESPACE) io.KeyMap[ImGuiKey_Tab] = (int)entry::Key::Tab; io.KeyMap[ImGuiKey_LeftArrow] = (int)entry::Key::Left; io.KeyMap[ImGuiKey_RightArrow] = (int)entry::Key::Right; io.KeyMap[ImGuiKey_UpArrow] = (int)entry::Key::Up; io.KeyMap[ImGuiKey_DownArrow] = (int)entry::Key::Down; io.KeyMap[ImGuiKey_Home] = (int)entry::Key::Home; io.KeyMap[ImGuiKey_End] = (int)entry::Key::End; io.KeyMap[ImGuiKey_Delete] = (int)entry::Key::Delete; io.KeyMap[ImGuiKey_Backspace] = (int)entry::Key::Backspace; io.KeyMap[ImGuiKey_Enter] = (int)entry::Key::Return; io.KeyMap[ImGuiKey_Escape] = (int)entry::Key::Esc; io.KeyMap[ImGuiKey_A] = (int)entry::Key::KeyA; io.KeyMap[ImGuiKey_C] = (int)entry::Key::KeyC; io.KeyMap[ImGuiKey_V] = (int)entry::Key::KeyV; io.KeyMap[ImGuiKey_X] = (int)entry::Key::KeyX; io.KeyMap[ImGuiKey_Y] = (int)entry::Key::KeyY; io.KeyMap[ImGuiKey_Z] = (int)entry::Key::KeyZ; #endif // defined(SCI_NAMESPACE) const bgfx::Memory* vsmem; const bgfx::Memory* fsmem; switch (bgfx::getRendererType() ) { case bgfx::RendererType::Direct3D9: vsmem = bgfx::makeRef(vs_ocornut_imgui_dx9, sizeof(vs_ocornut_imgui_dx9) ); fsmem = bgfx::makeRef(fs_ocornut_imgui_dx9, sizeof(fs_ocornut_imgui_dx9) ); break; case bgfx::RendererType::Direct3D11: case bgfx::RendererType::Direct3D12: vsmem = bgfx::makeRef(vs_ocornut_imgui_dx11, sizeof(vs_ocornut_imgui_dx11) ); fsmem = bgfx::makeRef(fs_ocornut_imgui_dx11, sizeof(fs_ocornut_imgui_dx11) ); break; case bgfx::RendererType::Metal: vsmem = bgfx::makeRef(vs_ocornut_imgui_mtl, sizeof(vs_ocornut_imgui_mtl) ); fsmem = bgfx::makeRef(fs_ocornut_imgui_mtl, sizeof(fs_ocornut_imgui_mtl) ); break; default: vsmem = bgfx::makeRef(vs_ocornut_imgui_glsl, sizeof(vs_ocornut_imgui_glsl) ); fsmem = bgfx::makeRef(fs_ocornut_imgui_glsl, sizeof(fs_ocornut_imgui_glsl) ); break; } bgfx::ShaderHandle vsh = bgfx::createShader(vsmem); bgfx::ShaderHandle fsh = bgfx::createShader(fsmem); m_program = bgfx::createProgram(vsh, fsh, true); m_decl .begin() .add(bgfx::Attrib::Position, 2, bgfx::AttribType::Float) .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float) .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) .end(); s_tex = bgfx::createUniform("s_tex", bgfx::UniformType::Int1); uint8_t* data; int32_t width; int32_t height; { ImFontConfig config; config.FontDataOwnedByAtlas = false; config.MergeMode = false; // config.MergeGlyphCenterV = true; m_font[ImGui::Font::Regular] = io.Fonts->AddFontFromMemoryTTF( (void*)s_robotoRegularTtf, sizeof(s_robotoRegularTtf), _fontSize, &config); m_font[ImGui::Font::Mono ] = io.Fonts->AddFontFromMemoryTTF( (void*)s_robotoMonoRegularTtf, sizeof(s_robotoMonoRegularTtf), _fontSize-3.0f, &config); config.MergeMode = true; config.DstFont = m_font[ImGui::Font::Regular]; for (uint32_t ii = 0; ii < BX_COUNTOF(s_fontRangeMerge); ++ii) { const FontRangeMerge& frm = s_fontRangeMerge[ii]; io.Fonts->AddFontFromMemoryTTF( (void*)frm.data , (int)frm.size , _fontSize-3.0f , &config , frm.ranges ); } } io.Fonts->GetTexDataAsRGBA32(&data, &width, &height); m_texture = bgfx::createTexture2D( (uint16_t)width , (uint16_t)height , false , 1 , bgfx::TextureFormat::BGRA8 , 0 , bgfx::copy(data, width*height*4) ); ImGui::InitDockContext(); }