Skip to content

Commit

Permalink
screenComponents/ fix whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
capt-t authored and daid committed Aug 7, 2020
1 parent 2d9f91d commit 5869678
Show file tree
Hide file tree
Showing 54 changed files with 160 additions and 161 deletions.
5 changes: 2 additions & 3 deletions src/screenComponents/aimLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -118,4 +118,3 @@ void AimLock::onMouseDrag(sf::Vector2f position)
void AimLock::onMouseUp(sf::Vector2f position)
{
}

4 changes: 2 additions & 2 deletions src/screenComponents/aimLock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
4 changes: 2 additions & 2 deletions src/screenComponents/alertOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/screenComponents/alertOverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AlertLevelOverlay : public GuiElement
private:
public:
AlertLevelOverlay(GuiContainer* owner);

virtual void onDraw(sf::RenderTarget& window);
};

Expand Down
2 changes: 1 addition & 1 deletion src/screenComponents/beamFrequencySelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class GuiBeamFrequencySelector : public GuiSelector
{
public:
GuiBeamFrequencySelector(GuiContainer* owner, string id);

virtual void onHotkey(const HotkeyResult& key) override;
};

Expand Down
2 changes: 1 addition & 1 deletion src/screenComponents/beamTargetSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class GuiBeamTargetSelector : public GuiSelector
{
public:
GuiBeamTargetSelector(GuiContainer* owner, string id);

virtual void onHotkey(const HotkeyResult& key) override;
};

Expand Down
2 changes: 1 addition & 1 deletion src/screenComponents/combatManeuver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/screenComponents/combatManeuver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
12 changes: 6 additions & 6 deletions src/screenComponents/commsOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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({});
Expand All @@ -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());

Expand Down
6 changes: 3 additions & 3 deletions src/screenComponents/commsOverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -39,7 +39,7 @@ class GuiCommsOverlay : public GuiElement
GuiButton* script_comms_close;
public:
GuiCommsOverlay(GuiContainer* owner);

virtual void onDraw(sf::RenderTarget& window);
void clearElements();
};
Expand Down
6 changes: 3 additions & 3 deletions src/screenComponents/customShipFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -19,10 +19,10 @@ class GuiCustomShipFunctions : public GuiAutoLayout
string name;
GuiElement* element;
};

ECrewPosition position;
std::vector<Entry> entries;

void checkEntries();
void createEntries();
};
Expand Down
2 changes: 1 addition & 1 deletion src/screenComponents/databaseView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/screenComponents/dockingButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<SpaceObject> findDockingTarget();
};

Expand Down
4 changes: 2 additions & 2 deletions src/screenComponents/frequencyCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = "";
Expand Down
6 changes: 3 additions & 3 deletions src/screenComponents/frequencyCurve.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
};

Expand Down
4 changes: 2 additions & 2 deletions src/screenComponents/helpOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/screenComponents/impulseControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/screenComponents/impulseControls.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
16 changes: 8 additions & 8 deletions src/screenComponents/indicatorOverlays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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);
Expand All @@ -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; n<my_spaceship->shield_count; n++)
Expand All @@ -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);
Expand Down Expand Up @@ -101,7 +101,7 @@ void GuiIndicatorOverlays::onDraw(sf::RenderTarget& window)
warpPostProcessor->enabled = false;
glitchPostProcessor->enabled = false;
}

if (engine->getGameSpeed() == 0.0)
{
warpPostProcessor->enabled = false;
Expand All @@ -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)
{
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/screenComponents/indicatorOverlays.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/screenComponents/jumpControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Loading

0 comments on commit 5869678

Please sign in to comment.