Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add damage control screen. Which can be run on a seperate screen to s…
…plit up the engineering task. Does require a power management screen as well.
- Loading branch information
Showing
7 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "damcon.h" | ||
|
||
#include "playerInfo.h" | ||
#include "screenComponents/shipInternalView.h" | ||
|
||
DamageControlScreen::DamageControlScreen(GuiContainer* owner) | ||
: GuiOverlay(owner, "DAMCON_SCREEN", sf::Color::Black) | ||
{ | ||
(new GuiShipInternalView(this, "SHIP_INTERNAL_VIEW", 48.0f * 1.5f))->setShip(my_spaceship)->setPosition(300, 0, ATopLeft)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); | ||
|
||
GuiAutoLayout* system_health_layout = new GuiAutoLayout(this, "DAMCON_LAYOUT", GuiAutoLayout::LayoutVerticalTopToBottom); | ||
system_health_layout->setPosition(0, 0, ACenterLeft)->setSize(300, 600); | ||
for(unsigned int n=0; n<SYS_COUNT; n++) | ||
{ | ||
system_health[n] = new GuiKeyValueDisplay(system_health_layout, "DAMCON_HEALTH_" + string(n), 0.8, getSystemName(ESystem(n)), "0%"); | ||
system_health[n]->setSize(GuiElement::GuiSizeMax, 40); | ||
} | ||
} | ||
|
||
void DamageControlScreen::onDraw(sf::RenderTarget& window) | ||
{ | ||
GuiOverlay::onDraw(window); | ||
|
||
if (my_spaceship) | ||
{ | ||
for(unsigned int n=0; n<SYS_COUNT; n++) | ||
{ | ||
system_health[n]->setVisible(my_spaceship->hasSystem(ESystem(n))); | ||
system_health[n]->setValue(string(int(my_spaceship->systems[n].health * 100)) + "%"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef DAMCON_SCREEN_H | ||
#define DAMCON_SCREEN_H | ||
|
||
#include "gui/gui2.h" | ||
#include "shipTemplate.h" | ||
|
||
class DamageControlScreen : public GuiOverlay | ||
{ | ||
private: | ||
GuiKeyValueDisplay* system_health[SYS_COUNT]; | ||
public: | ||
DamageControlScreen(GuiContainer* owner); | ||
|
||
void onDraw(sf::RenderTarget& window) override; | ||
}; | ||
|
||
#endif//DAMCON_SCREEN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters