PickLaserMountForm::PickLaserMountForm(FormController *controller, StationShipEquipmentForm *equipForm, Equip::Type equipType, bool doFit) :
    FaceForm(controller),
    m_equipForm(equipForm),
    m_equipType(equipType),
    m_doFit(doFit)
{
    Gui::VBox *layoutBox = new Gui::VBox();
    layoutBox->SetSpacing(10.0f);

    if (m_doFit)
        layoutBox->PackEnd(new Gui::Label(Lang::FIT_TO_WHICH_MOUNT));
    else
        layoutBox->PackEnd(new Gui::Label(Lang::REMOVE_FROM_WHICH_MOUNT));

    Equip::Slot slot = Equip::types[m_equipType].slot;

    for (int i=0; i<ShipType::GUNMOUNT_MAX; i++) {
        if (m_doFit && (Pi::player->m_equipment.Get(slot, i) != Equip::NONE)) continue;
        if ((!m_doFit) && (Pi::player->m_equipment.Get(slot, i) != m_equipType)) continue;

        Gui::HBox *buttonBox = new Gui::HBox();
        buttonBox->SetSpacing(5.0f);

        Gui::Button *b = new Gui::SolidButton();
        b->onClick.connect(sigc::bind(sigc::mem_fun(this, &PickLaserMountForm::PickMount), i));
        buttonBox->PackEnd(b);
        buttonBox->PackEnd(new Gui::Label(ShipType::gunmountNames[i]));

        layoutBox->PackEnd(buttonBox);
    }

    Add(layoutBox, 0, 100);
}
StationShipRepairForm::StationShipRepairForm(FormController *controller) : FaceForm(controller)
{
	m_station = Pi::player->GetDockedWith();

	SetTitle(stringf(Lang::SOMEWHERE_SHIP_REPAIRS, formatarg("station", m_station->GetLabel())));

	m_working = new Gui::Label(Lang::SHIP_IS_ALREADY_FULLY_REPAIRED);
	Add(m_working, 0, 0);

	m_tableBox = new Gui::HBox();
	m_tableBox->SetSpacing(15.0f);
	Add(m_tableBox, 0, 0);

	Gui::VBox *columnBox = new Gui::VBox();
	m_tableBox->PackEnd(columnBox);

	Gui::HBox *buttonBox = new Gui::HBox();
	buttonBox->SetSpacing(5.0f);
	Gui::Button *b = new Gui::SolidButton();
	b->onClick.connect(sigc::bind(sigc::mem_fun(this, &StationShipRepairForm::RepairHull), 1.0f));
	buttonBox->PackEnd(b);
	buttonBox->PackEnd(new Gui::Label(Lang::REPAIR_1_PERCENT_HULL));
	columnBox->PackEnd(buttonBox);

	buttonBox = new Gui::HBox();
	buttonBox->SetSpacing(5.0f);
	b = new Gui::SolidButton();
	b->onClick.connect(sigc::bind(sigc::mem_fun(this, &StationShipRepairForm::RepairHull), 100.0f));
	buttonBox->PackEnd(b);
	m_repairAllDesc = new Gui::Label("");
	buttonBox->PackEnd(m_repairAllDesc);
	columnBox->PackEnd(buttonBox);

	columnBox = new Gui::VBox();
	m_tableBox->PackEnd(columnBox);

	m_repairOneCost = new Gui::Label("");
	columnBox->PackEnd(m_repairOneCost);
	m_repairAllCost = new Gui::Label("");
	columnBox->PackEnd(m_repairAllCost);

	UpdateLabels();
}
StationShipMarketForm::StationShipMarketForm(FormController *controller) : FaceForm(controller)
{
	m_station = Pi::player->GetDockedWith();

	SetTitle(stringf(Lang::SOMEWHERE_SHIP_MARKET, formatarg("station", m_station->GetLabel())));

	Gui::VScrollBar *scroll = new Gui::VScrollBar();
	Gui::VScrollPortal *portal = new Gui::VScrollPortal(450);
	scroll->SetAdjustment(&portal->vscrollAdjust);

	float line_height = Gui::Screen::GetFontHeight();

	m_shiplistBox = new Gui::VBox();
	m_shiplistBox->SetSpacing(line_height*0.5f);
	UpdateShipList();
	m_shiplistBox->ShowAll();

	portal->Add(m_shiplistBox);
	portal->ShowAll();

	Gui::VBox *outerbox = new Gui::VBox();
	outerbox->SetSpacing(line_height);

	Gui::Fixed *heading = new Gui::Fixed(470, Gui::Screen::GetFontHeight());
	const float *col = Gui::Theme::Colors::tableHeading;
	heading->Add((new Gui::Label(Lang::SHIP))->Color(col), 0, 0);
	heading->Add((new Gui::Label(Lang::PRICE))->Color(col), 200, 0);
	heading->Add((new Gui::Label(Lang::PART_EX))->Color(col), 275, 0);
	heading->Add((new Gui::Label(Lang::CAPACITY))->Color(col), 370, 0);
	heading->Add((new Gui::Label(Lang::VIEW))->Color(col), 430, 0);
	outerbox->PackEnd(heading);

	Gui::HBox *body = new Gui::HBox();
	body->PackEnd(portal);
	body->PackEnd(scroll);
	outerbox->PackEnd(body);

	Add(outerbox, 0, 0);
	ShowAll();

	m_onShipsForSaleChangedConnection = m_station->onShipsForSaleChanged.connect(sigc::mem_fun(this, &StationShipMarketForm::OnShipsForSaleChanged));
}
Esempio n. 4
0
StationShipViewForm::StationShipViewForm(FormController *controller, int marketIndex) :
	BlankForm(controller),
	m_marketIndex(marketIndex)
{
	m_station = Pi::player->GetDockedWith();

	m_flavour = m_station->GetShipsOnSale()[marketIndex];

	const ShipType &type = ShipType::types[m_flavour.type];

	SetTitle(stringf(Lang::SOMEWHERE_SHIP_MARKET, formatarg("station", m_station->GetLabel())));

	Add(new ShipSpinnerWidget(m_flavour, 400, 400), 0, 0);


	Gui::VBox *layoutBox = new Gui::VBox();
	layoutBox->SetSpacing(10.0f);
	Add(layoutBox, 420, 0);

	Gui::HBox *statsBox = new Gui::HBox();
	statsBox->SetSpacing(20.0f);
	layoutBox->PackEnd(statsBox);

	Gui::VBox *labelBox = new Gui::VBox();
	labelBox->PackEnd(new Gui::Label(Lang::SHIP_TYPE));
	labelBox->PackEnd(new Gui::Label(Lang::PRICE));
	labelBox->PackEnd(new Gui::Label(Lang::PART_EX));
	labelBox->PackEnd(new Gui::Label(Lang::REGISTRATION_ID));
	labelBox->PackEnd(new Gui::Label(" "));
	labelBox->PackEnd(new Gui::Label(Lang::WEIGHT_EMPTY));
	labelBox->PackEnd(new Gui::Label(Lang::WEIGHT_FULLY_LADEN));
	labelBox->PackEnd(new Gui::Label(Lang::CAPACITY));
	labelBox->PackEnd(new Gui::Label(" "));
	labelBox->PackEnd(new Gui::Label(Lang::FORWARD_ACCEL_EMPTY));
	labelBox->PackEnd(new Gui::Label(Lang::FORWARD_ACCEL_LADEN));
	labelBox->PackEnd(new Gui::Label(Lang::REVERSE_ACCEL_EMPTY));
	labelBox->PackEnd(new Gui::Label(Lang::REVERSE_ACCEL_LADEN));
	labelBox->PackEnd(new Gui::Label(" "));
	labelBox->PackEnd(new Gui::Label(Lang::HYPERDRIVE_FITTED));
	statsBox->PackEnd(labelBox);

	float forward_accel_empty = type.linThrust[ShipType::THRUSTER_FORWARD] / (-9.81f*1000.0f*(type.hullMass));
	float forward_accel_laden = type.linThrust[ShipType::THRUSTER_FORWARD] / (-9.81f*1000.0f*(type.hullMass+type.capacity));
	float reverse_accel_empty = -type.linThrust[ShipType::THRUSTER_REVERSE] / (-9.81f*1000.0f*(type.hullMass));
	float reverse_accel_laden = -type.linThrust[ShipType::THRUSTER_REVERSE] / (-9.81f*1000.0f*(type.hullMass+type.capacity));

	Gui::VBox *dataBox = new Gui::VBox();
	dataBox->PackEnd(new Gui::Label(type.name));
	dataBox->PackEnd(new Gui::Label(format_money(m_flavour.price)));
	dataBox->PackEnd(new Gui::Label(format_money(m_flavour.price - Pi::player->GetFlavour()->price)));
	dataBox->PackEnd(new Gui::Label(m_flavour.regid));
	dataBox->PackEnd(new Gui::Label(" "));
	dataBox->PackEnd(new Gui::Label(stringf(Lang::NUMBER_TONNES, formatarg("mass", type.hullMass))));
	dataBox->PackEnd(new Gui::Label(stringf(Lang::NUMBER_TONNES, formatarg("mass", type.hullMass + type.capacity))));
	dataBox->PackEnd(new Gui::Label(stringf( Lang::NUMBER_TONNES, formatarg("mass", type.capacity))));
	dataBox->PackEnd(new Gui::Label(" "));
	dataBox->PackEnd(new Gui::Label(stringf(Lang::NUMBER_G, formatarg("acceleration", forward_accel_empty))));
	dataBox->PackEnd(new Gui::Label(stringf(Lang::NUMBER_G, formatarg("acceleration", forward_accel_laden))));
	dataBox->PackEnd(new Gui::Label(stringf(Lang::NUMBER_G, formatarg("acceleration", reverse_accel_empty))));
	dataBox->PackEnd(new Gui::Label(stringf(Lang::NUMBER_G, formatarg("acceleration", reverse_accel_laden))));
	dataBox->PackEnd(new Gui::Label(" "));
	dataBox->PackEnd(new Gui::Label(EquipType::types[type.hyperdrive].name));
	statsBox->PackEnd(dataBox);


	Gui::HBox *row = new Gui::HBox();
	row->SetSpacing(10.0f);

	int row_size = 5, pos = 0;
	for (int drivetype = Equip::DRIVE_CLASS1; drivetype <= Equip::DRIVE_CLASS9; drivetype++) {
		if (type.capacity < EquipType::types[drivetype].mass)
			break;

		int hyperclass = EquipType::types[drivetype].pval;
		// for the sake of hyperspace range, we count ships mass as 60% of original.
		float range = Pi::CalcHyperspaceRange(hyperclass, type.hullMass + type.capacity);

		Gui::VBox *cell = new Gui::VBox();
		row->PackEnd(cell);

		cell->PackEnd(new Gui::Label(stringf(Lang::CLASS_NUMBER, formatarg("class", hyperclass))));
		if (type.capacity < EquipType::types[drivetype].mass)
			cell->PackEnd(new Gui::Label("---"));
		else
			cell->PackEnd(new Gui::Label(stringf(Lang::NUMBER_LY, formatarg("distance", range))));

		if (++pos == row_size) {
			layoutBox->PackEnd(row);

			row = new Gui::HBox();
			row->SetSpacing(15.0f);

			pos = 0;
		}
	}

	if (pos > 0)
		layoutBox->PackEnd(row);


	Gui::HBox *buttonBox = new Gui::HBox();
	buttonBox->SetSpacing(5.0f);

	Gui::SolidButton *b = new Gui::SolidButton();
	b->onClick.connect(sigc::mem_fun(this, &StationShipViewForm::BuyShip));
	buttonBox->PackEnd(b);
	buttonBox->PackEnd(new Gui::Label(Lang::BUY_THIS_SHIP));
	Add(buttonBox, 650, 30);
}
Esempio n. 5
0
GameMenuView::GameMenuView(): View()
{
	Gui::Tabbed *tabs = new Gui::Tabbed();
	Add(tabs, 0, 0);

	Gui::Fixed *mainTab = new Gui::Fixed(800, 600);
	tabs->AddPage(new Gui::Label(Lang::SIGHTS_SOUNDS_SAVES), mainTab);

	mainTab->Add((new Gui::Label(Lang::PIONEER))->Shadow(true), 350, 10);
	SetTransparency(false);
	Gui::Label *l = new Gui::Label(Lang::PIONEER);
	l->Color(1,.7f,0);
	m_rightRegion2->Add(l, 10, 0);

	{
		Gui::Box *hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		mainTab->Add(hbox, 20, 30);

		m_saveButton = new Gui::LabelButton(new Gui::Label(Lang::SAVE_THE_GAME));
		m_saveButton->SetShortcut(SDLK_s, KMOD_NONE);
		m_saveButton->onClick.connect(sigc::mem_fun(this, &GameMenuView::OpenSaveDialog));
		hbox->PackEnd(m_saveButton);
		m_loadButton = new Gui::LabelButton(new Gui::Label(Lang::LOAD_A_GAME));
		m_loadButton->onClick.connect(sigc::mem_fun(this, &GameMenuView::OpenLoadDialog));
		m_loadButton->SetShortcut(SDLK_l, KMOD_NONE);
		hbox->PackEnd(m_loadButton);
		m_exitButton = new Gui::LabelButton(new Gui::Label(Lang::EXIT_THIS_GAME));
		m_exitButton->onClick.connect(sigc::mem_fun(this, &GameMenuView::HideAll));
		m_exitButton->onClick.connect(sigc::ptr_fun(&Pi::EndGame));
		hbox->PackEnd(m_exitButton);

		m_menuButton = new Gui::LabelButton(new Gui::Label(Lang::RETURN_TO_MENU));
		m_menuButton->onClick.connect(sigc::bind(sigc::ptr_fun(&Pi::SetView), static_cast<View*>(0)));
		mainTab->Add(m_menuButton, 20, 30);
	}

	Gui::Box *vbox = new Gui::VBox();
	vbox->SetSizeRequest(300, 440);
	vbox->SetSpacing(5.0);
	mainTab->Add(vbox, 20, 60);

	{
		vbox->PackEnd((new Gui::Label(Lang::WINDOW_OR_FULLSCREEN))->Color(1.0f,1.0f,0.0f));
		m_toggleFullscreen = new Gui::ToggleButton();
		m_toggleFullscreen->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleFullscreen));
		Gui::HBox *hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		hbox->PackEnd(m_toggleFullscreen);
		hbox->PackEnd(new Gui::Label(Lang::FULL_SCREEN));
		vbox->PackEnd(hbox);

		vbox->PackEnd((new Gui::Label(Lang::OTHER_GRAPHICS_SETTINGS))->Color(1.0f,1.0f,0.0f));
		m_toggleShaders = new Gui::ToggleButton();
		m_toggleShaders->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleShaders));
		hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		hbox->PackEnd(m_toggleShaders);
		hbox->PackEnd(new Gui::Label(Lang::USE_SHADERS));
		m_toggleCompressTextures = new Gui::ToggleButton();
		m_toggleCompressTextures->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleCompressTextures));
		hbox->PackEnd(m_toggleCompressTextures);
		hbox->PackEnd(new Gui::Label(Lang::COMPRESS_TEXTURES));
		vbox->PackEnd(hbox);

		vbox->PackEnd((new Gui::Label(Lang::SOUND_SETTINGS))->Color(1.0f,1.0f,0.0f));
		m_masterVolume = new VolumeControl(Lang::VOL_MASTER, Pi::config->Float("MasterVolume"), Pi::config->Int("MasterMuted"));
		vbox->PackEnd(m_masterVolume);
		m_sfxVolume = new VolumeControl(Lang::VOL_EFFECTS, Pi::config->Float("SfxVolume"), Pi::config->Int("SfxMuted"));
		vbox->PackEnd(m_sfxVolume);
		m_musicVolume = new VolumeControl(Lang::VOL_MUSIC, Pi::config->Float("MusicVolume"), Pi::config->Int("MusicMuted"));
		vbox->PackEnd(m_musicVolume);

		m_masterVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume));
		m_sfxVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume));
		m_musicVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume));
	}

	// Video mode selector
	{
		m_videoModes = Graphics::GetAvailableVideoModes();
		vbox->PackEnd((new Gui::Label(Lang::VIDEO_RESOLUTION))->Color(1.0f,1.0f,0.0f));

		m_screenModesGroup = new Gui::RadioGroup();

		// box to put the scroll portal and its scroll bar into
		Gui::HBox *scrollHBox = new Gui::HBox();
		vbox->PackEnd(scrollHBox);

		Gui::VScrollBar *scroll = new Gui::VScrollBar();
		Gui::VScrollPortal *portal = new Gui::VScrollPortal(280);
		scroll->SetAdjustment(&portal->vscrollAdjust);
		scrollHBox->PackEnd(portal);
		scrollHBox->PackEnd(scroll);

		Gui::VBox *vbox2 = new Gui::VBox();
		portal->Add(vbox2);

		for (std::vector<Graphics::VideoMode>::const_iterator it = m_videoModes.begin();
			it != m_videoModes.end(); ++it) {
			Gui::RadioButton *temp = new Gui::RadioButton(m_screenModesGroup);
			temp->onSelect.connect(sigc::bind(sigc::mem_fun(this,
				&GameMenuView::OnChangeVideoResolution), it - m_videoModes.begin()));
			Gui::HBox *hbox = new Gui::HBox();
			hbox->SetSpacing(5.0f);
			hbox->PackEnd(temp);
			hbox->PackEnd(new Gui::Label(stringf(Lang::X_BY_X, formatarg("x", int(it->width)), formatarg("y", int(it->height)))));
			vbox2->PackEnd(hbox);
			//mark the current video mode
			if ((Pi::GetScrWidth() == it->width) && (Pi::GetScrHeight() == it->height)) {
				temp->SetSelected(true);
			}
		}
	}

	//Graphical detail settings
	{
		Gui::HBox *detailBox = new Gui::HBox();
		detailBox->SetSpacing(20.0f);
		mainTab->Add(detailBox, 350, 60);

		vbox = new Gui::VBox();
		vbox->SetSpacing(5.0f);
		detailBox->PackEnd(vbox);

		vbox->PackEnd((new Gui::Label(Lang::CITY_DETAIL_LEVEL))->Color(1.0f,1.0f,0.0f));
		m_cityDetailGroup = new Gui::RadioGroup();

		for (int i=0; i<5; i++) {
			Gui::RadioButton *rb = new Gui::RadioButton(m_cityDetailGroup);
			rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeCityDetail), i));
			Gui::HBox *hbox = new Gui::HBox();
			hbox->SetSpacing(5.0f);
			hbox->PackEnd(rb);
			hbox->PackEnd(new Gui::Label(planet_detail_desc[i]));
			vbox->PackEnd(hbox);
		}

		vbox = new Gui::VBox();
		vbox->SetSpacing(5.0f);
		detailBox->PackEnd(vbox);

		vbox->PackEnd((new Gui::Label(Lang::PLANET_DETAIL_DISTANCE))->Color(1.0f,1.0f,0.0f));
		m_planetDetailGroup = new Gui::RadioGroup();

		for (int i=0; i<5; i++) {
			Gui::RadioButton *rb = new Gui::RadioButton(m_planetDetailGroup);
			rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangePlanetDetail), i));
			Gui::HBox *hbox = new Gui::HBox();
			hbox->SetSpacing(5.0f);
			hbox->PackEnd(rb);
			hbox->PackEnd(new Gui::Label(planet_detail_desc[i]));
			vbox->PackEnd(hbox);
		}

		vbox = new Gui::VBox();
		vbox->SetSpacing(5.0f);
		detailBox->PackEnd(vbox);

		vbox->PackEnd((new Gui::Label(Lang::PLANET_TEXTURES))->Color(1.0f,1.0f,0.0f));
		m_planetTextureGroup = new Gui::RadioGroup();

		for (int i=0; i<2; i++) {
			Gui::RadioButton *rb = new Gui::RadioButton(m_planetTextureGroup);
			rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangePlanetTextures), i));
			Gui::HBox *hbox = new Gui::HBox();
			hbox->SetSpacing(5.0f);
			hbox->PackEnd(rb);
			hbox->PackEnd(new Gui::Label(planet_textures_desc[i]));
			vbox->PackEnd(hbox);
		}

		vbox = new Gui::VBox();
		vbox->SetSpacing(5.0f);
		detailBox->PackEnd(vbox);

		vbox->PackEnd((new Gui::Label(Lang::FRACTAL_DETAIL))->Color(1.0f,1.0f,0.0f));
		m_planetFractalGroup = new Gui::RadioGroup();

		for (int i=0; i<5; i++) {
			Gui::RadioButton *rb = new Gui::RadioButton(m_planetFractalGroup);
			rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeFractalMultiple), i));
			Gui::HBox *hbox = new Gui::HBox();
			hbox->SetSpacing(5.0f);
			hbox->PackEnd(rb);
			hbox->PackEnd(new Gui::Label(planet_fractal_desc[i]));
			vbox->PackEnd(hbox);
		}
	}


	// language

	vbox = new Gui::VBox();
	vbox->SetSizeRequest(300, 200);
	mainTab->Add(vbox, 400, 250);

	vbox->PackEnd((new Gui::Label(Lang::LANGUAGE_SELECTION))->Color(1.0f,1.0f,0.0f));

	m_languageGroup = new Gui::RadioGroup();
	const std::vector<std::string> &availableLanguages = Lang::GetAvailableLanguages();

	{
		// box to put the scroll portal and its scroll bar into
		Gui::HBox *scrollHBox = new Gui::HBox();
		vbox->PackEnd(scrollHBox);

		Gui::VScrollBar *scroll = new Gui::VScrollBar();
		Gui::VScrollPortal *portal = new Gui::VScrollPortal(280);
		scroll->SetAdjustment(&portal->vscrollAdjust);
		scrollHBox->PackEnd(portal);
		scrollHBox->PackEnd(scroll);

		Gui::VBox *vbox2 = new Gui::VBox();
		portal->Add(vbox2);

		for (std::vector<std::string>::const_iterator i = availableLanguages.begin(); i != availableLanguages.end(); ++i) {
			Gui::RadioButton *temp = new Gui::RadioButton(m_languageGroup);
			temp->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeLanguage), *i));
			Gui::HBox *hbox = new Gui::HBox();
			hbox->SetSpacing(5.0f);
			hbox->PackEnd(temp);
			hbox->PackEnd(new Gui::Label(*i));
			vbox2->PackEnd(hbox);
			if ((*i) == Pi::config->String("Lang"))
				temp->SetSelected(true);
		}
	}


	// key binding tab 1
	{
		Gui::Fixed *keybindingTab = new Gui::Fixed(800, 600);
		tabs->AddPage(new Gui::Label(Lang::CONTROLS), keybindingTab);

		Gui::VBox *box1 = new Gui::VBox();
		box1->SetSpacing(5.0f);
		keybindingTab->Add(box1, 10, 10);

		Gui::VBox *box2 = new Gui::VBox();
		box2->SetSpacing(5.0f);
		keybindingTab->Add(box2, 400, 10);

		Gui::VBox *box = box1;
		KeyGetter *keyg;

		for (int i=0; KeyBindings::bindingProtos[i].label; i++) {
			const char *label = KeyBindings::bindingProtos[i].label;
			const char *function = KeyBindings::bindingProtos[i].function;

			if (function) {
				KeyBindings::KeyBinding kb = KeyBindings::KeyBindingFromString(Pi::config->String(function));
				keyg = new KeyGetter(label, kb);
				keyg->onChange.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeKeyBinding), function));
				box->PackEnd(keyg);
			} else {
				// section
				box->PackEnd((new Gui::Label(label))->Color(1.0f, 1.0f, 0.0f));
			}

			/* 2nd column */
			if (i == 20) {
				box = box2;
			}
		}

		for (int i=0; KeyBindings::axisBindingProtos[i].label; i++) {
			AxisGetter *axisg;
			const char *label = KeyBindings::axisBindingProtos[i].label;
			const char *function = KeyBindings::axisBindingProtos[i].function;

			if (function) {
				KeyBindings::AxisBinding ab = KeyBindings::AxisBindingFromString(Pi::config->String(function).c_str());
				axisg = new AxisGetter(label, ab);
				axisg->onChange.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeAxisBinding), function));
				box->PackEnd(axisg);
			} else {
				// section
				box->PackEnd((new Gui::Label(label))->Color(1.0f, 1.0f, 0.0f));
			}

			/* 2nd column */
			if (i == 20) {
				box = box2;
			}
		}

		m_toggleJoystick = new Gui::ToggleButton();
		m_toggleJoystick->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleJoystick));
		Gui::HBox *hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		hbox->PackEnd(m_toggleJoystick);
		hbox->PackEnd(new Gui::Label(Lang::ENABLE_JOYSTICK));
		box->PackEnd(hbox);

		// Invert Mouse
		m_toggleMouseYInvert = new Gui::ToggleButton();
		m_toggleMouseYInvert->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleMouseYInvert));
		box->PackEnd((new Gui::Label(Lang::MOUSE_INPUT))->Color(1.0f,1.0f,0.0f));

		Gui::HBox *mybox = new Gui::HBox();
		mybox->SetSpacing(5.0f);
		mybox->PackEnd(m_toggleMouseYInvert);
		mybox->PackEnd(new Gui::Label(Lang::INVERT_MOUSE_Y));
		box->PackEnd(mybox);

		// Toggle nav tunnel
		m_toggleNavTunnel = new Gui::ToggleButton();
		m_toggleNavTunnel->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleNavTunnel));
		box->PackEnd((new Gui::Label(Lang::HUD))->Color(1.0f,1.0f,0.0f));

		Gui::HBox *guibox = new Gui::HBox();
		guibox->SetSpacing(5.0f);
		guibox->PackEnd(m_toggleNavTunnel);
		guibox->PackEnd(new Gui::Label(Lang::DISPLAY_NAV_TUNNEL));
		box->PackEnd(guibox);
	}

	// key binding tab 2
	{
		Gui::Fixed *keybindingTab = new Gui::Fixed(800, 600);
		tabs->AddPage(new Gui::Label(Lang::VIEW), keybindingTab);

		Gui::VBox *box1 = new Gui::VBox();
		box1->SetSpacing(5.0f);
		keybindingTab->Add(box1, 10, 10);

		Gui::VBox *box = box1;
		KeyGetter *keyg;

		for (int i=0; KeyBindings::camBindingProtos[i].label; i++) {
			const char *label = KeyBindings::camBindingProtos[i].label;
			const char *function = KeyBindings::camBindingProtos[i].function;

			if (function) {
				KeyBindings::KeyBinding kb = KeyBindings::KeyBindingFromString(Pi::config->String(function));
				keyg = new KeyGetter(label, kb);
				keyg->onChange.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeKeyBinding), function));
				box->PackEnd(keyg);
			} else {
				// section
				box->PackEnd((new Gui::Label(label))->Color(1.0f, 1.0f, 0.0f));
			}
		}
	}
}
StationShipEquipmentForm::StationShipEquipmentForm(FormController *controller) : FaceForm(controller)
{
    m_station = Pi::player->GetDockedWith();

    SetTitle(stringf(Lang::SOMEWHERE_SHIP_EQUIPMENT, formatarg("station", m_station->GetLabel())));

    Gui::VScrollBar *scroll = new Gui::VScrollBar();
    Gui::VScrollPortal *portal = new Gui::VScrollPortal(450);
    scroll->SetAdjustment(&portal->vscrollAdjust);

    int NUM_ITEMS = 0;
    const float YSEP = floor(Gui::Screen::GetFontHeight() * 1.5f);
    for (int i=Equip::FIRST_SHIPEQUIP; i<=Equip::LAST_SHIPEQUIP; i++) {
        if (m_station->GetStock(static_cast<Equip::Type>(i)))
            NUM_ITEMS++;
    }

    Gui::VBox *outerbox = new Gui::VBox();

    Gui::Fixed *innerbox = new Gui::Fixed(450, NUM_ITEMS*YSEP);
    innerbox->SetTransparency(true);

    for (int i=Equip::FIRST_SHIPEQUIP, num=0; i<=Equip::LAST_SHIPEQUIP; i++) {
        Equip::Type type = static_cast<Equip::Type>(i);
        int stock = m_station->GetStock(type);
        if (!stock) continue;
        Gui::Label *l = new Gui::Label(Equip::types[i].name);
        if (Equip::types[i].description) {
            l->SetToolTip(Equip::types[i].description);
        }
        innerbox->Add(l,0,num*YSEP);

        innerbox->Add(new Gui::Label(format_money(m_station->GetPrice(type))), 200, num*YSEP);

        innerbox->Add(new Gui::Label(format_money(REMOVAL_VALUE_PERCENT * m_station->GetPrice(type) / 100)),
                      275, num*YSEP);

        innerbox->Add(new Gui::Label(stringf(Lang::NUMBER_TONNES, formatarg("mass", Equip::types[i].mass))), 360, num*YSEP);

        ButtonPair pair;
        pair.type = type;

        pair.add = new Gui::SolidButton();
        pair.add->onClick.connect(sigc::bind(sigc::mem_fun(this, &StationShipEquipmentForm::FitItem), type));
        innerbox->Add(pair.add, 400, num*YSEP);

        pair.remove = new Gui::SolidButton();
        pair.remove->onClick.connect(sigc::bind(sigc::mem_fun(this, &StationShipEquipmentForm::RemoveItem), type));
        innerbox->Add(pair.remove, 420, num*YSEP);

        m_buttons.push_back(pair);

        num++;
    }

    portal->Add(innerbox);

    Gui::Fixed *heading = new Gui::Fixed(470, Gui::Screen::GetFontHeight());
    const float *col = Gui::Theme::Colors::tableHeading;
    heading->Add((new Gui::Label(Lang::ITEM))->Color(col), 0, 0);
    heading->Add((new Gui::Label(Lang::PRICE_TO_FIT))->Color(col), 200, 0);
    heading->Add((new Gui::Label(Lang::PRICE_TO_REMOVE))->Color(col), 275, 0);
    heading->Add((new Gui::Label(Lang::WT))->Color(col), 360, 0);
    heading->Add((new Gui::Label(Lang::FIT))->Color(col), 400, 0);
    heading->Add((new Gui::Label(Lang::REMOVE))->Color(col), 420, 0);
    outerbox->PackEnd(heading);

    Gui::HBox *body = new Gui::HBox();
    body->PackEnd(portal);
    body->PackEnd(scroll);
    outerbox->PackEnd(body);

    outerbox->SetSpacing(YSEP-Gui::Screen::GetFontHeight());
    Add(outerbox, 0, 0);

}
Esempio n. 7
0
GameMenuView::GameMenuView(): View()
{
	m_subview = 0;

	Gui::Tabbed *tabs = new Gui::Tabbed();
	Add(tabs, 0, 0);

	Gui::Fixed *mainTab = new Gui::Fixed(800, 600);
	tabs->AddPage(new Gui::Label(Lang::SIGHTS_SOUNDS_SAVES), mainTab);

	mainTab->Add((new Gui::Label(Lang::PIONEER))->Shadow(true), 350, 10);
	SetTransparency(false);
	Gui::Label *l = new Gui::Label(Lang::PIONEER);
	l->Color(1,.7,0);
	m_rightRegion2->Add(l, 10, 0);
	
	{
		Gui::LabelButton *b;
		Gui::Box *hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		mainTab->Add(hbox, 20, 30);
		b = new Gui::LabelButton(new Gui::Label(Lang::SAVE_THE_GAME));
		b->SetShortcut(SDLK_s, KMOD_NONE);
		b->onClick.connect(sigc::mem_fun(this, &GameMenuView::OpenSaveDialog));
		hbox->PackEnd(b);
		b = new Gui::LabelButton(new Gui::Label(Lang::LOAD_A_GAME));
		b->onClick.connect(sigc::mem_fun(this, &GameMenuView::OpenLoadDialog));
		b->SetShortcut(SDLK_l, KMOD_NONE);
		hbox->PackEnd(b);
		b = new Gui::LabelButton(new Gui::Label(Lang::EXIT_THIS_GAME));
		b->onClick.connect(sigc::mem_fun(this, &GameMenuView::HideAll));
		b->onClick.connect(sigc::ptr_fun(&Pi::EndGame));
		hbox->PackEnd(b);
	}

	Gui::Box *vbox = new Gui::VBox();
	vbox->SetSizeRequest(300, 440);
	vbox->SetSpacing(5.0);
	mainTab->Add(vbox, 20, 60);

	{
		vbox->PackEnd((new Gui::Label(Lang::WINDOW_OR_FULLSCREEN))->Color(1.0f,1.0f,0.0f));
		m_toggleFullscreen = new Gui::ToggleButton();
		m_toggleFullscreen->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleFullscreen));
		Gui::HBox *hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		hbox->PackEnd(m_toggleFullscreen);
		hbox->PackEnd(new Gui::Label(Lang::FULL_SCREEN));
		vbox->PackEnd(hbox);
		
		vbox->PackEnd((new Gui::Label(Lang::OTHER_GRAPHICS_SETTINGS))->Color(1.0f,1.0f,0.0f));
		m_toggleShaders = new Gui::ToggleButton();
		m_toggleShaders->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleShaders));
		hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		hbox->PackEnd(m_toggleShaders);
		hbox->PackEnd(new Gui::Label(Lang::USE_SHADERS));
		vbox->PackEnd(hbox);
		
		m_toggleHDR = new Gui::ToggleButton();
		m_toggleHDR->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleHDR));
		hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		hbox->PackEnd(m_toggleHDR);
		hbox->PackEnd(new Gui::Label(Lang::USE_HDR));
		vbox->PackEnd(hbox);
		if (!Render::IsHDRAvailable()) m_toggleHDR->SetEnabled(false);
		
		vbox->PackEnd((new Gui::Label(Lang::SOUND_SETTINGS))->Color(1.0f,1.0f,0.0f));
		m_masterVolume = new VolumeControl(Lang::VOL_MASTER, Pi::config.Float("MasterVolume"), Pi::config.Int("MasterMuted"));
		vbox->PackEnd(m_masterVolume);
		m_sfxVolume = new VolumeControl(Lang::VOL_EFFECTS, Pi::config.Float("SfxVolume"), Pi::config.Int("SfxMuted"));
		vbox->PackEnd(m_sfxVolume);
		m_musicVolume = new VolumeControl(Lang::VOL_MUSIC, Pi::config.Float("MusicVolume"), Pi::config.Int("MusicMuted"));
		vbox->PackEnd(m_musicVolume);

		m_masterVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume));
		m_sfxVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume));
		m_musicVolume->onChanged.connect(sigc::mem_fun(this, &GameMenuView::OnChangeVolume));
	}

	vbox->PackEnd((new Gui::Label(Lang::VIDEO_RESOLUTION))->Color(1.0f,1.0f,0.0f));

	Gui::RadioGroup *g = new Gui::RadioGroup();
	SDL_Rect **modes;
	modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
	if ((modes!=0) && (modes != reinterpret_cast<SDL_Rect**>(-1))) {
		// box to put the scroll portal and its scroll bar into
		Gui::HBox *scrollHBox = new Gui::HBox();
		vbox->PackEnd(scrollHBox);
		
		Gui::VScrollBar *scroll = new Gui::VScrollBar();
		Gui::VScrollPortal *portal = new Gui::VScrollPortal(280);
		scroll->SetAdjustment(&portal->vscrollAdjust);
		scrollHBox->PackEnd(portal);
		scrollHBox->PackEnd(scroll);

		Gui::VBox *vbox2 = new Gui::VBox();
		portal->Add(vbox2);
		
		for (int i=0; modes[i]; ++i) {
			Gui::RadioButton *temp = new Gui::RadioButton(g);
			temp->onSelect.connect(sigc::bind(sigc::mem_fun(this,
					&GameMenuView::OnChangeVideoResolution), i));
			Gui::HBox *hbox = new Gui::HBox();
			hbox->SetSpacing(5.0f);
			hbox->PackEnd(temp);
			hbox->PackEnd(new Gui::Label(stringf(256, Lang::X_BY_X, modes[i]->w, modes[i]->h)));
			vbox2->PackEnd(hbox);
			if ((Pi::GetScrWidth() == modes[i]->w) && (Pi::GetScrHeight() == modes[i]->h)) {
				temp->SetSelected(true);
			}
		}
	}


	Gui::HBox *detailBox = new Gui::HBox();
	detailBox->SetSpacing(60.0f);
	mainTab->Add(detailBox, 400, 60);

	vbox = new Gui::VBox();
	vbox->SetSpacing(5.0f);
	detailBox->PackEnd(vbox);

	vbox->PackEnd((new Gui::Label(Lang::PLANET_DETAIL_LEVEL))->Color(1.0f,1.0f,0.0f));
	m_planetDetailGroup = new Gui::RadioGroup();

	for (int i=0; i<5; i++) {
		Gui::RadioButton *rb = new Gui::RadioButton(m_planetDetailGroup);
		rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangePlanetDetail), i));
		Gui::HBox *hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		hbox->PackEnd(rb);
		hbox->PackEnd(new Gui::Label(planet_detail_desc[i]));
		vbox->PackEnd(hbox);
	}
	
	vbox = new Gui::VBox();
	vbox->SetSpacing(5.0f);
	detailBox->PackEnd(vbox);

	vbox->PackEnd((new Gui::Label(Lang::CITY_DETAIL_LEVEL))->Color(1.0f,1.0f,0.0f));
	m_cityDetailGroup = new Gui::RadioGroup();

	for (int i=0; i<5; i++) {
		Gui::RadioButton *rb = new Gui::RadioButton(m_cityDetailGroup);
		rb->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeCityDetail), i));
		Gui::HBox *hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		hbox->PackEnd(rb);
		hbox->PackEnd(new Gui::Label(planet_detail_desc[i]));
		vbox->PackEnd(hbox);
	}


	// language
	
	vbox = new Gui::VBox();
	vbox->SetSizeRequest(300, 200);
	mainTab->Add(vbox, 400, 250);

	vbox->PackEnd((new Gui::Label(Lang::LANGUAGE_SELECTION))->Color(1.0f,1.0f,0.0f));

	g = new Gui::RadioGroup();
	const std::list<std::string> availableLanguages = Lang::GetAvailableLanguages();

	{
		// box to put the scroll portal and its scroll bar into
		Gui::HBox *scrollHBox = new Gui::HBox();
		vbox->PackEnd(scrollHBox);
		
		Gui::VScrollBar *scroll = new Gui::VScrollBar();
		Gui::VScrollPortal *portal = new Gui::VScrollPortal(280);
		scroll->SetAdjustment(&portal->vscrollAdjust);
		scrollHBox->PackEnd(portal);
		scrollHBox->PackEnd(scroll);

		Gui::VBox *vbox2 = new Gui::VBox();
		portal->Add(vbox2);
		
		for (std::list<std::string>::const_iterator i = availableLanguages.begin(); i != availableLanguages.end(); i++) {
			Gui::RadioButton *temp = new Gui::RadioButton(g);
			temp->onSelect.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeLanguage), *i));
			Gui::HBox *hbox = new Gui::HBox();
			hbox->SetSpacing(5.0f);
			hbox->PackEnd(temp);
			hbox->PackEnd(new Gui::Label(*i));
			vbox2->PackEnd(hbox);
			if ((*i) == Pi::config.String("Lang"))
				temp->SetSelected(true);
		}
	}


	// key binding tab
	{
		Gui::Fixed *keybindingTab = new Gui::Fixed(800, 600);
		tabs->AddPage(new Gui::Label(Lang::CONTROLS), keybindingTab);

		Gui::VBox *box1 = new Gui::VBox();
		box1->SetSpacing(5.0f);
		keybindingTab->Add(box1, 10, 10);

		Gui::VBox *box2 = new Gui::VBox();
		box2->SetSpacing(5.0f);
		keybindingTab->Add(box2, 400, 10);

		Gui::VBox *box = box1;
		KeyGetter *keyg;

		for (int i=0; KeyBindings::bindingProtos[i].label; i++) {
			const char *label = KeyBindings::bindingProtos[i].label;
			const char *function = KeyBindings::bindingProtos[i].function;

			if (function) {
				KeyBindings::KeyBinding kb = KeyBindings::KeyBindingFromString(Pi::config.String(function));
				keyg = new KeyGetter(label, kb);
				keyg->onChange.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeKeyBinding), function));
				box->PackEnd(keyg);
			} else {
				// section
				box->PackEnd((new Gui::Label(label))->Color(1.0f, 1.0f, 0.0f));
			}

			/* 2nd column */
			if (i == 20) {
				box = box2;
			}
		}

		for (int i=0; KeyBindings::axisBindingProtos[i].label; i++) {
			AxisGetter *axisg;
			const char *label = KeyBindings::axisBindingProtos[i].label;
			const char *function = KeyBindings::axisBindingProtos[i].function;

			if (function) {
				KeyBindings::AxisBinding ab = KeyBindings::AxisBindingFromString(Pi::config.String(function).c_str());
				axisg = new AxisGetter(label, ab);
				axisg->onChange.connect(sigc::bind(sigc::mem_fun(this, &GameMenuView::OnChangeAxisBinding), function));
				box->PackEnd(axisg);
			} else {
				// section
				box->PackEnd((new Gui::Label(label))->Color(1.0f, 1.0f, 0.0f));
			}

			/* 2nd column */
			if (i == 20) {
				box = box2;
			}
		}

		m_toggleJoystick = new Gui::ToggleButton();
		m_toggleJoystick->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleJoystick));
		Gui::HBox *hbox = new Gui::HBox();
		hbox->SetSpacing(5.0f);
		hbox->PackEnd(m_toggleJoystick);
		hbox->PackEnd(new Gui::Label(Lang::ENABLE_JOYSTICK));
		box->PackEnd(hbox);

		// Invert Mouse
		m_toggleMouseYInvert = new Gui::ToggleButton();
		m_toggleMouseYInvert->onChange.connect(sigc::mem_fun(this, &GameMenuView::OnToggleMouseYInvert));
		box->PackEnd((new Gui::Label(Lang::MOUSE_INPUT))->Color(1.0f,1.0f,0.0f));

		Gui::HBox *mybox = new Gui::HBox();
		mybox->SetSpacing(5.0f);
		mybox->PackEnd(m_toggleMouseYInvert);
		mybox->PackEnd(new Gui::Label(Lang::INVERT_MOUSE_Y));
		box->PackEnd(mybox);
	}
}
Esempio n. 8
0
void SectorView::InitObject()
{
    SetTransparency(true);

    m_lineVerts.reset(new Graphics::VertexArray(Graphics::ATTRIB_POSITION, 500));
    m_secLineVerts.reset(new Graphics::VertexArray(Graphics::ATTRIB_POSITION, 500));

    Gui::Screen::PushFont("OverlayFont");
    m_clickableLabels = new Gui::LabelSet();
    m_clickableLabels->SetLabelColor(Color(178,178,178,191));
    Add(m_clickableLabels, 0, 0);
    Gui::Screen::PopFont();

    m_sectorLabel = new Gui::Label("");
    Add(m_sectorLabel, 2, Gui::Screen::GetHeight()-Gui::Screen::GetFontHeight()*2-66);
    m_distanceLabel = new Gui::Label("");
    Add(m_distanceLabel, 2, Gui::Screen::GetHeight()-Gui::Screen::GetFontHeight()-66);

    m_zoomInButton = new Gui::ImageButton("icons/zoom_in.png");
    m_zoomInButton->SetToolTip(Lang::ZOOM_IN);
    m_zoomInButton->SetRenderDimensions(30, 22);
    Add(m_zoomInButton, 700, 5);

    m_zoomLevelLabel = (new Gui::Label(""))->Color(69, 219, 235);
    Add(m_zoomLevelLabel, 640, 5);

    m_zoomOutButton = new Gui::ImageButton("icons/zoom_out.png");
    m_zoomOutButton->SetToolTip(Lang::ZOOM_OUT);
    m_zoomOutButton->SetRenderDimensions(30, 22);
    Add(m_zoomOutButton, 732, 5);

    Add(new Gui::Label(Lang::SEARCH), 650, 500);
    m_searchBox = new Gui::TextEntry();
    m_searchBox->onKeyPress.connect(sigc::mem_fun(this, &SectorView::OnSearchBoxKeyPress));
    Add(m_searchBox, 700, 500);

    m_disk.reset(new Graphics::Drawables::Disk(Pi::renderer, Color::WHITE, 0.2f));

    m_infoBox = new Gui::VBox();
    m_infoBox->SetTransparency(false);
    m_infoBox->SetBgColor(0.05f, 0.05f, 0.12f, 0.5f);
    m_infoBox->SetSpacing(10.0f);
    Add(m_infoBox, 5, 5);

    // 1. holds info about current, selected, targeted systems
    Gui::VBox *locationsBox = new Gui::VBox();
    locationsBox->SetSpacing(5.f);
    // 1.1 current system
    Gui::VBox *systemBox = new Gui::VBox();
    Gui::HBox *hbox = new Gui::HBox();
    hbox->SetSpacing(5.0f);
    Gui::Button *b = new Gui::SolidButton();
    b->onClick.connect(sigc::mem_fun(this, &SectorView::GotoCurrentSystem));
    hbox->PackEnd(b);
    hbox->PackEnd((new Gui::Label(Lang::CURRENT_SYSTEM))->Color(255, 255, 255));
    systemBox->PackEnd(hbox);
    hbox = new Gui::HBox();
    hbox->SetSpacing(5.0f);
    m_currentSystemLabels.systemName = (new Gui::Label(""))->Color(255, 255, 0);
    m_currentSystemLabels.distance = (new Gui::Label(""))->Color(255, 0, 0);
    hbox->PackEnd(m_currentSystemLabels.systemName);
    hbox->PackEnd(m_currentSystemLabels.distance);
    systemBox->PackEnd(hbox);
    m_currentSystemLabels.starType = (new Gui::Label(""))->Color(255, 0, 255);
    m_currentSystemLabels.shortDesc = (new Gui::Label(""))->Color(255, 0, 255);
    systemBox->PackEnd(m_currentSystemLabels.starType);
    systemBox->PackEnd(m_currentSystemLabels.shortDesc);
    locationsBox->PackEnd(systemBox);
    // 1.2 selected system
    systemBox = new Gui::VBox();
    hbox = new Gui::HBox();
    hbox->SetSpacing(5.0f);
    b = new Gui::SolidButton();
    b->onClick.connect(sigc::mem_fun(this, &SectorView::GotoSelectedSystem));
    hbox->PackEnd(b);
    hbox->PackEnd((new Gui::Label(Lang::SELECTED_SYSTEM))->Color(255, 255, 255));
    systemBox->PackEnd(hbox);
    hbox = new Gui::HBox();
    hbox->SetSpacing(5.0f);
    m_selectedSystemLabels.systemName = (new Gui::Label(""))->Color(255, 255, 0);
    m_selectedSystemLabels.distance = (new Gui::Label(""))->Color(255, 0, 0);
    hbox->PackEnd(m_selectedSystemLabels.systemName);
    hbox->PackEnd(m_selectedSystemLabels.distance);
    systemBox->PackEnd(hbox);
    m_selectedSystemLabels.starType = (new Gui::Label(""))->Color(255, 0, 255);
    m_selectedSystemLabels.shortDesc = (new Gui::Label(""))->Color(255, 0, 255);
    systemBox->PackEnd(m_selectedSystemLabels.starType);
    systemBox->PackEnd(m_selectedSystemLabels.shortDesc);
    locationsBox->PackEnd(systemBox);
    // 1.3 targeted system
    systemBox = new Gui::VBox();
    hbox = new Gui::HBox();
    hbox->SetSpacing(5.0f);
    b = new Gui::SolidButton();
    b->onClick.connect(sigc::mem_fun(this, &SectorView::GotoHyperspaceTarget));
    hbox->PackEnd(b);
    hbox->PackEnd((new Gui::Label(Lang::HYPERSPACE_TARGET))->Color(255, 255, 255));
    m_hyperspaceLockLabel = (new Gui::Label(""))->Color(255, 255, 255);
    hbox->PackEnd(m_hyperspaceLockLabel);
    systemBox->PackEnd(hbox);
    hbox = new Gui::HBox();
    hbox->SetSpacing(5.0f);
    m_targetSystemLabels.systemName = (new Gui::Label(""))->Color(255, 255, 0);
    m_targetSystemLabels.distance = (new Gui::Label(""))->Color(255, 0, 0);
    hbox->PackEnd(m_targetSystemLabels.systemName);
    hbox->PackEnd(m_targetSystemLabels.distance);
    systemBox->PackEnd(hbox);
    m_targetSystemLabels.starType = (new Gui::Label(""))->Color(255, 0, 255);
    m_targetSystemLabels.shortDesc = (new Gui::Label(""))->Color(255, 0, 255);
    systemBox->PackEnd(m_targetSystemLabels.starType);
    systemBox->PackEnd(m_targetSystemLabels.shortDesc);
    locationsBox->PackEnd(systemBox);
    m_infoBox->PackEnd(locationsBox);

    // 2. holds options for displaying systems
    Gui::VBox *filterBox = new Gui::VBox();
    // 2.1 Draw vertical lines
    hbox = new Gui::HBox();
    hbox->SetSpacing(5.0f);
    m_drawSystemLegButton = (new Gui::ToggleButton());
    m_drawSystemLegButton->SetPressed(false); // TODO: replace with var
    hbox->PackEnd(m_drawSystemLegButton);
    Gui::Label *label = (new Gui::Label(Lang::DRAW_VERTICAL_LINES))->Color(255, 255, 255);
    hbox->PackEnd(label);
    filterBox->PackEnd(hbox);
    // 2.2 Draw planet labels
    hbox = new Gui::HBox();
    hbox->SetSpacing(5.0f);
    m_drawOutRangeLabelButton = new Gui::ToggleButton();
    m_drawOutRangeLabelButton->SetPressed(false); // TODO: replace with var
    hbox->PackEnd(m_drawOutRangeLabelButton);
    label = (new Gui::Label(Lang::DRAW_OUT_RANGE_LABELS))->Color(255, 255, 255);
    hbox->PackEnd(label);
    filterBox->PackEnd(hbox);

    m_infoBox->PackEnd(filterBox);

    m_onMouseWheelCon =
        Pi::onMouseWheel.connect(sigc::mem_fun(this, &SectorView::MouseWheel));

    UpdateSystemLabels(m_currentSystemLabels, m_current);
    UpdateSystemLabels(m_selectedSystemLabels, m_selected);
    UpdateSystemLabels(m_targetSystemLabels, m_hyperspaceTarget);

    UpdateHyperspaceLockLabel();

    m_factionBox = new Gui::VBox();
    m_factionBox->SetTransparency(false);
    m_factionBox->SetBgColor(0.05f, 0.05f, 0.12f, 0.5f);
    m_factionBox->SetSpacing(5.0f);
    m_factionBox->HideAll();
    Add(m_factionBox, 5, 5);
}
Esempio n. 9
0
ObjectViewerView::ObjectViewerView(): View()
{
	SetTransparency(true);
	viewingDist = 1000.0f;
	m_camRot = matrix4x4d::Identity();
	
	m_infoLabel = new Gui::Label("");
	Add(m_infoLabel, 2, Gui::Screen::GetHeight()-66-Gui::Screen::GetFontHeight());

	Gui::VBox *vbox = new Gui::VBox();
	Add(vbox, 580, 2);

	vbox->PackEnd(new Gui::Label("Mass (earths):"));
	m_sbodyMass = new Gui::TextEntry();
	vbox->PackEnd(m_sbodyMass);

	vbox->PackEnd(new Gui::Label("Radius (earths):"));
	m_sbodyRadius = new Gui::TextEntry();
	vbox->PackEnd(m_sbodyRadius);

	vbox->PackEnd(new Gui::Label("Integer seed:"));
	m_sbodySeed = new Gui::TextEntry();
	vbox->PackEnd(m_sbodySeed);

	vbox->PackEnd(new Gui::Label("Volatile gases (>= 0):"));
	m_sbodyVolatileGas = new Gui::TextEntry();
	vbox->PackEnd(m_sbodyVolatileGas);

	vbox->PackEnd(new Gui::Label("Volatile liquid (0-1):"));
	m_sbodyVolatileLiquid = new Gui::TextEntry();
	vbox->PackEnd(m_sbodyVolatileLiquid);

	vbox->PackEnd(new Gui::Label("Volatile ices (0-1):"));
	m_sbodyVolatileIces = new Gui::TextEntry();
	vbox->PackEnd(m_sbodyVolatileIces);

	vbox->PackEnd(new Gui::Label("Life (0-1):"));
	m_sbodyLife = new Gui::TextEntry();
	vbox->PackEnd(m_sbodyLife);

	vbox->PackEnd(new Gui::Label("Volcanicity (0-1):"));
	m_sbodyVolcanicity = new Gui::TextEntry();
	vbox->PackEnd(m_sbodyVolcanicity);

	vbox->PackEnd(new Gui::Label("Crust metallicity (0-1):"));
	m_sbodyMetallicity = new Gui::TextEntry();
	vbox->PackEnd(m_sbodyMetallicity);

	Gui::LabelButton *b = new Gui::LabelButton(new Gui::Label("Change planet terrain type"));
	b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnChangeGeoSphereStyle));
	vbox->PackEnd(b);
}