Lephisto/src/space_station_view.cpp

122 lines
3.3 KiB
C++

#include "space_station_view.h"
#include "l3d.h"
#include "player.h"
#include "world_view.h"
class StationSubView: public Gui::Fixed {
public:
StationSubView(SpaceStationView* parent): Gui::Fixed(Gui::Screen::GetWidth(), Gui::Screen::GetHeight()-64) {
m_parent = parent;
}
protected:
SpaceStationView* m_parent;
};
/**********************************************************/
class StationFrontView: public StationSubView {
public:
StationFrontView(SpaceStationView* parent);
private:
void OnClickRequestLaunch(void) {
L3D::player->SetDockedWith(0,0);
L3D::SetView(L3D::worldView);
}
void OnClickGotoShipYard(void) {
m_parent->GotoShipyard();
}
};
/**********************************************************/
StationFrontView::StationFrontView(SpaceStationView* parent): StationSubView(parent) {
SetTransparency(false);
Gui::Fixed* fbox = new Gui::Fixed(720, 150);
Add(fbox, 40, 100);
Gui::VScrollBar* scroll = new Gui::VScrollBar();
Gui::VScrollPortal* box = new Gui::VScrollPortal(400, 150);
scroll->SetAdjustment(&box->vscollAdjust);
Gui::Label* l = new Gui::Label("Hello friend! Thankyou for docking with this space station! "
"You may have noticed that the docking procedure was not entirely "
"physically correct. this is a result of unimplemented physics in this "
"region of the galaxy. We hope to have things back to normal within a "
"few weeks, and in the mean time would like to offer our apologies for "
"any loss of earnings, immersion or lunch. "
"Currently the usual space station services are not available, but we "
"can offer you this promotional message from one of the station's sponsors: \n"
" ADOPT A CAT: THEY CHEW IMPORTANT CABLES!");
fbox->Add(box, 0, 0);
fbox->Add(scroll, 405, 0);
box->Add(l);
box->ShowAll();
fbox->ShowAll();
Gui::SolidButton* b = new Gui::SolidButton();
b->onClick.connect(sigc::mem_fun(this, &StationFrontView::OnClickRequestLaunch));
Add(b, 40, 300);
l = new Gui::Label("Request Launch");
Add(l, 65, 300);
b = new Gui::SolidButton();
b->onClick.connect(sigc::mem_fun(this, &StationFrontView::OnClickGotoShipYard));
Add(b, 40, 360);
l = new Gui::Label("Shipyard");
Add(l, 65, 360);
}
/**********************************************************/
class StationShipyardView: public StationSubView {
public:
StationShipyardView(SpaceStationView* parent);
private:
};
StationShipyardView::StationShipyardView(SpaceStationView* parent): StationSubView(parent) {
SetTransparency(false);
}
/**********************************************************/
SpaceStationView::SpaceStationView(void): View() {
m_frontview = new StationFrontView(this);
m_shipyard = new StationShipyardView(this);
m_subview = 0;
SwitchView(m_frontview);
Gui::Label* l = new Gui::Label("Comms Link");
l->SetColor(1, .7, 0);
m_rightRegion2->Add(l, 10, 0);
}
void SpaceStationView::SwitchView(StationSubView* v) {
if(m_subview) {
m_subview->HideAll();
Remove(m_subview);
}
m_subview = v;
Add(m_subview, 0, 0);
m_subview->ShowAll();
}
void SpaceStationView::GotoShipyard(void) {
SwitchView(m_shipyard);
}
void SpaceStationView::OnSwitchTo(void) {
SwitchView(m_frontview);
}
void SpaceStationView::Draw3D(void) {
}
void SpaceStationView::Update(void) {
}