PowerManagementScreen::PowerManagementScreen(GuiContainer* owner) : GuiOverlay(owner, "POWER_MANAGEMENT_SCREEN", colorConfig.background) { GuiAutoLayout* layout = new GuiAutoLayout(this, "", GuiAutoLayout::LayoutHorizontalLeftToRight); layout->setPosition(20, 50, ATopLeft)->setSize(GuiElement::GuiSizeMax, 400); for(int n=0; n<SYS_COUNT; n++) { if (n == 4) { //Start the 2nd row after 4 elements. layout = new GuiAutoLayout(this, "", GuiAutoLayout::LayoutHorizontalLeftToRight); layout->setPosition(20, 450, ATopLeft)->setSize(GuiElement::GuiSizeMax, 400); } GuiBox* box = new GuiBox(layout, ""); systems[n].box = box; box->setSize(290, 400); (new GuiLabel(box, "", getSystemName(ESystem(n)), 30))->addBackground()->setAlignment(ACenter)->setPosition(0, 0, ATopLeft)->setSize(290, 50); (new GuiLabel(box, "", "Power", 30))->setVertical()->setAlignment(ACenterLeft)->setPosition(20, 50, ATopLeft)->setSize(30, 340); (new GuiLabel(box, "", "Coolant", 30))->setVertical()->setAlignment(ACenterLeft)->setPosition(100, 50, ATopLeft)->setSize(30, 340); (new GuiLabel(box, "", "Heat", 30))->setVertical()->setAlignment(ACenterLeft)->setPosition(180, 50, ATopLeft)->setSize(30, 340); systems[n].power_slider = new GuiSlider(box, "", 3.0, 0.0, 1.0, [n](float value) { if (my_spaceship) my_spaceship->commandSetSystemPower(ESystem(n), value); }); systems[n].power_slider->addSnapValue(1.0, 0.1)->setPosition(50, 50, ATopLeft)->setSize(55, 340); systems[n].coolant_slider = new GuiSlider(box, "", 10.0, 0.0, 0.0, [n](float value) { if (my_spaceship) my_spaceship->commandSetSystemCoolant(ESystem(n), value); }); systems[n].coolant_slider->setPosition(130, 50, ATopLeft)->setSize(55, 340); systems[n].heat_bar = new GuiProgressbar(box, "", 0.0, 1.0, 0.0); systems[n].heat_bar->setPosition(210, 50, ATopLeft)->setSize(50, 340); } }
ScienceScreen::ScienceScreen(GuiContainer* owner) : GuiOverlay(owner, "SCIENCE_SCREEN", colorConfig.background) { targets.setAllowWaypointSelection(); (new GuiOverlay(this, "", sf::Color::White))->setTextureCenter("gui/BackgroundGradient"); (new GuiOverlay(this, "", sf::Color::White))->setTextureTiled("gui/BackgroundCrosses"); radar_view = new GuiElement(this, "RADAR_VIEW"); radar_view->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); radar = new GuiRadarView(radar_view, "SCIENCE_RADAR", gameGlobalInfo->long_range_radar_range, &targets); radar->setPosition(20, 0, ACenterLeft)->setSize(GuiElement::GuiSizeMatchHeight, GuiElement::GuiSizeMax); radar->setRangeIndicatorStepSize(5000.0)->longRange()->enableWaypoints()->enableCallsigns()->enableHeadingIndicators()->setStyle(GuiRadarView::Circular)->setFogOfWarStyle(GuiRadarView::NebulaFogOfWar); radar->setCallbacks( [this](sf::Vector2f position) { if (!my_spaceship || my_spaceship->scanning_delay > 0.0) return; targets.setToClosestTo(position, 1000, TargetsContainer::Selectable); }, nullptr, nullptr ); raw_scanner_data_overlay = new RawScannerDataRadarOverlay(radar, "", gameGlobalInfo->long_range_radar_range); raw_scanner_data_overlay->setSize(GuiElement::GuiSizeMatchHeight, GuiElement::GuiSizeMax); GuiAutoLayout* sidebar = new GuiAutoLayout(radar_view, "SIDE_BAR", GuiAutoLayout::LayoutVerticalTopToBottom); sidebar->setPosition(-20, 50, ATopRight)->setSize(250, GuiElement::GuiSizeMax); (new GuiScanTargetButton(sidebar, "SCAN_BUTTON", &targets))->setSize(GuiElement::GuiSizeMax, 50); info_callsign = new GuiKeyValueDisplay(sidebar, "SCIENCE_CALLSIGN", 0.4, "Callsign", ""); info_callsign->setSize(GuiElement::GuiSizeMax, 30); info_distance = new GuiKeyValueDisplay(sidebar, "SCIENCE_DISTANCE", 0.4, "Distance", ""); info_distance->setSize(GuiElement::GuiSizeMax, 30); info_heading = new GuiKeyValueDisplay(sidebar, "SCIENCE_DISTANCE", 0.4, "Heading", ""); info_heading->setSize(GuiElement::GuiSizeMax, 30); info_relspeed = new GuiKeyValueDisplay(sidebar, "SCIENCE_REL_SPEED", 0.4, "Rel.Speed", ""); info_relspeed->setSize(GuiElement::GuiSizeMax, 30); info_faction = new GuiKeyValueDisplay(sidebar, "SCIENCE_FACTION", 0.4, "Faction", ""); info_faction->setSize(GuiElement::GuiSizeMax, 30); info_type = new GuiKeyValueDisplay(sidebar, "SCIENCE_TYPE", 0.4, "Type", ""); info_type->setSize(GuiElement::GuiSizeMax, 30); info_shields = new GuiKeyValueDisplay(sidebar, "SCIENCE_SHIELDS", 0.4, "Shields", ""); info_shields->setSize(GuiElement::GuiSizeMax, 30); info_shield_frequency = new GuiFrequencyCurve(sidebar, "SCIENCE_SHIELD_FREQUENCY", false, true); info_shield_frequency->setSize(GuiElement::GuiSizeMax, 100); info_beam_frequency = new GuiFrequencyCurve(sidebar, "SCIENCE_SHIELD_FREQUENCY", true, false); info_beam_frequency->setSize(GuiElement::GuiSizeMax, 100); probe_view_button = new GuiButton(radar_view, "LINK_TO_SCIENCE", "Probe View", [this](){ P<ScanProbe> probe; if (game_server) probe = game_server->getObjectById(my_spaceship->linked_object); else probe = game_client->getObjectById(my_spaceship->linked_object); if(probe && !my_spaceship->science_link) { sf::Vector2f probe_position = probe->getPosition(); my_spaceship->science_link = true; radar->setAutoCentering(false); radar->setViewPosition(probe_position); radar->setDistance(5000); radar->setFogOfWarStyle(GuiRadarView::NoFogOfWar); raw_scanner_data_overlay->hide(); probe_view_button->setText("Back to ship"); }else if(my_spaceship->science_link) { my_spaceship->science_link = false; radar->setAutoCentering(true); radar->setDistance(gameGlobalInfo->long_range_radar_range); raw_scanner_data_overlay->show(); probe_view_button->setText("Probe View"); radar->setFogOfWarStyle(GuiRadarView::NebulaFogOfWar); } }); probe_view_button->setPosition(-20, -70, ABottomRight)->setSize(250, 50)->disable(); (new GuiSelector(radar_view, "ZOOM_SELECT", [this](int index, string value) { float zoom_amount = 1 + 0.5 * index ; if(!my_spaceship->science_link) radar->setDistance(gameGlobalInfo->long_range_radar_range / zoom_amount); }))->setOptions({"Zoom: 1x", "Zoom: 1.5x", "Zoom: 2x", "Zoom: 2.5x", "Zoom: 3x"})->setSelectionIndex(0)->setPosition(-20, -20, ABottomRight)->setSize(250, 50); if (!gameGlobalInfo->use_beam_shield_frequencies) { info_shield_frequency->hide(); info_beam_frequency->hide(); } for(int n=0; n<SYS_COUNT; n++) { info_system[n] = new GuiKeyValueDisplay(sidebar, "SCIENCE_SYSTEM_" + string(n), 0.75, getSystemName(ESystem(n)), "-"); info_system[n]->setSize(GuiElement::GuiSizeMax, 30); info_system[n]->hide(); } info_description = new GuiScrollText(sidebar, "SCIENCE_DESC", ""); info_description->setTextSize(20)->hide()->setSize(GuiElement::GuiSizeMax, 400); database_view = new DatabaseViewComponent(this); database_view->hide()->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); (new GuiListbox(this, "VIEW_SELECTION", [this](int index, string value) { radar_view->setVisible(index == 0); database_view->setVisible(index == 1); }))->setOptions({"Radar", "Database"})->setSelectionIndex(0)->setPosition(20, -20, ABottomLeft)->setSize(200, 100); new GuiScanningDialog(this, "SCANNING_DIALOG"); }