Skip to content

Commit

Permalink
screens/ 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 866a32a commit 2d9f91d
Show file tree
Hide file tree
Showing 41 changed files with 133 additions and 133 deletions.
8 changes: 4 additions & 4 deletions src/screens/cinematicViewScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void CinematicViewScreen::update(float delta)
tot_position_3D.x = tot_position_2D.x;
tot_position_3D.y = tot_position_3D.y;
tot_position_3D.z = 0;

// Get the diff, distance, and angle between the ToT and camera.
tot_diff_2D = tot_position_2D - camera_position_2D;
tot_diff_3D = tot_position_3D - camera_position;
Expand All @@ -182,8 +182,8 @@ void CinematicViewScreen::update(float delta)
}

angle_pitch = (atan(camera_position.z / tot_distance_3D)) * (180 / pi);
}
}

if (distance_2D > max_camera_distance)
// If the selected ship moves more than 1U from the camera ...
{
Expand All @@ -204,7 +204,7 @@ void CinematicViewScreen::update(float delta)
camera_position.x -= diff_2D.x / distance_2D * (min_camera_distance - distance_3D);
camera_position.y -= diff_2D.y / distance_2D * (min_camera_distance - distance_3D);
}

if (!camera_lock_tot_toggle->getValue() || !target_of_target)
{
// Calculate the angles between the camera and the ship.
Expand Down
4 changes: 2 additions & 2 deletions src/screens/cinematicViewScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class CinematicViewScreen : public GuiCanvas, public Updatable

public:
CinematicViewScreen();

virtual void update(float delta) override;

virtual void onKey(sf::Event::KeyEvent key, int unicode) override;
};

Expand Down
2 changes: 1 addition & 1 deletion src/screens/crew1/singlePilotScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ SinglePilotScreen::SinglePilotScreen(GuiContainer* owner)
// Missile lock button near top right of left panel.
lock_aim = new AimLockButton(this, "LOCK_AIM", tube_controls, missile_aim);
lock_aim->setPosition(250, 70, ATopCenter)->setSize(130, 50);

(new GuiCustomShipFunctions(this, singlePilot, ""))->setPosition(-20, 120, ATopRight)->setSize(250, GuiElement::GuiSizeMax);
}

Expand Down
4 changes: 2 additions & 2 deletions src/screens/crew1/singlePilotScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class SinglePilotScreen : public GuiOverlay
GuiElement* warp_controls;
GuiElement* jump_controls;
GuiCombatManeuver* combat_maneuver;

TargetsContainer targets;
GuiRadarView* radar;
GuiRotationDial* missile_aim;
GuiMissileTubeControls* tube_controls;
GuiToggleButton* lock_aim;
public:
SinglePilotScreen(GuiContainer* owner);

virtual void onDraw(sf::RenderTarget& window) override;
virtual void onHotkey(const HotkeyResult& key) override;
virtual bool onJoystickAxis(const AxisAction& axisAction) override;
Expand Down
2 changes: 1 addition & 1 deletion src/screens/crew4/engineeringAdvancedScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
EngineeringAdvancedScreen::EngineeringAdvancedScreen(GuiContainer* owner)
: EngineeringScreen(owner, engineeringAdvanced)
{
if (gameGlobalInfo->use_beam_shield_frequencies)
if (gameGlobalInfo->use_beam_shield_frequencies)
{
//The shield frequency selection includes a shield enable button.
(new GuiShieldFrequencySelect(this, "SHIELD_FREQ"))->setPosition(20, 310, ATopLeft)->setSize(240, 100);
Expand Down
4 changes: 2 additions & 2 deletions src/screens/crew4/operationsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ OperationScreen::OperationScreen(GuiContainer* owner)
}
});
delete_waypoint_button->setPosition(-270, -120, ABottomRight)->setSize(200, 50);

mode = TargetSelection;

new ShipsLog(this);
(new GuiCommsOverlay(this))->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax);
}
2 changes: 1 addition & 1 deletion src/screens/crew4/tacticalScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bool TacticalScreen::onJoystickAxis(const AxisAction& axisAction){
if(my_spaceship){
if (axisAction.category == "HELMS"){
if (axisAction.action == "IMPULSE"){
my_spaceship->commandImpulse(axisAction.value);
my_spaceship->commandImpulse(axisAction.value);
return true;
} else if (axisAction.action == "ROTATE"){
my_spaceship->commandTurnSpeed(axisAction.value);
Expand Down
4 changes: 2 additions & 2 deletions src/screens/crew4/tacticalScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class TacticalScreen : public GuiOverlay
GuiKeyValueDisplay* shields_display;
GuiElement* warp_controls;
GuiElement* jump_controls;

TargetsContainer targets;
GuiRadarView* radar;
GuiRotationDial* missile_aim;
GuiMissileTubeControls* tube_controls;
GuiToggleButton* lock_aim;
public:
TacticalScreen(GuiContainer* owner);

virtual void onDraw(sf::RenderTarget& window) override;
virtual void onHotkey(const HotkeyResult& key) override;
virtual bool onJoystickAxis(const AxisAction& axisAction) override;
Expand Down
14 changes: 7 additions & 7 deletions src/screens/crew6/engineeringScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ EngineeringScreen::EngineeringScreen(GuiContainer* owner, ECrewPosition crew_pos
info.heat_arrow = new GuiArrow(info.heat_bar, id + "_HEAT_ARROW", 0);
info.heat_arrow->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax);
info.heat_icon = new GuiImage(info.heat_bar, "", "gui/icons/status_overheat");
info.heat_icon->setColor(colorConfig.overlay_overheating)->setPosition(0, 0, ACenter)->setSize(GuiElement::GuiSizeMatchHeight, GuiElement::GuiSizeMax);
info.heat_icon->setColor(colorConfig.overlay_overheating)->setPosition(0, 0, ACenter)->setSize(GuiElement::GuiSizeMatchHeight, GuiElement::GuiSizeMax);
info.power_bar = new GuiProgressSlider(info.layout, id + "_POWER", 0.0, 3.0, 0.0, [this,n](float value){
if (my_spaceship)
my_spaceship->commandSetSystemPowerRequest(ESystem(n), value);
Expand Down Expand Up @@ -296,7 +296,7 @@ void EngineeringScreen::onDraw(sf::RenderTarget& window)
{
DamageInfo di;
di.type = DT_Kinetic;
float damage_negate = 1.0f -
float damage_negate = 1.0f -
my_spaceship->getShieldDamageFactor(di, my_spaceship->shield_count - 1);
if (damage_negate < 0.0)
addSystemEffect(tr("Extra damage"), string(int(-damage_negate * 100)) + "%");
Expand All @@ -322,20 +322,20 @@ bool EngineeringScreen::onJoystickAxis(const AxisAction& axisAction){
power_slider->setValue((axisAction.value + 1) * 3.0 / 2.0);
my_spaceship->commandSetSystemPowerRequest(selected_system, power_slider->getValue());
return true;
}
}
if (axisAction.action == "COOLANT" || axisAction.action == std::string("COOLANT_") + getSystemName(selected_system)){
coolant_slider->setValue((axisAction.value + 1) * 10.0 / 2.0);
my_spaceship->commandSetSystemCoolantRequest(selected_system, coolant_slider->getValue());
return true;
}
}
} else {
for(int n=0; n<SYS_COUNT; n++)
{
ESystem system = ESystem(n);
if (axisAction.action == std::string("POWER_") + getSystemName(system)){
my_spaceship->commandSetSystemPowerRequest(system, (axisAction.value + 1) * 3.0 / 2.0);
return true;
}
}
if (axisAction.action == std::string("COOLANT_") + getSystemName(system)){
my_spaceship->commandSetSystemCoolantRequest(system, (axisAction.value + 1) * 10.0 / 2.0);
return true;
Expand All @@ -360,7 +360,7 @@ void EngineeringScreen::onHotkey(const HotkeyResult& key)
if (key.hotkey == "SELECT_JUMP_DRIVE") selectSystem(SYS_JumpDrive);
if (key.hotkey == "SELECT_FRONT_SHIELDS") selectSystem(SYS_FrontShield);
if (key.hotkey == "SELECT_REAR_SHIELDS") selectSystem(SYS_RearShield);

if (selected_system != SYS_None)
{
// Note the code duplication with extra/powerManagement
Expand Down Expand Up @@ -432,7 +432,7 @@ void EngineeringScreen::selectSystem(ESystem system)
{
if (my_spaceship && !my_spaceship->hasSystem(system))
return;

for(int idx=0; idx<SYS_COUNT; idx++)
{
system_rows[idx].button->setValue(idx == system);
Expand Down
4 changes: 2 additions & 2 deletions src/screens/crew6/engineeringScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ class EngineeringScreen : public GuiOverlay
float previous_energy_measurement;
float previous_energy_level;
float average_energy_delta;

void addSystemEffect(string key, string value);
void selectSystem(ESystem system);
public:
EngineeringScreen(GuiContainer* owner, ECrewPosition crew_position=engineering);

virtual void onDraw(sf::RenderTarget& window) override;
virtual void onHotkey(const HotkeyResult& key) override;
virtual bool onJoystickAxis(const AxisAction& axisAction) override;
Expand Down
10 changes: 5 additions & 5 deletions src/screens/crew6/helmsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ HelmsScreen::HelmsScreen(GuiContainer* owner)
(new AlertLevelOverlay(this));

GuiRadarView* radar = new GuiRadarView(this, "HELMS_RADAR", nullptr);

combat_maneuver = new GuiCombatManeuver(this, "COMBAT_MANEUVER");
combat_maneuver->setPosition(-20, -20, ABottomRight)->setSize(280, 215)->setVisible(my_spaceship && my_spaceship->getCanCombatManeuver());

Expand Down Expand Up @@ -63,7 +63,7 @@ HelmsScreen::HelmsScreen(GuiContainer* owner)
}
);
radar->setAutoRotating(PreferencesManager::get("helms_radar_lock","0")=="1");

heading_hint = new GuiLabel(this, "HEADING_HINT", "", 30);
heading_hint->setAlignment(ACenter)->setSize(0, 0);

Expand All @@ -73,13 +73,13 @@ HelmsScreen::HelmsScreen(GuiContainer* owner)
heading_display->setIcon("gui/icons/heading")->setTextSize(20)->setPosition(20, 140, ATopLeft)->setSize(240, 40);
velocity_display = new GuiKeyValueDisplay(this, "VELOCITY_DISPLAY", 0.45, tr("Speed"), "");
velocity_display->setIcon("gui/icons/speed")->setTextSize(20)->setPosition(20, 180, ATopLeft)->setSize(240, 40);

GuiAutoLayout* engine_layout = new GuiAutoLayout(this, "ENGINE_LAYOUT", GuiAutoLayout::LayoutHorizontalLeftToRight);
engine_layout->setPosition(20, -100, ABottomLeft)->setSize(GuiElement::GuiSizeMax, 300);
(new GuiImpulseControls(engine_layout, "IMPULSE"))->setSize(100, GuiElement::GuiSizeMax);
warp_controls = (new GuiWarpControls(engine_layout, "WARP"))->setSize(100, GuiElement::GuiSizeMax);
jump_controls = (new GuiJumpControls(engine_layout, "JUMP"))->setSize(100, GuiElement::GuiSizeMax);

docking_button = new GuiDockingButton(this, "DOCKING");
docking_button->setPosition(20, -20, ABottomLeft)->setSize(280, 50)->setVisible(my_spaceship && my_spaceship->getCanDock());

Expand All @@ -94,7 +94,7 @@ void HelmsScreen::onDraw(sf::RenderTarget& window)
heading_display->setValue(string(my_spaceship->getHeading(), 1));
float velocity = sf::length(my_spaceship->getVelocity()) / 1000 * 60;
velocity_display->setValue(tr("{value} {unit}/min").format({{"value", string(velocity, 1)}, {"unit", DISTANCE_UNIT_1K}}));

warp_controls->setVisible(my_spaceship->has_warp_drive);
jump_controls->setVisible(my_spaceship->has_jump_drive);
}
Expand Down
2 changes: 1 addition & 1 deletion src/screens/crew6/helmsScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class HelmsScreen : public GuiOverlay
GuiDockingButton* docking_button;
public:
HelmsScreen(GuiContainer* owner);

virtual void onDraw(sf::RenderTarget& window) override;
virtual void onHotkey(const HotkeyResult& key) override;
virtual bool onJoystickAxis(const AxisAction& axisAction) override;
Expand Down
2 changes: 1 addition & 1 deletion src/screens/crew6/relayScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ RelayScreen::RelayScreen(GuiContainer* owner, bool allow_comms)
(new GuiOpenCommsButton(option_buttons, "OPEN_COMMS_BUTTON", tr("Open Comms"), &targets))->setSize(GuiElement::GuiSizeMax, 50);
else
(new GuiOpenCommsButton(option_buttons, "OPEN_COMMS_BUTTON", tr("Link to Comms"), &targets))->setSize(GuiElement::GuiSizeMax, 50);


// Hack target
hack_target_button = new GuiButton(option_buttons, "HACK_TARGET", tr("Start hacking"), [this](){
Expand Down
2 changes: 1 addition & 1 deletion src/screens/crew6/relayScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class RelayScreen : public GuiOverlay

GuiSlider* zoom_slider;
GuiLabel* zoom_label;

GuiHackingDialog* hacking_dialog;

sf::Vector2f mouse_down_position;
Expand Down
10 changes: 5 additions & 5 deletions src/screens/crew6/scienceScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ScienceScreen::ScienceScreen(GuiContainer* owner, ECrewPosition crew_position)

sidebar_selector = new GuiSelector(radar_view, "", [this](int index, string value)
{
info_sidebar->setVisible(index == 0);
info_sidebar->setVisible(index == 0);
custom_function_sidebar->setVisible(index == 1);
});
sidebar_selector->setOptions({"Scanning", "Other"});
Expand Down Expand Up @@ -180,7 +180,7 @@ ScienceScreen::ScienceScreen(GuiContainer* owner, ECrewPosition crew_position)
probe = game_server->getObjectById(my_spaceship->linked_science_probe_id);
else
probe = game_client->getObjectById(my_spaceship->linked_science_probe_id);

if (value && probe)
{
sf::Vector2f probe_position = probe->getPosition();
Expand Down Expand Up @@ -254,7 +254,7 @@ void ScienceScreen::onDraw(sf::RenderTarget& window)
if (targets.get() && Nebula::blockedByNebula(my_spaceship->getPosition(), targets.get()->getPosition()))
targets.clear();
}

sidebar_selector->setVisible(sidebar_selector->getSelectionIndex() > 0 || custom_function_sidebar->hasEntries());

info_callsign->setValue("-");
Expand Down Expand Up @@ -369,7 +369,7 @@ void ScienceScreen::onDraw(sf::RenderTarget& window)
{
info_system[n]->show();
}

info_description->hide();
}
else if (sidebar_pager_selection == "Description")
Expand All @@ -396,7 +396,7 @@ void ScienceScreen::onDraw(sf::RenderTarget& window)
info_shield_frequency->setFrequency(ship->shield_frequency);
info_beam_frequency->setFrequency(ship->beam_frequency);
}

// Show the status of each subsystem.
for(int n = 0; n < SYS_COUNT; n++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/screens/crew6/weaponsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ bool WeaponsScreen::onJoystickAxis(const AxisAction& axisAction){
missile_aim->setValue(axisAction.value * 180);
tube_controls->setMissileTargetAngle(missile_aim->getValue());
return true;
}
}
}
return false;
}
2 changes: 1 addition & 1 deletion src/screens/crew6/weaponsScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class WeaponsScreen : public GuiOverlay
GuiToggleButton* lock_aim;
public:
WeaponsScreen(GuiContainer* owner);

virtual void onDraw(sf::RenderTarget& window) override;
virtual void onHotkey(const HotkeyResult& key) override;
virtual bool onJoystickAxis(const AxisAction& axisAction) override;
Expand Down
40 changes: 20 additions & 20 deletions src/screens/crewStationScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ CrewStationScreen::CrewStationScreen()

message_frame = new GuiPanel(main_panel, "");
message_frame->setPosition(0, 0, ATopCenter)->setSize(900, 230)->hide();

message_text = new GuiScrollText(message_frame, "", "");
message_text->setTextSize(20)->setPosition(20, 20, ATopLeft)->setSize(900 - 40, 200 - 40);
message_close_button = new GuiButton(message_frame, "", "Close", [this]() {
Expand Down Expand Up @@ -270,8 +270,8 @@ void CrewStationScreen::showTab(GuiElement* element)

for (std::pair<string, string> shortcut : listControlsByCategory(info.button->getText()))
keyboard_category += shortcut.second + ":\t" + shortcut.first + "\n";
if (keyboard_category == "") // special hotkey combination for crew1 and crew4 screens
keyboard_category = listHotkeysLimited(info.button->getText());
if (keyboard_category == "") // special hotkey combination for crew1 and crew4 screens
keyboard_category = listHotkeysLimited(info.button->getText());

keyboard_help->setText(keyboard_general + keyboard_category);
} else {
Expand All @@ -298,7 +298,7 @@ string CrewStationScreen::listHotkeysLimited(string station)
keyboard_general = "";

for (std::pair<string, string> shortcut : hotkeys.listHotkeysByCategory("General"))
if (shortcut.first == "Switch to next crew station" || shortcut.first =="Switch to previous crew station" || shortcut.first == "Switch crew station")
if (shortcut.first == "Switch to next crew station" || shortcut.first =="Switch to previous crew station" || shortcut.first == "Switch crew station")
keyboard_general += shortcut.second + ":\t" + shortcut.first + "\n";

if (station == "Tactical")
Expand All @@ -315,23 +315,23 @@ string CrewStationScreen::listHotkeysLimited(string station)
ret += shortcut.second + ":\t" + shortcut.first + "\n";
for (std::pair<string, string> shortcut : listControlsByCategory("Weapons"))
{
if (shortcut.first == "Toggle shields")
ret += shortcut.second + ":\t" + shortcut.first + "\n";
}
}

// -- not yet used --
// else if (station == "Operations")
// return ret;
// ----

else if (station == "Single Pilot")
{
for (std::pair<string, string> shortcut : listControlsByCategory("Helms"))
if (shortcut.first == "Toggle shields")
ret += shortcut.second + ":\t" + shortcut.first + "\n";
}
}

// -- not yet used --
// else if (station == "Operations")
// return ret;
// ----

else if (station == "Single Pilot")
{
for (std::pair<string, string> shortcut : listControlsByCategory("Helms"))
ret += shortcut.second + ":\t" + shortcut.first + "\n";
for (std::pair<string, string> shortcut : listControlsByCategory("Weapons"))
ret += shortcut.second + ":\t" + shortcut.first + "\n";
}
for (std::pair<string, string> shortcut : listControlsByCategory("Weapons"))
ret += shortcut.second + ":\t" + shortcut.first + "\n";
}

return ret;
}
Expand Down
Loading

0 comments on commit 2d9f91d

Please sign in to comment.