#include "l3d.h" #include "generic_system_view.h" #include "sector_view.h" #include "sector.h" GenericSystemView::GenericSystemView(void) : View() { px = py = pidx = 0xdeadbeef; m_scannerLayout = new Gui::Fixed(140, 2, 360, 60); m_scannerLayout->SetTransparency(true); m_systemName = new Gui::Label(""); m_systemName->SetColor(1, 1, 0); m_scannerLayout->Add(m_systemName, 40, 44); m_distance = new Gui::Label(""); m_distance->SetColor(1, 0, 0); m_scannerLayout->Add(m_distance, 150, 44); m_starType = new Gui::Label(""); m_starType->SetColor(1, 0, 1); m_scannerLayout->Add(m_starType, 22, 26); m_shortDesc = new Gui::Label(""); m_shortDesc->SetColor(1, 0, 1); m_scannerLayout->Add(m_shortDesc, 5, 8); } void GenericSystemView::Draw3D(void) { StarSystem* s = L3D::GetSelectedSystem(); if(s && !s->IsSystem(px, py, pidx)) { s->GetPos(&px, &py, &pidx); Sector sec(px, py); Sector psec(L3D::playerLoc.secX, L3D::playerLoc.secY); const float dist = Sector::DistanceBetween(&sec, pidx, &psec, L3D::playerLoc.sysIdx); char buf[256]; snprintf(buf, sizeof(buf), "Dist. %.2f light years.", dist); m_systemName->SetText(s->rootBody->name); m_distance->SetText(buf); m_starType->SetText(s->rootBody->GetAstroDescription()); m_shortDesc->SetText("Short description of system"); onSelectedSystemChanged.emit(s); } } void GenericSystemView::ShowAll(void) { View::ShowAll(); if(m_scannerLayout) m_scannerLayout->ShowAll(); } void GenericSystemView::HideAll(void) { View::HideAll(); if(m_scannerLayout) m_scannerLayout->HideAll(); }