• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ gui::HBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中gui::HBox的典型用法代码示例。如果您正苦于以下问题:C++ HBox类的具体用法?C++ HBox怎么用?C++ HBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了HBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: FaceForm

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);
}
开发者ID:Gudadantza,项目名称:pioneer,代码行数:33,代码来源:StationShipEquipmentForm.cpp


示例2: UpdateInfo

	virtual void UpdateInfo() {
		const float YSEP = Gui::Screen::GetFontHeight() * 1.5f;
		DeleteAllChildren();
		Add(new Gui::Label(Lang::CARGO_INVENTORY), 40, 40);
		Add(new Gui::Label(Lang::JETTISON), 40, 40+YSEP*2);
		float ypos = 40 + 3*YSEP;
		for (int i=1; i<Equip::TYPE_MAX; i++) {
			if (Equip::types[i].slot != Equip::SLOT_CARGO) continue;
			const int gotNum = Pi::player->m_equipment.Count(Equip::SLOT_CARGO, static_cast<Equip::Type>(i));
			if (!gotNum) continue;
			Gui::Button *b = new Gui::SolidButton();
			b->onClick.connect(sigc::bind(sigc::mem_fun(this, &CargoPage::JettisonCargo), static_cast<Equip::Type>(i)));
			Add(b, 40, ypos);
			Add(new Gui::Label(Equip::types[i].name), 70, ypos);
			char buf[128];
			snprintf(buf, sizeof(buf), "%dt", gotNum*Equip::types[i].mass);
			Add(new Gui::Label(buf), 300, ypos);
			ypos += YSEP;
		}

		if (Pi::player->m_equipment.Count(Equip::SLOT_CARGO, Equip::WATER) > 0) {
			Gui::HBox *box = new Gui::HBox();
			box->SetSpacing(5.0f);
			Gui::Button *b = new Gui::SolidButton();
			b->onClick.connect(sigc::mem_fun(this, &CargoPage::Refuel));
			box->PackEnd(b);
			box->PackEnd(new Gui::Label(Lang::REFUEL));
			Add(box, 300, 40);
			box->ShowAll();
		}

		ShowChildren();
	}
开发者ID:Ziusudra,项目名称:pioneer,代码行数:33,代码来源:InfoView.cpp


示例3: FaceForm

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));
}
开发者ID:ChromeSkull,项目名称:pioneer,代码行数:42,代码来源:StationShipMarketForm.cpp


示例4: UpdateFactionToggles

void SectorView::UpdateFactionToggles()
{
	// make sure we have enough row in the ui
	while (m_visibleFactionLabels.size() < m_visibleFactions.size()) {
		Gui::HBox*         row    = new Gui::HBox();
		Gui::ToggleButton* toggle = new Gui::ToggleButton();
		Gui::Label*        label  = new Gui::Label("");

		toggle->SetToolTip("");
		label ->SetToolTip("");

		m_visibleFactionToggles.push_back(toggle);
		m_visibleFactionLabels.push_back(label);
		m_visibleFactionRows.push_back(row);

		row->SetSpacing(5.0f);
		row->PackEnd(toggle);
		row->PackEnd(label);
		m_factionBox->PackEnd(row);
	}

	// set up the faction labels, and the toggle buttons
	Uint32 rowIdx = 0;
	for (std::set<Faction*>::iterator it = m_visibleFactions.begin(); it != m_visibleFactions.end(); ++it, ++rowIdx) {
		m_visibleFactionLabels [rowIdx]->SetText((*it)->name);
		m_visibleFactionLabels [rowIdx]->Color((*it)->colour);
		m_visibleFactionToggles[rowIdx]->onChange.clear();
		m_visibleFactionToggles[rowIdx]->SetPressed(m_hiddenFactions.find((*it)) == m_hiddenFactions.end());
		m_visibleFactionToggles[rowIdx]->onChange.connect(sigc::bind(sigc::mem_fun(this, &SectorView::OnToggleFaction),*it));
		m_visibleFactionRows   [rowIdx]->ShowAll();
	}

	// hide any rows, and disconnect any toggle event handler, that we're not using
	for (; rowIdx < m_visibleFactionLabels.size(); rowIdx++) {
		m_visibleFactionToggles[rowIdx]->onChange.clear();
		m_visibleFactionRows   [rowIdx]->Hide();
	}

	if  (m_detailBoxVisible == DETAILBOX_FACTION) m_factionBox->Show();
	else                                          m_factionBox->HideAll();
}
开发者ID:Mike-Cowley,项目名称:pioneer,代码行数:41,代码来源:SectorView.cpp


示例5: FaceForm

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();
}
开发者ID:AaronSenese,项目名称:pioneer,代码行数:43,代码来源:StationShipRepairForm.cpp


示例6: ShowAll

	void ShowAll() {
		DeleteAllChildren();
		PackEnd(new Gui::Label(m_title));
		m_tentry = new Gui::TextEntry();
		PackEnd(m_tentry);

		std::list<std::string> files;
		GetDirectoryContents(GetFullSavefileDirPath().c_str(), files);

		Gui::HBox *hbox = new Gui::HBox();
		PackEnd(hbox);

		Gui::HBox *buttonBox = new Gui::HBox();
		buttonBox->SetSpacing(5.0f);
		Gui::Button *b = new Gui::LabelButton(new Gui::Label(m_type == SAVE ? Lang::SAVE : Lang::LOAD));
		b->onClick.connect(sigc::mem_fun(this, &FileDialog::OnClickAction));
		buttonBox->PackEnd(b);
		b = new Gui::LabelButton(new Gui::Label(Lang::CANCEL));
		b->onClick.connect(sigc::mem_fun(this, &FileDialog::OnClickCancel));
		buttonBox->PackEnd(b);
		PackEnd(buttonBox);


		Gui::VScrollBar *scroll = new Gui::VScrollBar();
		Gui::VScrollPortal *portal = new Gui::VScrollPortal(390);
		portal->SetTransparency(false);
		scroll->SetAdjustment(&portal->vscrollAdjust);
		hbox->PackEnd(portal);
		hbox->PackEnd(scroll);

		Gui::Box *vbox = new Gui::VBox();
		for (std::list<std::string>::iterator i = files.begin(); i!=files.end(); ++i) {
			b = new SimpleLabelButton(new Gui::Label(*i));
			b->onClick.connect(sigc::bind(sigc::mem_fun(this, &FileDialog::OnClickFile), *i));
			vbox->PackEnd(b);
		}
		portal->Add(vbox);
		
		Gui::VBox::ShowAll();
	}
开发者ID:johnuk89,项目名称:pioneer,代码行数:40,代码来源:GameMenuView.cpp


示例7: ShowAll

void FileSelectorWidget::ShowAll()
{
	DeleteAllChildren();
	PackEnd(new Gui::Label(m_title));
	m_tentry = new Gui::TextEntry();
	PackEnd(m_tentry);

	Gui::HBox *hbox = new Gui::HBox();
	PackEnd(hbox);

	Gui::HBox *buttonBox = new Gui::HBox();
	buttonBox->SetSpacing(5.0f);
	Gui::Button *b = new Gui::LabelButton(new Gui::Label(m_type == SAVE ? Lang::SAVE : Lang::LOAD));
	b->onClick.connect(sigc::mem_fun(this, &FileSelectorWidget::OnClickAction));
	buttonBox->PackEnd(b);
	b = new Gui::LabelButton(new Gui::Label(Lang::CANCEL));
	b->onClick.connect(sigc::mem_fun(this, &FileSelectorWidget::OnClickCancel));
	buttonBox->PackEnd(b);
	PackEnd(buttonBox);

	Gui::VScrollBar *scroll = new Gui::VScrollBar();
	Gui::VScrollPortal *portal = new Gui::VScrollPortal(390);
	portal->SetTransparency(false);
	scroll->SetAdjustment(&portal->vscrollAdjust);
	hbox->PackEnd(portal);
	hbox->PackEnd(scroll);

	Gui::Box *vbox = new Gui::VBox();
	for (FileSystem::FileEnumerator files(FileSystem::rawFileSystem, Pi::GetSaveDir()); !files.Finished(); files.Next())
	{
		std::string name = files.Current().GetName();
		b = new SimpleLabelButton(new Gui::Label(name));
		b->onClick.connect(sigc::bind(sigc::mem_fun(this, &FileSelectorWidget::OnClickFile), name));
		vbox->PackEnd(b);
	}
	portal->Add(vbox);

	Gui::VBox::ShowAll();
}
开发者ID:AaronSenese,项目名称:pioneer,代码行数:39,代码来源:FileSelectorWidget.cpp


示例8: InitObject

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);
//.........这里部分代码省略.........
开发者ID:Luomu,项目名称:pioneer,代码行数:101,代码来源:SectorView.cpp


示例9: SystemChanged

void SystemInfoView::SystemChanged(const SystemPath &path)
{
	DeleteAllChildren();
	m_tabs = 0;
	m_bodyIcons.clear();

	if (!path.HasValidSystem())
		return;

	m_system = StarSystemCache::GetCached(path);

	m_sbodyInfoTab = new Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()-100));

	if (m_system->GetUnexplored()) {
		Add(m_sbodyInfoTab, 0, 0);

		std::string _info =
			Lang::UNEXPLORED_SYSTEM_STAR_INFO_ONLY;

		Gui::Label *l = (new Gui::Label(_info))->Color(255,255,0);
		m_sbodyInfoTab->Add(l, 35, 300);
		m_selectedBodyPath = SystemPath();

		ShowAll();
		return;
	}

	m_econInfoTab = new Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()-100));
	Gui::Fixed *demographicsTab = new Gui::Fixed();

	m_tabs = new Gui::Tabbed();
	m_tabs->AddPage(new Gui::Label(Lang::PLANETARY_INFO), m_sbodyInfoTab);
	m_tabs->AddPage(new Gui::Label(Lang::ECONOMIC_INFO), m_econInfoTab);
	m_tabs->AddPage(new Gui::Label(Lang::DEMOGRAPHICS), demographicsTab);
	Add(m_tabs, 0, 0);

	m_sbodyInfoTab->onMouseButtonEvent.connect(sigc::mem_fun(this, &SystemInfoView::OnClickBackground));

	int majorBodies, starports, onSurface;
	{
		float pos[2] = { 0, 0 };
		float psize = -1;
		majorBodies = starports = onSurface = 0;
		PutBodies(m_system->GetRootBody().Get(), m_econInfoTab, 1, pos, majorBodies, starports, onSurface, psize);

		majorBodies = starports = onSurface = 0;
		pos[0] = pos[1] = 0;
		psize = -1;
		PutBodies(m_system->GetRootBody().Get(), m_sbodyInfoTab, 1, pos, majorBodies, starports, onSurface, psize);

		majorBodies = starports = onSurface = 0;
		pos[0] = pos[1] = 0;
		psize = -1;
		PutBodies(m_system->GetRootBody().Get(), demographicsTab, 1, pos, majorBodies, starports, onSurface, psize);
	}

	std::string _info = stringf(
		Lang::STABLE_SYSTEM_WITH_N_MAJOR_BODIES_STARPORTS,
		formatarg("bodycount", majorBodies),
		formatarg("body(s)", std::string(majorBodies == 1 ? Lang::BODY : Lang::BODIES)),
		formatarg("portcount", starports),
		formatarg("starport(s)", std::string(starports == 1 ? Lang::STARPORT : Lang::COUNT_STARPORTS)));
	if (starports > 0)
		_info += stringf(Lang::COUNT_ON_SURFACE, formatarg("surfacecount", onSurface));
	_info += ".\n\n";
	_info += m_system->GetLongDescription();

	{
		// astronomical body info tab
		m_infoBox = new Gui::VBox();

		Gui::HBox *scrollBox = new Gui::HBox();
		scrollBox->SetSpacing(5);
		m_sbodyInfoTab->Add(scrollBox, 35, 250);

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

		Gui::Label *l = (new Gui::Label(_info))->Color(255,255,0);
		m_infoBox->PackStart(l);
		portal->Add(m_infoBox);
		scrollBox->PackStart(scroll);
		scrollBox->PackStart(portal);
	}

	{
		// economy tab
		Gui::HBox *scrollBox2 = new Gui::HBox();
		scrollBox2->SetSpacing(5);
		m_econInfoTab->Add(scrollBox2, 35, 300);
		Gui::VScrollBar *scroll2 = new Gui::VScrollBar();
		Gui::VScrollPortal *portal2 = new Gui::VScrollPortal(730);
		scroll2->SetAdjustment(&portal2->vscrollAdjust);
		scrollBox2->PackStart(scroll2);
		scrollBox2->PackStart(portal2);

		m_econInfo = new Gui::Label("");
		m_econInfoTab->Add(m_econInfo, 35, 250);

//.........这里部分代码省略.........
开发者ID:Wuzzy2,项目名称:pioneer,代码行数:101,代码来源:SystemInfoView.cpp


示例10: formatarg

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);


//.........这里部分代码省略.........
开发者ID:GAlexx,项目名称:pioneer,代码行数:101,代码来源:StationShipViewForm.cpp


示例11: View

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());

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

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

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

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

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

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

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

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

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

	m_vbox->PackEnd(new Gui::Label("Crust metallicity (0-1):"));
	m_sbodyMetallicity = new Gui::TextEntry();
	m_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::OnChangeTerrain));
	m_vbox->PackEnd(b);

	Gui::HBox *hbox = new Gui::HBox();

	b = new Gui::LabelButton(new Gui::Label("Prev Seed"));
	b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnPrevSeed));
	hbox->PackEnd(b);

	b = new Gui::LabelButton(new Gui::Label("Random Seed"));
	b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnRandomSeed));
	hbox->PackEnd(b);

	b = new Gui::LabelButton(new Gui::Label("Next Seed"));
	b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnNextSeed));
	hbox->PackEnd(b);

	m_vbox->PackEnd(hbox);
}
开发者ID:gamebytes,项目名称:pioneer,代码行数:68,代码来源:ObjectViewerView.cpp


示例12: ShowAll

void CommodityTradeWidget::ShowAll()
{
	DeleteAllChildren();
	m_stockLabels.clear();
	m_cargoLabels.clear();

	SetTransparency(true);

	Gui::VScrollBar *scroll = new Gui::VScrollBar();
	Gui::VScrollPortal *portal = new Gui::VScrollPortal(450);
	scroll->SetAdjustment(&portal->vscrollAdjust);
	//int GetStock(Equip::Type t) const { return m_equipmentStock[t]; }

	int NUM_ITEMS = 0;
	const float YSEP = floor(Gui::Screen::GetFontHeight() * 2.5f);
	for (int i=Equip::FIRST_COMMODITY; i<=Equip::LAST_COMMODITY; i++) {
		assert(Equip::types[i].slot == Equip::SLOT_CARGO);

		if (m_seller->DoesSell(Equip::Type(i))) {
				NUM_ITEMS++;
		}
	}
	Gui::Fixed *innerbox = new Gui::Fixed(450, NUM_ITEMS*YSEP);
	innerbox->SetTransparency(true);

	const float iconOffset = 8.0f;
	for (int i=Equip::FIRST_COMMODITY, num=0; i<=Equip::LAST_COMMODITY; i++) {
		assert(Equip::types[i].slot == Equip::SLOT_CARGO);

		if (!m_seller->DoesSell(Equip::Type(i))) continue;
		int stock = m_seller->GetStock(static_cast<Equip::Type>(i));

        std::map<Equip::Type,std::string>::iterator icon_iter = s_iconMap.find(Equip::Type(i));
		if (icon_iter != s_iconMap.end()) {
			Gui::Image *icon = new Gui::Image(("icons/goods/" + (*icon_iter).second + ".png").c_str());
			// this forces the on-screen rendering to fit within (rescale) to these dimensions
			icon->SetRenderDimensions(38.0f, 32.0f);
			innerbox->Add(icon, 0, num*YSEP);
		}

		Gui::Label *l = new Gui::Label(Equip::types[i].name);
		if (Equip::types[i].description)
			l->SetToolTip(Equip::types[i].description);
		innerbox->Add(l,42,num*YSEP+iconOffset);
		Gui::RepeaterButton *b = new Gui::RepeaterButton(RBUTTON_DELAY, RBUTTON_REPEAT);
		sigc::slot<void> func = sigc::bind(sigc::mem_fun(this, &CommodityTradeWidget::OnClickBuy), i);
		b->onClick.connect(sigc::bind(sigc::mem_fun(this, &CommodityTradeWidget::ManageRButton), b, func));
		innerbox->Add(b, 380, num*YSEP+iconOffset);
		b = new Gui::RepeaterButton(RBUTTON_DELAY, RBUTTON_REPEAT);
		func = sigc::bind(sigc::mem_fun(this, &CommodityTradeWidget::OnClickSell), i);
		b->onClick.connect(sigc::bind(sigc::mem_fun(this, &CommodityTradeWidget::ManageRButton), b, func));
		innerbox->Add(b, 415, num*YSEP+iconOffset);
		char buf[128];
		innerbox->Add(new Gui::Label(
					format_money(m_seller->GetPrice(static_cast<Equip::Type>(i)))
					), 200, num*YSEP+iconOffset);

		snprintf(buf, sizeof(buf), "%dt", stock*Equip::types[i].mass);
		Gui::Label *stocklabel = new Gui::Label(buf);
		m_stockLabels[i] = stocklabel;
		innerbox->Add(stocklabel, 275, num*YSEP+iconOffset);

		snprintf(buf, sizeof(buf), "%dt", Pi::player->m_equipment.Count(Equip::SLOT_CARGO, static_cast<Equip::Type>(i))*Equip::types[i].mass);
		Gui::Label *cargolabel = new Gui::Label(buf);
		m_cargoLabels[i] = cargolabel;
		innerbox->Add(cargolabel, 325, num*YSEP+iconOffset);
		num++;
	}
	innerbox->ShowAll();

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

	Gui::Fixed *heading = new Gui::Fixed(470, Gui::Screen::GetFontHeight());
	const Color &col = Gui::Theme::Colors::tableHeading;
	heading->Add((new Gui::Label(Lang::ITEM))->Color(col), 0, 0);
	heading->Add((new Gui::Label(Lang::PRICE))->Color(col), 200, 0);
	heading->Add((new Gui::Label(Lang::BUY))->Color(col), 380, 0);
	heading->Add((new Gui::Label(Lang::SELL))->Color(col), 415, 0);
	heading->Add((new Gui::Label(Lang::STOCK))->Color(col), 275, 0);
	heading->Add((new Gui::Label(Lang::CARGO))->Color(col), 325, 0);
	PackEnd(heading);

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

	SetSpacing(YSEP-Gui::Screen::GetFontHeight());

	Gui::VBox::ShowAll();
}
开发者ID:Faiva78,项目名称:pioneer,代码行数:92,代码来源:CommodityTradeWidget.cpp


示例13: UIView

ObjectViewerView::ObjectViewerView(): UIView()
{
	SetTransparency(true);
	viewingDist = 1000.0f;
	m_camRot = matrix4x4d::Identity();

	float size[2];
	GetSizeRequested(size);

	SetTransparency(true);

	float znear;
	float zfar;
	Pi::renderer->GetNearFarRange(znear, zfar);

	const float fovY = Pi::config->Float("FOVVertical");
    m_cameraContext.Reset(new CameraContext(Graphics::GetScreenWidth(), Graphics::GetScreenHeight(), fovY, znear, zfar));
    m_camera.reset(new Camera(m_cameraContext, Pi::renderer));

	m_cameraContext->SetFrame(Pi::player->GetFrame());
	m_cameraContext->SetPosition(Pi::player->GetInterpPosition() + vector3d(0, 0, viewingDist));
	m_cameraContext->SetOrient(matrix3x3d::Identity());

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

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

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

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

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

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

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

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

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

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

	m_vbox->PackEnd(new Gui::Label("Crust metallicity (0-1):"));
	m_sbodyMetallicity = new Gui::TextEntry();
	m_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::OnChangeTerrain));
	m_vbox->PackEnd(b);

	Gui::HBox *hbox = new Gui::HBox();

	b = new Gui::LabelButton(new Gui::Label("Prev Seed"));
	b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnPrevSeed));
	hbox->PackEnd(b);

	b = new Gui::LabelButton(new Gui::Label("Random Seed"));
	b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnRandomSeed));
	hbox->PackEnd(b);

	b = new Gui::LabelButton(new Gui::Label("Next Seed"));
	b->onClick.connect(sigc::mem_fun(this, &ObjectViewerView::OnNextSeed));
	hbox->PackEnd(b);

	m_vbox->PackEnd(hbox);
}
开发者ID:ZeframCochrane,项目名称:pioneer,代码行数:85,代码来源:ObjectViewerView.cpp


示例14: SystemChanged

void SystemInfoView::SystemChanged(const SystemPath &path)
{
	DeleteAllChildren();
	m_tabs = 0;
	m_bodyIcons.clear();

	if (!path.HasValidSystem())
		return;

	m_system = StarSystem::cache->GetCached(path);

	m_sbodyInfoTab = new Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()-100));

	if (m_system->GetUnexplored()) {
		Add(m_sbodyInfoTab, 0, 0);

		std::string _info =
			Lang::UNEXPLORED_SYSTEM_STAR_INFO_ONLY;

		Gui::Label *l = (new Gui::Label(_info))->Color(255,255,0);
		m_sbodyInfoTab->Add(l, 35, 300);
		m_selectedBodyPath = SystemPath();

		ShowAll();
		return;
	}

	Gui::Fixed *demographicsTab = new Gui::Fixed();

	m_tabs = new Gui::Tabbed();
	m_tabs->AddPage(new Gui::Label(Lang::PLANETARY_INFO), m_sbodyInfoTab);
	m_tabs->AddPage(new Gui::Label(Lang::DEMOGRAPHICS), demographicsTab);
	Add(m_tabs, 0, 0);

	m_sbodyInfoTab->onMouseButtonEvent.connect(sigc::mem_fun(this, &SystemInfoView::OnClickBackground));

	int majorBodies, starports, onSurface;
	{
		float pos[2] = { 0, 0 };
		float psize = -1;

		majorBodies = starports = onSurface = 0;
		pos[0] = pos[1] = 0;
		psize = -1;
		PutBodies(m_system->GetRootBody().Get(), m_sbodyInfoTab, 1, pos, majorBodies, starports, onSurface, psize);

		majorBodies = starports = onSurface = 0;
		pos[0] = pos[1] = 0;
		psize = -1;
		PutBodies(m_system->GetRootBody().Get(), demographicsTab, 1, pos, majorBodies, starports, onSurface, psize);
	}

	std::string _info = stringf(
		Lang::STABLE_SYSTEM_WITH_N_MAJOR_BODIES_STARPORTS,
		formatarg("bodycount", majorBodies),
		formatarg("body(s)", std::string(majorBodies == 1 ? Lang::BODY : Lang::BODIES)),
		formatarg("portcount", starports),
		formatarg("starport(s)", std::string(starports == 1 ? Lang::STARPORT : Lang::COUNT_STARPORTS)));
	if (starports > 0)
		_info += stringf(Lang::COUNT_ON_SURFACE, formatarg("surfacecount", onSurface));
	_info += ".\n\n";
	_info += m_system->GetLongDescription();

	{
		// astronomical body info tab
		m_infoBox = new Gui::VBox();

		Gui::HBox *scrollBox = new Gui::HBox();
		scrollBox->SetSpacing(5);
		m_sbodyInfoTab->Add(scrollBox, 35, 250);

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

		Gui::Label *l = (new Gui::Label(_info))->Color(255,255,0);
		m_infoBox->PackStart(l);
		portal->Add(m_infoBox);
		scrollBox->PackStart(scroll);
		scrollBox->PackStart(portal);
	}

	{
		Gui::Fixed *col1 = new Gui::Fixed();
		demographicsTab->Add(col1, 200, 300);
		Gui::Fixed *col2 = new Gui::Fixed();
		demographicsTab->Add(col2, 400, 300);

		const float YSEP = Gui::Screen::GetFontHeight() * 1.2f;

		col1->Add((new Gui::Label(Lang::SYSTEM_TYPE))->Color(255,255,0), 0, 0);

		col1->Add((new Gui::Label(Lang::SECTOR_COORDINATES))->Color(255,255,0), 0, 6*YSEP);
		col2->Add(new Gui::Label(stringf("%0{d}, %1{d}, %2{d}", path.sectorX, path.sectorY, path.sectorZ)), 0, 6*YSEP);

		col1->Add((new Gui::Label(Lang::SYSTEM_NUMBER))->Color(255,255,0), 0, 7*YSEP);
		col2->Add(new Gui::Label(stringf("%0", path.systemIndex)), 0, 7*YSEP);
	}

	UpdateIconSelections();
//.........这里部分代码省略.........
开发者ID:starmoth,项目名称:starmoth,代码行数:101,代码来源:SystemInfoView.cpp


示例15: View

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);
		
//.........这里部分代码省略.........
开发者ID:johnuk89,项目名称:pioneer,代码行数:101,代码来源:GameMenuView.cpp



注:本文中的gui::HBox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ gui::Label类代码示例发布时间:2022-05-31
下一篇:
C++ gui::Fixed类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap