From 5869678b0c9f117f379aa1586a61286c934eb1a3 Mon Sep 17 00:00:00 2001 From: Tom <63907376+capt-t@users.noreply.github.com> Date: Sun, 2 Aug 2020 20:00:00 +0200 Subject: [PATCH] screenComponents/ fix whitespace --- src/screenComponents/aimLock.cpp | 5 ++-- src/screenComponents/aimLock.h | 4 ++-- src/screenComponents/alertOverlay.cpp | 4 ++-- src/screenComponents/alertOverlay.h | 2 +- src/screenComponents/beamFrequencySelector.h | 2 +- src/screenComponents/beamTargetSelector.h | 2 +- src/screenComponents/combatManeuver.cpp | 2 +- src/screenComponents/combatManeuver.h | 4 ++-- src/screenComponents/commsOverlay.cpp | 12 +++++----- src/screenComponents/commsOverlay.h | 6 ++--- src/screenComponents/customShipFunctions.h | 6 ++--- src/screenComponents/databaseView.cpp | 2 +- src/screenComponents/dockingButton.h | 4 ++-- src/screenComponents/frequencyCurve.cpp | 4 ++-- src/screenComponents/frequencyCurve.h | 6 ++--- src/screenComponents/helpOverlay.cpp | 4 ++-- src/screenComponents/impulseControls.cpp | 4 ++-- src/screenComponents/impulseControls.h | 2 +- src/screenComponents/indicatorOverlays.cpp | 16 ++++++------- src/screenComponents/indicatorOverlays.h | 4 ++-- src/screenComponents/jumpControls.cpp | 8 +++---- src/screenComponents/jumpControls.h | 2 +- src/screenComponents/mainScreenControls.h | 2 +- src/screenComponents/missileTubeControls.cpp | 10 ++++---- src/screenComponents/missileTubeControls.h | 6 ++--- src/screenComponents/noiseOverlay.cpp | 2 +- src/screenComponents/onScreenKeyboard.h | 2 +- src/screenComponents/openCommsButton.h | 2 +- src/screenComponents/powerDamageIndicator.cpp | 6 ++--- src/screenComponents/powerDamageIndicator.h | 6 ++--- src/screenComponents/radarView.cpp | 4 ++-- src/screenComponents/rotatingModelView.cpp | 10 ++++---- src/screenComponents/rotatingModelView.h | 2 +- src/screenComponents/scanTargetButton.cpp | 4 ++-- src/screenComponents/scanTargetButton.h | 2 +- src/screenComponents/scanningDialog.cpp | 22 ++++++++--------- src/screenComponents/scanningDialog.h | 4 ++-- src/screenComponents/scrollingBanner.cpp | 10 ++++---- src/screenComponents/selfDestructEntry.cpp | 12 +++++----- src/screenComponents/selfDestructEntry.h | 4 ++-- src/screenComponents/shieldFreqencySelect.h | 2 +- src/screenComponents/shieldsEnableButton.h | 2 +- src/screenComponents/shipDestroyedPopup.cpp | 4 ++-- src/screenComponents/shipDestroyedPopup.h | 2 +- src/screenComponents/shipInternalView.cpp | 18 +++++++------- src/screenComponents/shipInternalView.h | 22 ++++++++--------- src/screenComponents/shipsLogControl.cpp | 10 ++++---- .../signalQualityIndicator.cpp | 4 ++-- src/screenComponents/signalQualityIndicator.h | 2 +- src/screenComponents/snapSlider.h | 4 ++-- src/screenComponents/targetsContainer.cpp | 4 ++-- src/screenComponents/targetsContainer.h | 6 ++--- src/screenComponents/viewport3d.cpp | 24 +++++++++---------- src/screenComponents/warpControls.h | 2 +- 54 files changed, 160 insertions(+), 161 deletions(-) diff --git a/src/screenComponents/aimLock.cpp b/src/screenComponents/aimLock.cpp index 7e18633f99..8d0ec740f3 100644 --- a/src/screenComponents/aimLock.cpp +++ b/src/screenComponents/aimLock.cpp @@ -64,7 +64,7 @@ void AimLock::onDraw(sf::RenderTarget& window) sf::Vector2f center = getCenterPoint(); float view_rotation = radar->getViewRotation(); float radius = std::min(rect.width, rect.height) / 2.0f; - + sf::Sprite sprite; textureManager.setTexture(sprite, "dial_background.png"); sprite.setPosition(center); @@ -88,7 +88,7 @@ void AimLock::onMouseDrag(sf::Vector2f position) float view_rotation = radar->getViewRotation(); sf::Vector2f center = getCenterPoint(); - + sf::Vector2f diff = position - center; float new_value = ((sf::vector2ToAngle(diff) + 90.0f) + view_rotation) / 360.0f; @@ -118,4 +118,3 @@ void AimLock::onMouseDrag(sf::Vector2f position) void AimLock::onMouseUp(sf::Vector2f position) { } - diff --git a/src/screenComponents/aimLock.h b/src/screenComponents/aimLock.h index 6b0d05aa7b..b3db8ecdbc 100644 --- a/src/screenComponents/aimLock.h +++ b/src/screenComponents/aimLock.h @@ -11,12 +11,12 @@ class AimLockButton : public GuiToggleButton { public: AimLockButton(GuiContainer* owner, string id, GuiMissileTubeControls* tube_controls, GuiRotationDial* missile_aim); - + virtual void onHotkey(const HotkeyResult& key) override; private: GuiMissileTubeControls* tube_controls; GuiRotationDial* missile_aim; - + void setAimLock(bool value); }; diff --git a/src/screenComponents/alertOverlay.cpp b/src/screenComponents/alertOverlay.cpp index b21628e8b8..cb654b3678 100644 --- a/src/screenComponents/alertOverlay.cpp +++ b/src/screenComponents/alertOverlay.cpp @@ -11,11 +11,11 @@ void AlertLevelOverlay::onDraw(sf::RenderTarget& window) { if (!my_spaceship) return; - + sf::Color color; string text; float text_size; - + switch(my_spaceship->alert_level) { case AL_RedAlert: diff --git a/src/screenComponents/alertOverlay.h b/src/screenComponents/alertOverlay.h index a3d38a4277..603504854a 100644 --- a/src/screenComponents/alertOverlay.h +++ b/src/screenComponents/alertOverlay.h @@ -11,7 +11,7 @@ class AlertLevelOverlay : public GuiElement private: public: AlertLevelOverlay(GuiContainer* owner); - + virtual void onDraw(sf::RenderTarget& window); }; diff --git a/src/screenComponents/beamFrequencySelector.h b/src/screenComponents/beamFrequencySelector.h index c736dbe51c..6bf02ec5f4 100644 --- a/src/screenComponents/beamFrequencySelector.h +++ b/src/screenComponents/beamFrequencySelector.h @@ -7,7 +7,7 @@ class GuiBeamFrequencySelector : public GuiSelector { public: GuiBeamFrequencySelector(GuiContainer* owner, string id); - + virtual void onHotkey(const HotkeyResult& key) override; }; diff --git a/src/screenComponents/beamTargetSelector.h b/src/screenComponents/beamTargetSelector.h index 43a52e9d0c..a24403dcae 100644 --- a/src/screenComponents/beamTargetSelector.h +++ b/src/screenComponents/beamTargetSelector.h @@ -7,7 +7,7 @@ class GuiBeamTargetSelector : public GuiSelector { public: GuiBeamTargetSelector(GuiContainer* owner, string id); - + virtual void onHotkey(const HotkeyResult& key) override; }; diff --git a/src/screenComponents/combatManeuver.cpp b/src/screenComponents/combatManeuver.cpp index 06519dc11a..114b369dd9 100644 --- a/src/screenComponents/combatManeuver.cpp +++ b/src/screenComponents/combatManeuver.cpp @@ -23,7 +23,7 @@ GuiCombatManeuver::GuiCombatManeuver(GuiContainer* owner, string id) } }); slider->setPosition(0, -50, ABottomCenter)->setSize(GuiElement::GuiSizeMax, 165); - + (new GuiPowerDamageIndicator(slider, id + "_STRAFE_INDICATOR", SYS_Maneuver, ACenterLeft))->setPosition(0, 0, ABottomLeft)->setSize(GuiElement::GuiSizeMax, 50); (new GuiPowerDamageIndicator(slider, id + "_BOOST_INDICATOR", SYS_Impulse, ABottomLeft))->setPosition(0, 0, ABottomLeft)->setSize(GuiElement::GuiSizeMax, 50); } diff --git a/src/screenComponents/combatManeuver.h b/src/screenComponents/combatManeuver.h index 81ca61ca17..83b7690cf8 100644 --- a/src/screenComponents/combatManeuver.h +++ b/src/screenComponents/combatManeuver.h @@ -13,11 +13,11 @@ class GuiCombatManeuver : public GuiElement GuiProgressbar* charge_bar; public: GuiCombatManeuver(GuiContainer* owner, string id); - + virtual void onUpdate() override; virtual void onDraw(sf::RenderTarget& window) override; virtual void onHotkey(const HotkeyResult& key) override; - + void setBoostValue(float value); void setStrafeValue(float value); }; diff --git a/src/screenComponents/commsOverlay.cpp b/src/screenComponents/commsOverlay.cpp index 9347df2bf3..8445abecc6 100644 --- a/src/screenComponents/commsOverlay.cpp +++ b/src/screenComponents/commsOverlay.cpp @@ -112,7 +112,7 @@ GuiCommsOverlay::GuiCommsOverlay(GuiContainer* owner) my_spaceship->commandCloseTextComm(); }); chat_comms_close_button->setTextSize(20)->setPosition(-10, 0, ATopRight)->setSize(70, 30); - + if (!engine->getObject("mouseRenderer")) //If we are a touch screen, add a on screen keyboard. { OnScreenKeyboardControl* keyboard = new OnScreenKeyboardControl(chat_comms_box, chat_comms_message_entry); @@ -128,7 +128,7 @@ GuiCommsOverlay::GuiCommsOverlay(GuiContainer* owner) script_comms_text = new GuiScrollText(script_comms_box, "COMMS_SCRIPT_TEXT", ""); script_comms_text->setPosition(20, 30, ATopLeft)->setSize(760, 500); - + // List possible responses to a scripted communication. script_comms_options = new GuiListbox(script_comms_box, "COMMS_SCRIPT_LIST", [this](int index, string value) { script_comms_options->setOptions({}); @@ -152,18 +152,18 @@ void GuiCommsOverlay::onDraw(sf::RenderTarget& window) { opening_box->setVisible(my_spaceship->isCommsOpening()); opening_progress->setValue(my_spaceship->getCommsOpeningDelay()); - + hailed_box->setVisible(my_spaceship->isCommsBeingHailed()); hailed_label->setText("Hailed by " + my_spaceship->getCommsTargetName()); - + no_response_box->setVisible(my_spaceship->isCommsFailed()); broken_box->setVisible(my_spaceship->isCommsBroken()); closed_box->setVisible(my_spaceship->isCommsClosed()); - + chat_comms_box->setVisible(my_spaceship->isCommsChatOpen()); chat_comms_text->setText(my_spaceship->getCommsIncommingMessage()); - + script_comms_box->setVisible(my_spaceship->isCommsScriptOpen()); script_comms_text->setText(my_spaceship->getCommsIncommingMessage()); diff --git a/src/screenComponents/commsOverlay.h b/src/screenComponents/commsOverlay.h index 4a1f8f1881..3e55766fdb 100644 --- a/src/screenComponents/commsOverlay.h +++ b/src/screenComponents/commsOverlay.h @@ -17,7 +17,7 @@ class GuiCommsOverlay : public GuiElement GuiPanel* opening_box; GuiProgressbar* opening_progress; GuiButton* opening_cancel; - + GuiPanel* hailed_box; GuiLabel* hailed_label; GuiButton* hailed_answer; @@ -26,7 +26,7 @@ class GuiCommsOverlay : public GuiElement GuiPanel* no_response_box; GuiPanel* broken_box; GuiPanel* closed_box; - + GuiPanel* chat_comms_box; GuiTextEntry* chat_comms_message_entry; GuiScrollText* chat_comms_text; @@ -39,7 +39,7 @@ class GuiCommsOverlay : public GuiElement GuiButton* script_comms_close; public: GuiCommsOverlay(GuiContainer* owner); - + virtual void onDraw(sf::RenderTarget& window); void clearElements(); }; diff --git a/src/screenComponents/customShipFunctions.h b/src/screenComponents/customShipFunctions.h index 385233fb7d..aad2795abb 100644 --- a/src/screenComponents/customShipFunctions.h +++ b/src/screenComponents/customShipFunctions.h @@ -8,7 +8,7 @@ class GuiCustomShipFunctions : public GuiAutoLayout { public: GuiCustomShipFunctions(GuiContainer* owner, ECrewPosition position, string id); - + virtual void onDraw(sf::RenderTarget& window) override; bool hasEntries(); @@ -19,10 +19,10 @@ class GuiCustomShipFunctions : public GuiAutoLayout string name; GuiElement* element; }; - + ECrewPosition position; std::vector entries; - + void checkEntries(); void createEntries(); }; diff --git a/src/screenComponents/databaseView.cpp b/src/screenComponents/databaseView.cpp index 48710c7da2..523055ca37 100644 --- a/src/screenComponents/databaseView.cpp +++ b/src/screenComponents/databaseView.cpp @@ -132,7 +132,7 @@ void DatabaseViewComponent::display() { if (database_entry) database_entry->destroy(); - + database_entry = new GuiElement(this, "DATABASE_ENTRY"); database_entry->setPosition(navigation_width, 0, ATopLeft)->setMargins(20)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); diff --git a/src/screenComponents/dockingButton.h b/src/screenComponents/dockingButton.h index 4cfad63338..ad26a7bd26 100644 --- a/src/screenComponents/dockingButton.h +++ b/src/screenComponents/dockingButton.h @@ -8,13 +8,13 @@ class GuiDockingButton : public GuiButton { public: GuiDockingButton(GuiContainer* owner, string id); - + virtual void onUpdate() override; virtual void onDraw(sf::RenderTarget& window) override; virtual void onHotkey(const HotkeyResult& key) override; private: void click(); - + P findDockingTarget(); }; diff --git a/src/screenComponents/frequencyCurve.cpp b/src/screenComponents/frequencyCurve.cpp index 754cd8fbbd..726554f571 100644 --- a/src/screenComponents/frequencyCurve.cpp +++ b/src/screenComponents/frequencyCurve.cpp @@ -33,7 +33,7 @@ void GuiFrequencyCurve::onDraw(sf::RenderTarget& window) else bar.setFillColor(sf::Color(255 * f, 255 * (1.0 - f), 0)); window.draw(bar); - + if (my_spaceship && ((frequency_is_beam && n == my_spaceship->getShieldsFrequency()) || (!frequency_is_beam && n == my_spaceship->beam_frequency))) { sf::Sprite image; @@ -44,7 +44,7 @@ void GuiFrequencyCurve::onDraw(sf::RenderTarget& window) window.draw(image); } } - + int mouse_freq_nr = int((InputHandler::getMousePos().x - rect.left - 20) / w); string text = ""; diff --git a/src/screenComponents/frequencyCurve.h b/src/screenComponents/frequencyCurve.h index 487ca43ae0..ec5efedd04 100644 --- a/src/screenComponents/frequencyCurve.h +++ b/src/screenComponents/frequencyCurve.h @@ -7,13 +7,13 @@ class GuiFrequencyCurve : public GuiPanel { bool frequency_is_beam; bool more_damage_is_positive; - + int frequency; public: GuiFrequencyCurve(GuiContainer* owner, string id, bool frequency_is_beam, bool more_damage_is_positive); - + virtual void onDraw(sf::RenderTarget& window); - + GuiFrequencyCurve* setFrequency(int frequency) { this->frequency = frequency; return this; } }; diff --git a/src/screenComponents/helpOverlay.cpp b/src/screenComponents/helpOverlay.cpp index 94d56f3fdd..ee87094554 100644 --- a/src/screenComponents/helpOverlay.cpp +++ b/src/screenComponents/helpOverlay.cpp @@ -10,10 +10,10 @@ GuiHelpOverlay::GuiHelpOverlay(GuiContainer* owner, string title, string content : GuiElement(owner, "HELP_OVERLAY") { setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); - + frame = new GuiPanel(this, "HELP_FRAME"); frame->setPosition(0, 0, ACenter)->setSize(500, 700)->hide(); - + (new GuiLabel(frame, "HELP_LABEL", title, 50))->setPosition(0, 25, ATopCenter)->setSize(GuiElement::GuiSizeMax, 60); text = new GuiScrollText(frame, "HELP_TEXT", contents); diff --git a/src/screenComponents/impulseControls.cpp b/src/screenComponents/impulseControls.cpp index 8a6e89474b..4f5ab42a6e 100644 --- a/src/screenComponents/impulseControls.cpp +++ b/src/screenComponents/impulseControls.cpp @@ -14,10 +14,10 @@ GuiImpulseControls::GuiImpulseControls(GuiContainer* owner, string id) my_spaceship->commandImpulse(value); }); slider->addSnapValue(0.0, 0.1)->setPosition(0, 0, ATopLeft)->setSize(50, GuiElement::GuiSizeMax); - + label = new GuiKeyValueDisplay(this, id, 0.5, tr("slider", "Impulse"), "0%"); label->setTextSize(30)->setPosition(50, 0, ATopLeft)->setSize(40, GuiElement::GuiSizeMax); - + (new GuiPowerDamageIndicator(this, id + "_DPI", SYS_Impulse, ATopCenter))->setSize(50, GuiElement::GuiSizeMax); } diff --git a/src/screenComponents/impulseControls.h b/src/screenComponents/impulseControls.h index a564c54246..a386ea9976 100644 --- a/src/screenComponents/impulseControls.h +++ b/src/screenComponents/impulseControls.h @@ -13,7 +13,7 @@ class GuiImpulseControls : public GuiElement GuiSlider* slider; public: GuiImpulseControls(GuiContainer* owner, string id); - + virtual void onDraw(sf::RenderTarget& window) override; virtual void onHotkey(const HotkeyResult& key) override; }; diff --git a/src/screenComponents/indicatorOverlays.cpp b/src/screenComponents/indicatorOverlays.cpp index cca97f0b3b..a6811ccf90 100644 --- a/src/screenComponents/indicatorOverlays.cpp +++ b/src/screenComponents/indicatorOverlays.cpp @@ -14,7 +14,7 @@ GuiIndicatorOverlays::GuiIndicatorOverlays(GuiContainer* owner) : GuiElement(owner, "INDICATOR_OVERLAYS") { setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); - + shield_hit_overlay = new GuiOverlay(this, "SHIELD_HIT", sf::Color(64, 64, 128, 0)); hull_hit_overlay = new GuiOverlay(this, "HULL_HIT", sf::Color(255, 0, 0, 0)); shield_low_warning_overlay = new GuiOverlay(this, "SHIELD_LOW", sf::Color(255, 0, 0, 0)); @@ -27,7 +27,7 @@ GuiIndicatorOverlays::GuiIndicatorOverlays(GuiContainer* owner) engine->setGameSpeed(1.0); }))->setPosition(0, 75, ACenter)->setSize(500, 50); } - + victory_overlay = new GuiOverlay(this, "VICTORY", sf::Color(0, 0, 0, 128)); (new GuiPanel(victory_overlay, "VICTORY_BOX"))->setPosition(0, 0, ACenter)->setSize(500, 100); victory_label = new GuiLabel(victory_overlay, "VICTORY_LABEL", "...", 70); @@ -50,7 +50,7 @@ void GuiIndicatorOverlays::onDraw(sf::RenderTarget& window) if (my_spaceship) { drawAlertLevel(window); - + float shield_hit = 0.0; bool low_shields = false; for(int n=0; nshield_count; n++) @@ -61,14 +61,14 @@ void GuiIndicatorOverlays::onDraw(sf::RenderTarget& window) } shield_hit = (shield_hit - 0.5) / 0.5; shield_hit_overlay->setAlpha(32 * shield_hit); - + if (low_shields) { shield_low_warning_overlay->setAlpha(glow(16, 48, 0.5)); }else{ shield_low_warning_overlay->setAlpha(0); } - + hull_hit_overlay->setAlpha(128 * (my_spaceship->hull_damage_indicator / 1.5)); }else{ shield_hit_overlay->setAlpha(0); @@ -101,7 +101,7 @@ void GuiIndicatorOverlays::onDraw(sf::RenderTarget& window) warpPostProcessor->enabled = false; glitchPostProcessor->enabled = false; } - + if (engine->getGameSpeed() == 0.0) { warpPostProcessor->enabled = false; @@ -114,7 +114,7 @@ void GuiIndicatorOverlays::onDraw(sf::RenderTarget& window) }else{ pause_overlay->hide(); victory_overlay->show(); - + EFactionVsFactionState fvf_state = FVF_Neutral; if (my_spaceship) { @@ -149,7 +149,7 @@ bool GuiIndicatorOverlays::onMouseDown(sf::Vector2f position) void GuiIndicatorOverlays::drawAlertLevel(sf::RenderTarget& window) { sf::Color multiply_color = sf::Color::White; - + switch(my_spaceship->alert_level) { case AL_RedAlert: diff --git a/src/screenComponents/indicatorOverlays.h b/src/screenComponents/indicatorOverlays.h index e1f33d1b1f..ab8efe4be2 100644 --- a/src/screenComponents/indicatorOverlays.h +++ b/src/screenComponents/indicatorOverlays.h @@ -26,9 +26,9 @@ class GuiIndicatorOverlays : public GuiElement public: GuiIndicatorOverlays(GuiContainer* owner); virtual ~GuiIndicatorOverlays(); - + virtual void onDraw(sf::RenderTarget& window); - + virtual bool onMouseDown(sf::Vector2f position); private: void drawAlertLevel(sf::RenderTarget& window); diff --git a/src/screenComponents/jumpControls.cpp b/src/screenComponents/jumpControls.cpp index a54d460b83..82641e9055 100644 --- a/src/screenComponents/jumpControls.cpp +++ b/src/screenComponents/jumpControls.cpp @@ -14,19 +14,19 @@ GuiJumpControls::GuiJumpControls(GuiContainer* owner, string id) { slider = new GuiSlider(this, id + "_SLIDER", 5000.0, 50000.0, 10000.0, nullptr); slider->setPosition(0, -50, ABottomLeft)->setSize(50, GuiElement::GuiSizeMax); - + charge_bar = new GuiProgressbar(this, id + "_CHARGE", 0.0, 50000.0, 0.0); charge_bar->setPosition(0, -50, ABottomLeft)->setSize(50, GuiElement::GuiSizeMax); charge_bar->hide(); - + label = new GuiKeyValueDisplay(this, id + "_LABEL", 0.5, tr("jumpcontrol", "Distance"), "10.0"); label->setTextSize(30)->setPosition(50, -50, ABottomLeft)->setSize(40, GuiElement::GuiSizeMax); - + button = new GuiButton(this, id + "_BUTTON", tr("jumpcontrol", "Jump"), [this]() { my_spaceship->commandJump(slider->getValue()); }); button->setPosition(0, 0, ABottomLeft)->setSize(GuiElement::GuiSizeMax, 50); - + (new GuiPowerDamageIndicator(this, id + "_DPI", SYS_JumpDrive, ATopCenter))->setPosition(0, -50, ABottomLeft)->setSize(50, GuiElement::GuiSizeMax); } diff --git a/src/screenComponents/jumpControls.h b/src/screenComponents/jumpControls.h index 487a510335..8a73ee4b91 100644 --- a/src/screenComponents/jumpControls.h +++ b/src/screenComponents/jumpControls.h @@ -17,7 +17,7 @@ class GuiJumpControls : public GuiElement GuiProgressbar* charge_bar; public: GuiJumpControls(GuiContainer* owner, string id); - + virtual void onDraw(sf::RenderTarget& window) override; virtual void onHotkey(const HotkeyResult& key) override; }; diff --git a/src/screenComponents/mainScreenControls.h b/src/screenComponents/mainScreenControls.h index 5f22dc5bb5..bd3496edb1 100644 --- a/src/screenComponents/mainScreenControls.h +++ b/src/screenComponents/mainScreenControls.h @@ -17,7 +17,7 @@ class GuiMainScreenControls : public GuiAutoLayout GuiButton* show_comms_button = nullptr; GuiButton* hide_comms_button = nullptr; bool onscreen_comms_active = false; - + void closePopup(); public: GuiMainScreenControls(GuiContainer* owner); diff --git a/src/screenComponents/missileTubeControls.cpp b/src/screenComponents/missileTubeControls.cpp index e7eb103236..7dc93e6065 100644 --- a/src/screenComponents/missileTubeControls.cpp +++ b/src/screenComponents/missileTubeControls.cpp @@ -57,16 +57,16 @@ GuiMissileTubeControls::GuiMissileTubeControls(GuiContainer* owner, string id) row.loading_bar->setColor(sf::Color(128, 128, 128))->setSize(200, 50); row.loading_label = new GuiLabel(row.loading_bar, id + "_" + string(n) + "_PROGRESS_LABEL", "Loading", 35); row.loading_label->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); - + rows[n] = row; } - - + + for (int n = MW_Count-1; n >= 0; n--) { load_type_rows[n].layout = new GuiAutoLayout(this, id + "_ROW_" + string(n), LayoutHorizontalLeftToRight); load_type_rows[n].layout->setSize(GuiElement::GuiSizeMax, 40); - + load_type_rows[n].button = new GuiToggleButton(load_type_rows[n].layout, id + "_MW_" + string(n), getLocaleMissileWeaponName(EMissileWeapons(n)), [this, n](bool value) { if (value) load_type = EMissileWeapons(n); @@ -92,7 +92,7 @@ void GuiMissileTubeControls::onDraw(sf::RenderTarget& window){ load_type_rows[n].button->setText(getLocaleMissileWeaponName(EMissileWeapons(n)) + " [" + string(my_spaceship->weapon_storage[n]) + "/" + string(my_spaceship->weapon_storage_max[n]) + "]"); load_type_rows[n].layout->setVisible(my_spaceship->weapon_storage_max[n] > 0); } - + for (int n = 0; n < my_spaceship->weapon_tube_count; n++) { WeaponTube& tube = my_spaceship->weapon_tube[n]; diff --git a/src/screenComponents/missileTubeControls.h b/src/screenComponents/missileTubeControls.h index 70af6dc0be..503ec3faae 100644 --- a/src/screenComponents/missileTubeControls.h +++ b/src/screenComponents/missileTubeControls.h @@ -31,13 +31,13 @@ class GuiMissileTubeControls : public GuiAutoLayout float missile_target_angle; public: GuiMissileTubeControls(GuiContainer* owner, string id); - + virtual void onDraw(sf::RenderTarget& window) override; virtual void onHotkey(const HotkeyResult& key) override; - + void setMissileTargetAngle(float angle); float getMissileTargetAngle(); - + void setManualAim(bool manual); bool getManualAim(); diff --git a/src/screenComponents/noiseOverlay.cpp b/src/screenComponents/noiseOverlay.cpp index 16c0d64cbf..b9a5dd1304 100644 --- a/src/screenComponents/noiseOverlay.cpp +++ b/src/screenComponents/noiseOverlay.cpp @@ -12,7 +12,7 @@ void GuiNoiseOverlay::onDraw(sf::RenderTarget& window) { if (my_spaceship) return; - + sf::Sprite staticDisplay; textureManager.getTexture("noise.png")->setRepeated(true); textureManager.setTexture(staticDisplay, "noise.png"); diff --git a/src/screenComponents/onScreenKeyboard.h b/src/screenComponents/onScreenKeyboard.h index b2282e5039..d68f92ff17 100644 --- a/src/screenComponents/onScreenKeyboard.h +++ b/src/screenComponents/onScreenKeyboard.h @@ -11,7 +11,7 @@ class OnScreenKeyboardControl : public GuiElement OnScreenKeyboardControl(GuiContainer* owner, GuiTextEntry* target); private: GuiTextEntry* target; - + void addButtonsToRow(GuiContainer* row, const char* button_keys); }; diff --git a/src/screenComponents/openCommsButton.h b/src/screenComponents/openCommsButton.h index ed7c6a25c4..fdf797304b 100644 --- a/src/screenComponents/openCommsButton.h +++ b/src/screenComponents/openCommsButton.h @@ -10,7 +10,7 @@ class GuiOpenCommsButton : public GuiButton TargetsContainer* targets; public: GuiOpenCommsButton(GuiContainer* owner, string id, string name, TargetsContainer* targets); - + virtual void onDraw(sf::RenderTarget& window); }; diff --git a/src/screenComponents/powerDamageIndicator.cpp b/src/screenComponents/powerDamageIndicator.cpp index de99d81148..e1eaae4daf 100644 --- a/src/screenComponents/powerDamageIndicator.cpp +++ b/src/screenComponents/powerDamageIndicator.cpp @@ -12,7 +12,7 @@ void GuiPowerDamageIndicator::onDraw(sf::RenderTarget& window) { if (!my_spaceship) return; - + sf::Color color; string display_text; @@ -59,7 +59,7 @@ void GuiPowerDamageIndicator::onDraw(sf::RenderTarget& window) return; } drawStretched(window, rect, "gui/damage_power_overlay", color); - + if (rect.height > rect.width) drawVerticalText(window, rect, display_text, ACenter, text_size, bold_font, color); else @@ -141,6 +141,6 @@ void GuiPowerDamageIndicator::drawIcon(sf::RenderTarget& window, string icon_nam icon.setPosition(icon_position); icon.setColor(color); window.draw(icon); - + icon_position += icon_offset; } diff --git a/src/screenComponents/powerDamageIndicator.h b/src/screenComponents/powerDamageIndicator.h index be1931ce7e..8c3850de07 100644 --- a/src/screenComponents/powerDamageIndicator.h +++ b/src/screenComponents/powerDamageIndicator.h @@ -8,18 +8,18 @@ class GuiPowerDamageIndicator : public GuiElement { public: GuiPowerDamageIndicator(GuiContainer* owner, string name, ESystem system, EGuiAlign icon_align); - + virtual void onDraw(sf::RenderTarget& window); private: ESystem system; float text_size; EGuiAlign icon_align; - + sf::Vector2f icon_position; sf::Vector2f icon_offset; float icon_size; - + void drawIcon(sf::RenderTarget& window, string icon_name, sf::Color color); }; diff --git a/src/screenComponents/radarView.cpp b/src/screenComponents/radarView.cpp index 4e2a3e1b2f..395e4cd869 100644 --- a/src/screenComponents/radarView.cpp +++ b/src/screenComponents/radarView.cpp @@ -571,7 +571,7 @@ void GuiRadarView::drawMissileTubes(sf::RenderTarget& window) sf::Vector2f fire_draw_position = worldToScreen(fire_position); float fire_angle = my_spaceship->getRotation() + my_spaceship->weapon_tube[n].getDirection() - view_rotation; - + a[n * 2].position = fire_draw_position; a[n * 2 + 1].position = fire_draw_position + (sf::vector2FromAngle(fire_angle) * 1000.0f) * scale; a[n * 2].color = sf::Color(128, 128, 128, 128); @@ -773,7 +773,7 @@ sf::Vector2f GuiRadarView::screenToWorld(sf::Vector2f screen_position) { sf::Vector2f radar_screen_center(rect.left + rect.width / 2.0f, rect.top + rect.height / 2.0f); float scale = std::min(rect.width, rect.height) / 2.0f / distance; - + sf::Vector2f radar_position = sf::rotateVector((screen_position - radar_screen_center) / scale, view_rotation); return view_position + radar_position; } diff --git a/src/screenComponents/rotatingModelView.cpp b/src/screenComponents/rotatingModelView.cpp index 4bb7c80d98..cda1d00235 100644 --- a/src/screenComponents/rotatingModelView.cpp +++ b/src/screenComponents/rotatingModelView.cpp @@ -27,7 +27,7 @@ void GuiRotatingModelView::onDraw(sf::RenderTarget& window) if (rect.height <= 0) return; if (rect.width <= 0) return; if (!model) return; - + window.popGLStates(); float camera_fov = 60.0f; @@ -78,7 +78,7 @@ void GuiRotatingModelView::onDraw(sf::RenderTarget& window) { sf::Vector3f offset = ee.position * model->scale; float r = model->scale * ee.scale * 0.5; - + glColor3f(ee.color.x, ee.color.y, ee.color.z); glBegin(GL_LINES); glVertex3f(offset.x + r, offset.y, offset.z); @@ -94,7 +94,7 @@ void GuiRotatingModelView::onDraw(sf::RenderTarget& window) for (const sf::Vector3f& position : model->beam_position) { sf::Vector3f offset = position * model->scale; - + glBegin(GL_LINES); glVertex3f(offset.x + r, offset.y, offset.z); glVertex3f(offset.x - r, offset.y, offset.z); @@ -107,7 +107,7 @@ void GuiRotatingModelView::onDraw(sf::RenderTarget& window) for (const sf::Vector3f& position : model->tube_position) { sf::Vector3f offset = position * model->scale; - + glBegin(GL_LINES); glVertex3f(offset.x + r * 3, offset.y, offset.z); glVertex3f(offset.x - r, offset.y, offset.z); @@ -119,7 +119,7 @@ void GuiRotatingModelView::onDraw(sf::RenderTarget& window) } #endif } - + sf::Shader::bind(NULL); glDisable(GL_DEPTH_TEST); diff --git a/src/screenComponents/rotatingModelView.h b/src/screenComponents/rotatingModelView.h index a51ab4e687..db440b074a 100644 --- a/src/screenComponents/rotatingModelView.h +++ b/src/screenComponents/rotatingModelView.h @@ -10,7 +10,7 @@ class GuiRotatingModelView : public GuiElement P model; public: GuiRotatingModelView(GuiContainer* owner, string id, P model); - + virtual void onDraw(sf::RenderTarget& window); }; diff --git a/src/screenComponents/scanTargetButton.cpp b/src/screenComponents/scanTargetButton.cpp index bf12dfc784..39a6c67d17 100644 --- a/src/screenComponents/scanTargetButton.cpp +++ b/src/screenComponents/scanTargetButton.cpp @@ -16,7 +16,7 @@ GuiScanTargetButton::GuiScanTargetButton(GuiContainer* owner, string id, Targets progress = new GuiProgressbar(this, id + "_PROGRESS", 0, PlayerSpaceship::max_scanning_delay, 0.0); progress->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); } - + void GuiScanTargetButton::onUpdate() { setVisible(my_spaceship && my_spaceship->getCanScan()); @@ -38,7 +38,7 @@ void GuiScanTargetButton::onDraw(sf::RenderTarget& window) P obj; if (targets) obj = targets->get(); - + button->show(); if (obj && obj->canBeScannedBy(my_spaceship)) button->enable(); diff --git a/src/screenComponents/scanTargetButton.h b/src/screenComponents/scanTargetButton.h index 30a1eb6559..ca75c46383 100644 --- a/src/screenComponents/scanTargetButton.h +++ b/src/screenComponents/scanTargetButton.h @@ -15,7 +15,7 @@ class GuiScanTargetButton : public GuiElement GuiProgressbar* progress; public: GuiScanTargetButton(GuiContainer* owner, string id, TargetsContainer* targets); - + virtual void onUpdate() override; virtual void onDraw(sf::RenderTarget& window) override; }; diff --git a/src/screenComponents/scanningDialog.cpp b/src/screenComponents/scanningDialog.cpp index 7e9ccc7f27..52e03feb47 100644 --- a/src/screenComponents/scanningDialog.cpp +++ b/src/screenComponents/scanningDialog.cpp @@ -14,19 +14,19 @@ GuiScanningDialog::GuiScanningDialog(GuiContainer* owner, string id) scan_depth = 0; setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); - + box = new GuiPanel(this, id + "_BOX"); box->setSize(500, 545)->setPosition(0, 0, ACenter); - + signal_label = new GuiLabel(box, id + "_LABEL", "Electric signature", 30); signal_label->addBackground()->setPosition(0, 20, ATopCenter)->setSize(450, 50); - + signal_quality = new GuiSignalQualityIndicator(box, id + "_SIGNAL"); signal_quality->setPosition(0, 80, ATopCenter)->setSize(450, 100); - + locked_label = new GuiLabel(signal_quality, id + "_LOCK_LABEL", "LOCKED", 50); locked_label->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); - + for(int n=0; nscanning_delay > 0.0 && my_spaceship->scanning_complexity > 0) @@ -55,7 +55,7 @@ void GuiScanningDialog::onDraw(sf::RenderTarget& window) scan_depth = 0; setupParameters(); } - + if (locked && engine->getElapsedTime() - lock_start_time > lock_delay) { scan_depth += 1; @@ -67,7 +67,7 @@ void GuiScanningDialog::onDraw(sf::RenderTarget& window) setupParameters(); } } - + if (locked && engine->getElapsedTime() - lock_start_time > lock_delay / 2.0f) { locked_label->show(); @@ -98,7 +98,7 @@ void GuiScanningDialog::setupParameters() { if (!my_spaceship) return; - + for(int n=0; nscanning_complexity) @@ -116,7 +116,7 @@ void GuiScanningDialog::setupParameters() sliders[n]->setValue(random(0.0, 1.0)); } updateSignal(); - + string label = "[" + string(scan_depth + 1) + "/" + string(my_spaceship->scanning_depth) + "] "; switch(irandom(0, 10)) { @@ -170,7 +170,7 @@ void GuiScanningDialog::updateSignal() }else{ locked = false; } - + signal_quality->setNoiseError(noise); signal_quality->setPeriodError(period); signal_quality->setPhaseError(phase); diff --git a/src/screenComponents/scanningDialog.h b/src/screenComponents/scanningDialog.h index 3f9f8bf90f..86f237670e 100644 --- a/src/screenComponents/scanningDialog.h +++ b/src/screenComponents/scanningDialog.h @@ -22,7 +22,7 @@ class GuiScanningDialog : public GuiElement GuiSignalQualityIndicator* signal_quality; GuiSlider* sliders[max_sliders]; GuiButton* cancel_button; - + float target[max_sliders]; bool locked; float lock_start_time; @@ -32,7 +32,7 @@ class GuiScanningDialog : public GuiElement virtual void onDraw(sf::RenderTarget& window) override; virtual bool onJoystickAxis(const AxisAction& axisAction) override; - + void setupParameters(); void updateSignal(); }; diff --git a/src/screenComponents/scrollingBanner.cpp b/src/screenComponents/scrollingBanner.cpp index ce0b679f97..42a84fa022 100644 --- a/src/screenComponents/scrollingBanner.cpp +++ b/src/screenComponents/scrollingBanner.cpp @@ -10,7 +10,7 @@ GuiScrollingBanner::GuiScrollingBanner(GuiContainer* owner) void GuiScrollingBanner::onDraw(sf::RenderTarget& window) { draw_offset += update_clock.restart().asSeconds() * scroll_speed_per_second; - + if (!gameGlobalInfo || gameGlobalInfo->banner_string == "") { draw_offset = 0; @@ -21,12 +21,12 @@ void GuiScrollingBanner::onDraw(sf::RenderTarget& window) sf::Texture* texture_ptr = textureManager.getTexture("gui/ButtonBackground.png"); sf::Vector2f texture_size = sf::Vector2f(texture_ptr->getSize()); sf::VertexArray a(sf::TrianglesStrip, 4); - + a[0].position = sf::Vector2f(rect.left, rect.top); a[1].position = sf::Vector2f(rect.left, rect.top + rect.height); a[2].position = sf::Vector2f(rect.left + rect.width, rect.top); a[3].position = sf::Vector2f(rect.left + rect.width, rect.top + rect.height); - + a[0].texCoords = sf::Vector2f(texture_size.x / 2, 0); a[1].texCoords = sf::Vector2f(texture_size.x / 2, texture_size.y); a[2].texCoords = sf::Vector2f(texture_size.x / 2, 0); @@ -34,7 +34,7 @@ void GuiScrollingBanner::onDraw(sf::RenderTarget& window) for(int n=0; n<4; n++) a[n].color = sf::Color::White; - + window.draw(a, texture_ptr); } { @@ -44,7 +44,7 @@ void GuiScrollingBanner::onDraw(sf::RenderTarget& window) draw_offset -= text.getLocalBounds().width + black_area; float x = -draw_offset; float y = rect.top + rect.height / 2 - font_size + font_size * 0.35; - + while(x < window.getView().getSize().x) { text.setPosition(x, y); diff --git a/src/screenComponents/selfDestructEntry.cpp b/src/screenComponents/selfDestructEntry.cpp index 90d2e33c46..9d6d68c0c3 100644 --- a/src/screenComponents/selfDestructEntry.cpp +++ b/src/screenComponents/selfDestructEntry.cpp @@ -14,7 +14,7 @@ GuiSelfDestructEntry::GuiSelfDestructEntry(GuiContainer* owner, string id) has_position[n] = false; setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); - + box = new GuiPanel(this, id + "_BOX"); box->setPosition(0, 0, ACenter); GuiAutoLayout* layout = new GuiAutoLayout(box, id + "_LAYOUT", GuiAutoLayout::LayoutVerticalTopToBottom); @@ -22,10 +22,10 @@ GuiSelfDestructEntry::GuiSelfDestructEntry(GuiContainer* owner, string id) (new GuiLabel(layout, id + "_LABEL", tr("Self destruct activated!"), 50))->setSize(GuiElement::GuiSizeMax, 80); code_label = new GuiLabel(layout, id + "_CODE_LABEL", "", 30); code_label->addBackground()->setSize(GuiElement::GuiSizeMax, 50); - + code_entry = new GuiElement(layout, id + "_ENTRY_ELEMENT"); code_entry->setSize(250, 320); - + code_entry_code_label = new GuiLabel(code_entry, id + "_ENTRY_LABEL", "Enter [A]", 30); code_entry_code_label->addBackground()->setSize(GuiElement::GuiSizeMax, 50); code_entry_label = new GuiLabel(code_entry, id + "_ENTRY_LABEL", "", 30); @@ -76,11 +76,11 @@ void GuiSelfDestructEntry::onDraw(sf::RenderTarget& window) code_label->setSize(GuiElement::GuiSizeMax, 30 + 30 * lines); code_label->setText(codes); code_label->setVisible(lines > 0); - + code_entry_code_label->setText(tr("selfdestruct", "Enter [{letter}]").format({{"letter", string(char('A' + code_entry_position))}})); - + code_entry->setVisible(code_entry_position > -1); - + if (code_entry->isVisible()) box->setSize(600, code_entry->getPositionOffset().y + code_entry->getSize().y); else if (code_label->isVisible()) diff --git a/src/screenComponents/selfDestructEntry.h b/src/screenComponents/selfDestructEntry.h index 6796a8a8af..32ad7023cd 100644 --- a/src/screenComponents/selfDestructEntry.h +++ b/src/screenComponents/selfDestructEntry.h @@ -16,13 +16,13 @@ class GuiSelfDestructEntry : public GuiElement GuiLabel* code_entry_code_label; GuiLabel* code_entry_label; int code_entry_position; - + bool has_position[max_crew_positions]; public: GuiSelfDestructEntry(GuiContainer* owner, string id); virtual void onDraw(sf::RenderTarget& window); - + void enablePosition(ECrewPosition position) { has_position[position] = true; } }; diff --git a/src/screenComponents/shieldFreqencySelect.h b/src/screenComponents/shieldFreqencySelect.h index cb7dfa2da5..e3da4985bc 100644 --- a/src/screenComponents/shieldFreqencySelect.h +++ b/src/screenComponents/shieldFreqencySelect.h @@ -15,7 +15,7 @@ class GuiShieldFrequencySelect : public GuiElement GuiButton* calibrate_button; public: GuiShieldFrequencySelect(GuiContainer* owner, string id); - + virtual void onDraw(sf::RenderTarget& window) override; virtual void onHotkey(const HotkeyResult& key) override; }; diff --git a/src/screenComponents/shieldsEnableButton.h b/src/screenComponents/shieldsEnableButton.h index e6916311cd..53036eca7c 100644 --- a/src/screenComponents/shieldsEnableButton.h +++ b/src/screenComponents/shieldsEnableButton.h @@ -13,7 +13,7 @@ class GuiShieldsEnableButton : public GuiElement GuiProgressbar* bar; public: GuiShieldsEnableButton(GuiContainer* owner, string id); - + virtual void onDraw(sf::RenderTarget& window) override; virtual void onHotkey(const HotkeyResult& key) override; }; diff --git a/src/screenComponents/shipDestroyedPopup.cpp b/src/screenComponents/shipDestroyedPopup.cpp index 9586eda15f..92362a1157 100644 --- a/src/screenComponents/shipDestroyedPopup.cpp +++ b/src/screenComponents/shipDestroyedPopup.cpp @@ -12,7 +12,7 @@ GuiShipDestroyedPopup::GuiShipDestroyedPopup(GuiCanvas* owner) : GuiElement(owner, "SHIP_DESTROYED_POPUP"), owner(owner) { setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); - + ship_destroyed_overlay = new GuiOverlay(this, "SHIP_DESTROYED", sf::Color(0, 0, 0, 128)); (new GuiPanel(ship_destroyed_overlay, "SHIP_DESTROYED_FRAME"))->setPosition(0, 0, ACenter)->setSize(500, 100); (new GuiLabel(ship_destroyed_overlay, "SHIP_DESTROYED_TEXT", "SHIP DESTROYED!", 70))->setPosition(0, 0, ACenter)->setSize(500, 100); @@ -21,7 +21,7 @@ GuiShipDestroyedPopup::GuiShipDestroyedPopup(GuiCanvas* owner) soundManager->stopMusic(); returnToShipSelection(); }))->setPosition(0, 75, ACenter)->setSize(500, 50); - + show_timeout.restart(); } diff --git a/src/screenComponents/shipDestroyedPopup.h b/src/screenComponents/shipDestroyedPopup.h index 9b9b16b44d..05a37879a2 100644 --- a/src/screenComponents/shipDestroyedPopup.h +++ b/src/screenComponents/shipDestroyedPopup.h @@ -13,7 +13,7 @@ class GuiShipDestroyedPopup : public GuiElement GuiOverlay* ship_destroyed_overlay; GuiCanvas* owner; sf::Clock show_timeout; - + public: GuiShipDestroyedPopup(GuiCanvas* owner); diff --git a/src/screenComponents/shipInternalView.cpp b/src/screenComponents/shipInternalView.cpp index bff52209cc..29b5860632 100644 --- a/src/screenComponents/shipInternalView.cpp +++ b/src/screenComponents/shipInternalView.cpp @@ -19,16 +19,16 @@ GuiShipInternalView* GuiShipInternalView::setShip(P ship) } if (!ship) return this; - + P st = ship->ship_template; - + room_container = new GuiShipRoomContainer(this, id + "_ROOM_CONTAINER", room_size, [this](sf::Vector2i position) { if (selected_crew_member) selected_crew_member->commandSetTargetPosition(position); }); room_container->setPosition(0, 0, ACenter); sf::Vector2i max_size = st->interiorSize(); - + for(unsigned int n=0; nrooms.size(); n++) { ShipRoomTemplate& rt = st->rooms[n]; @@ -36,11 +36,11 @@ GuiShipInternalView* GuiShipInternalView::setShip(P ship) room->setPosition(sf::Vector2f(rt.position) * room_size, ATopLeft); room->setSystem(ship, rt.system); } - + for(unsigned int n=0; ndoors.size(); n++) { ShipDoorTemplate& dt = st->doors[n]; - + GuiShipDoor* door = new GuiShipDoor(room_container, id + "_DOOR_" + string(n), nullptr); door->setSize(room_size, room_size); if (dt.horizontal) @@ -52,14 +52,14 @@ GuiShipInternalView* GuiShipInternalView::setShip(P ship) } } room_container->setSize(sf::Vector2f(max_size) * room_size); - + return this; } void GuiShipInternalView::onDraw(sf::RenderTarget& window) { setShip(my_spaceship); - + if (!viewing_ship && room_container) { room_container->destroy(); @@ -270,7 +270,7 @@ void GuiShipCrew::onDraw(sf::RenderTarget& window) if (!crew) return; setPosition(crew->position * getSize().x, ATopLeft); - + sf::Sprite sprite; if (crew->action == RC_Move) textureManager.setTexture(sprite, "Tokka_WalkingMan.png", int(crew->action_delay * 12) % 6); @@ -296,7 +296,7 @@ void GuiShipCrew::onDraw(sf::RenderTarget& window) break; } window.draw(sprite); - + if (crew->selected) { sf::Sprite select_sprite; diff --git a/src/screenComponents/shipInternalView.h b/src/screenComponents/shipInternalView.h index 46adf6f99e..609f8f5d86 100644 --- a/src/screenComponents/shipInternalView.h +++ b/src/screenComponents/shipInternalView.h @@ -18,9 +18,9 @@ class GuiShipInternalView : public GuiElement std::vector crew_list; public: GuiShipInternalView(GuiContainer* owner, string id, float room_size); - + GuiShipInternalView* setShip(P ship); - + virtual void onDraw(sf::RenderTarget& window) override; virtual void onHotkey(const HotkeyResult& key) override; }; @@ -34,7 +34,7 @@ class GuiShipRoomContainer : public GuiElement func_t func; public: GuiShipRoomContainer(GuiContainer* owner, string id, float room_size, func_t func); - + virtual bool onMouseDown(sf::Vector2f position); virtual void onMouseUp(sf::Vector2f position); }; @@ -50,9 +50,9 @@ class GuiShipRoom : public GuiElement func_t func; public: GuiShipRoom(GuiContainer* owner, string id, float room_size, sf::Vector2i room_dimensions, func_t func); - + virtual void onDraw(sf::RenderTarget& window); - + GuiShipRoom* setSystem(P ship, ESystem system) { this->ship = ship; this->system = system; return this; } virtual bool onMouseDown(sf::Vector2f position); @@ -63,15 +63,15 @@ class GuiShipDoor : public GuiElement { public: typedef std::function func_t; - + private: bool horizontal; func_t func; public: GuiShipDoor(GuiContainer* owner, string id, func_t func); - + virtual void onDraw(sf::RenderTarget& window); - + GuiShipDoor* setHorizontal() { horizontal = true; return this; } virtual bool onMouseDown(sf::Vector2f position); @@ -82,15 +82,15 @@ class GuiShipCrew : public GuiElement { public: typedef std::function crew_member)> func_t; - + private: P crew; func_t func; public: GuiShipCrew(GuiContainer* owner, string id, P crew, func_t func); - + virtual void onDraw(sf::RenderTarget& window); - + virtual bool onMouseDown(sf::Vector2f position); virtual void onMouseUp(sf::Vector2f position); }; diff --git a/src/screenComponents/shipsLogControl.cpp b/src/screenComponents/shipsLogControl.cpp index 72ead9b573..ec4f709f68 100644 --- a/src/screenComponents/shipsLogControl.cpp +++ b/src/screenComponents/shipsLogControl.cpp @@ -11,9 +11,9 @@ ShipsLog::ShipsLog(GuiContainer* owner) setPosition(0, 0, ABottomCenter); setSize(GuiElement::GuiSizeMax, 50); setMargins(20, 0); - + open = false; - + log_text = new GuiAdvancedScrollText(this, ""); log_text->enableAutoScrollDown(); log_text->setMargins(15, 15, 15, 0)->setPosition(0, 0)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); @@ -27,7 +27,7 @@ void ShipsLog::onDraw(sf::RenderTarget& window) return; const std::vector& logs = my_spaceship->getShipsLog(); - + if (open) { const std::vector& logs = my_spaceship->getShipsLog(); @@ -38,7 +38,7 @@ void ShipsLog::onDraw(sf::RenderTarget& window) { log_text->removeEntry(0); } - + if (log_text->getEntryCount() > 0 && logs.size() > 0 && log_text->getEntryText(0) != logs[0].text) { bool updated = false; @@ -55,7 +55,7 @@ void ShipsLog::onDraw(sf::RenderTarget& window) if (!updated) log_text->clearEntries(); } - + while(log_text->getEntryCount() < logs.size()) { int n = log_text->getEntryCount(); diff --git a/src/screenComponents/signalQualityIndicator.cpp b/src/screenComponents/signalQualityIndicator.cpp index b8b1af8a4b..a8cd22e513 100644 --- a/src/screenComponents/signalQualityIndicator.cpp +++ b/src/screenComponents/signalQualityIndicator.cpp @@ -13,7 +13,7 @@ GuiSignalQualityIndicator::GuiSignalQualityIndicator(GuiContainer* owner, string void GuiSignalQualityIndicator::onDraw(sf::RenderTarget& window) { drawStretchedHV(window, rect, 25.0f, "gui/PanelBackground"); - + sf::VertexArray r(sf::LinesStrip, rect.width / 4 - 1); sf::VertexArray g(sf::LinesStrip, rect.width / 4 - 1); sf::VertexArray b(sf::LinesStrip, rect.width / 4 - 1); @@ -30,7 +30,7 @@ void GuiSignalQualityIndicator::onDraw(sf::RenderTarget& window) for(unsigned int n=0; ngetWaypointCount(); n++) diff --git a/src/screenComponents/targetsContainer.h b/src/screenComponents/targetsContainer.h index e5bb260bc8..be45698eab 100644 --- a/src/screenComponents/targetsContainer.h +++ b/src/screenComponents/targetsContainer.h @@ -16,9 +16,9 @@ class TargetsContainer Targetable, Selectable }; - + TargetsContainer(); - + void setAllowWaypointSelection() { allow_waypoint_selection = true; } void clear(); @@ -29,7 +29,7 @@ class TargetsContainer P get() { entries.update(); if (entries.size() > 0) return entries[0]; return nullptr; } int getWaypointIndex(); void setWaypointIndex(int index); - + void setToClosestTo(sf::Vector2f position, float max_range, ESelectionType selection_type); }; diff --git a/src/screenComponents/viewport3d.cpp b/src/screenComponents/viewport3d.cpp index 2fd476c908..6f7b5df50a 100644 --- a/src/screenComponents/viewport3d.cpp +++ b/src/screenComponents/viewport3d.cpp @@ -55,7 +55,7 @@ void GuiViewport3D::onDraw(sf::RenderTarget& window) _glPerspective(camera_fov, rect.width/rect.height, 1.f, 25000.f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - + glRotatef(90, 1, 0, 0); glScalef(1,1,-1); glRotatef(-camera_pitch, 1, 0, 0); @@ -145,12 +145,12 @@ void GuiViewport3D::onDraw(sf::RenderTarget& window) RenderInfo(SpaceObject* obj, float d) : object(obj), depth(d) {} - + SpaceObject* object; float depth; }; std::vector> render_lists; - + sf::Vector2f viewVector = sf::vector2FromAngle(camera_yaw); float depth_cutoff_back = camera_position.z * -tanf((90+camera_pitch + camera_fov/2.0) / 180.0f * M_PI); float depth_cutoff_front = camera_position.z * -tanf((90+camera_pitch - camera_fov/2.0) / 180.0f * M_PI); @@ -172,12 +172,12 @@ void GuiViewport3D::onDraw(sf::RenderTarget& window) render_lists.emplace_back(); render_lists[render_list_index].emplace_back(*obj, depth); } - + for(int n=render_lists.size() - 1; n >= 0; n--) { auto& render_list = render_lists[n]; std::sort(render_list.begin(), render_list.end(), [](const RenderInfo& a, const RenderInfo& b) { return a.depth > b.depth; }); - + glMatrixMode(GL_PROJECTION); glLoadIdentity(); _glPerspective(camera_fov, rect.width/rect.height, 1.f, 25000.f * (n + 1)); @@ -223,7 +223,7 @@ void GuiViewport3D::onDraw(sf::RenderTarget& window) glPushMatrix(); glTranslatef(-camera_position.x,-camera_position.y, -camera_position.z); ParticleEngine::render(); - + if (show_spacedust && my_spaceship) { static std::vector space_dust; @@ -234,7 +234,7 @@ void GuiViewport3D::onDraw(sf::RenderTarget& window) sf::Vector2f dust_vector = my_spaceship->getVelocity() / 100.0f; sf::Vector3f dust_center = sf::Vector3f(my_spaceship->getPosition().x, my_spaceship->getPosition().y, 0.0); glColor4f(0.7, 0.5, 0.35, 0.07); - + for(unsigned int n=0; ngetCallSign(); if (call_sign == "") continue; - + sf::Vector3f screen_position = worldToScreen(window, sf::Vector3f(obj->getPosition().x, obj->getPosition().y, obj->getRadius())); if (screen_position.z < 0) continue; @@ -322,11 +322,11 @@ void GuiViewport3D::onDraw(sf::RenderTarget& window) drawText(window, sf::FloatRect(screen_position.x, screen_position.y, 0, 0), call_sign, ACenter, 20 * distance_factor, bold_font, sf::Color(255, 255, 255, 128 * distance_factor)); } } - + if (show_headings && my_spaceship) { float distance = 2500.f; - + for(int angle = 0; angle < 360; angle += 30) { sf::Vector2f world_pos = my_spaceship->getPosition() + sf::vector2FromAngle(float(angle - 90)) * distance; @@ -341,7 +341,7 @@ void GuiViewport3D::onDraw(sf::RenderTarget& window) sf::Vector3f GuiViewport3D::worldToScreen(sf::RenderTarget& window, sf::Vector3f world) { world -= camera_position; - + //Transformation vectors float fTempo[8]; //Modelview transform @@ -372,7 +372,7 @@ sf::Vector3f GuiViewport3D::worldToScreen(sf::RenderTarget& window, sf::Vector3f //ret.z = (1.0+fTempo[6])*0.5; //Between 0 and 1 //Set Z to distance into the screen (negative is behind the screen) ret.z = -fTempo[2]; - + ret.x = ret.x * window.getView().getSize().x / window.getSize().x; ret.y = ret.y * window.getView().getSize().y / window.getSize().y; ret.y = window.getView().getSize().y - ret.y; diff --git a/src/screenComponents/warpControls.h b/src/screenComponents/warpControls.h index 76ddd7ae6d..18c5f1bf98 100644 --- a/src/screenComponents/warpControls.h +++ b/src/screenComponents/warpControls.h @@ -13,7 +13,7 @@ class GuiWarpControls : public GuiElement GuiSlider* slider; public: GuiWarpControls(GuiContainer* owner, string id); - + virtual void onDraw(sf::RenderTarget& window) override; virtual void onHotkey(const HotkeyResult& key) override; };