Skip to content

Commit

Permalink
UI|Renderer: Moved HUD mirroring option, added "Behavior" subtitle
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 19, 2013
1 parent ae79ff4 commit 8b85191
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 7 deletions.
9 changes: 9 additions & 0 deletions doomsday/client/include/ui/framework/gridlayout.h
Expand Up @@ -48,6 +48,15 @@ class GridLayout
void setGridSize(int numCols, int numRows);
void setModeAndGridSize(Mode mode, int numCols, int numRows);
void setColumnAlignment(int column, ui::Alignment cellAlign);

/**
* Sets the alignment for an individual cell. Overrides column/row alignment.
*
* @param cell Cell position.
* @param cellAlign Alignment for the cell.
*/
void setCellAlignment(de::Vector2i const &cell, ui::Alignment cellAlign);

void setColumnFixedWidth(int column, de::Rule const &fixedWidth);

void setLeftTop(de::Rule const &left, de::Rule const &top);
Expand Down
2 changes: 2 additions & 0 deletions doomsday/client/include/ui/widgets/dialogwidget.h
Expand Up @@ -118,6 +118,8 @@ class DialogWidget : public PopupWidget

ButtonItem(RoleFlags flags, de::Image const &image, de::Action *action);

ButtonItem(RoleFlags flags, de::Image const &image, de::String const &label, de::Action *action);

RoleFlags role() const { return _role; }

private:
Expand Down
16 changes: 10 additions & 6 deletions doomsday/client/src/ui/dialogs/renderersettingsdialog.cpp
Expand Up @@ -37,7 +37,6 @@ DENG_GUI_PIMPL(RendererSettingsDialog)
{
ProfilePickerWidget *appear;
CVarSliderWidget *fov;
CVarToggleWidget *mirrorWeapon;
CVarToggleWidget *precacheModels;
CVarToggleWidget *precacheSprites;
CVarToggleWidget *multiLight;
Expand Down Expand Up @@ -68,7 +67,6 @@ DENG_GUI_PIMPL(RendererSettingsDialog)
fov->setPrecision(0);
fov->setRange(Ranged(30, 160));

area.add(mirrorWeapon = new CVarToggleWidget("rend-model-mirror-hud"));
area.add(precacheModels = new CVarToggleWidget("rend-model-precache"));
area.add(precacheSprites = new CVarToggleWidget("rend-sprite-precache"));
area.add(multiLight = new CVarToggleWidget("rend-light-multitex"));
Expand Down Expand Up @@ -139,8 +137,6 @@ RendererSettingsDialog::RendererSettingsDialog(String const &name)
LabelWidget *appearLabel = LabelWidget::newWithText(tr("Appearance:"), &area());
LabelWidget *fovLabel = LabelWidget::newWithText(tr("Field of View:"), &area());

d->mirrorWeapon->setText(tr("Mirror Player Weapon Model"));

LabelWidget *precacheLabel = LabelWidget::newWithText(tr("Precaching:"), &area());
d->precacheModels->setText(tr("3D Models"));
d->precacheSprites->setText(tr("Sprites"));
Expand Down Expand Up @@ -168,6 +164,9 @@ RendererSettingsDialog::RendererSettingsDialog(String const &name)
d->vertIdx->setText(tr("Vertex Indices"));
d->genIdx->setText(tr("Particle Generator Indices"));

LabelWidget *capLabel = LabelWidget::newWithText(_E(1) + tr("Behavior"), &area());
capLabel->margins().setTop("gap");

// Layout.
GridLayout layout(area().contentRule().left(), area().contentRule().top());
layout.setGridSize(2, 0);
Expand All @@ -177,8 +176,13 @@ RendererSettingsDialog::RendererSettingsDialog(String const &name)
// The profile button must be included in the layout.
layout.append(*d->appear, d->appear->rule().width() + d->appear->button().rule().width());

layout << *fovLabel << *d->fov
<< Const(0) << *d->mirrorWeapon
layout << *fovLabel << *d->fov;

// Label for the tech caps.
layout.setCellAlignment(Vector2i(0, 2), ui::AlignTopLeft);
layout.append(*capLabel, 2);

layout
<< *precacheLabel << *d->precacheModels
<< Const(0) << *d->precacheSprites
<< *multiLabel << *d->multiLight
Expand Down
3 changes: 3 additions & 0 deletions doomsday/client/src/ui/editors/rendererappearanceeditor.cpp
Expand Up @@ -466,6 +466,9 @@ DENG2_OBSERVES(App, GameChange)
modelGroup->addSpace();
modelGroup->addToggle("rend-model-inter", tr("Interpolate Frames"));

modelGroup->addSpace();
modelGroup->addToggle("rend-model-mirror-hud", tr("Mirror Player Weapon"));

modelGroup->addLabel(tr("Max Visible Distance:"));
modelGroup->addSlider("rend-model-distance", Ranged(0, 3000), 10, 0)->setMinLabel(tr("Inf"));

Expand Down
23 changes: 22 additions & 1 deletion doomsday/client/src/ui/framework/gridlayout.cpp
Expand Up @@ -37,6 +37,7 @@ DENG2_PIMPL(GridLayout)
Rule const *fixedCellWidth;
Rule const *fixedCellHeight;
QMap<int, Rule const *> fixedColWidths;
QMap<Vector2i, ui::Alignment> cellAlignment;
Rule const *colPad;
Rule const *rowPad;

Expand Down Expand Up @@ -138,6 +139,8 @@ DENG2_PIMPL(GridLayout)
{
qDeleteAll(cols); cols.clear();
qDeleteAll(rows); rows.clear();

cellAlignment.clear();
}

void setup(int numCols, int numRows)
Expand Down Expand Up @@ -263,6 +266,19 @@ DENG2_PIMPL(GridLayout)
return *rows.at(row)->minEdge;
}

ui::Alignment alignment(Vector2i pos) const
{
if(cellAlignment.contains(pos))
{
return cellAlignment[pos];
}
if(cols.at(pos.x)->cellAlign)
{
return cols.at(pos.x)->cellAlign;
}
return ui::AlignTopLeft;
}

/**
* Begins the next column or row.
*/
Expand Down Expand Up @@ -376,7 +392,7 @@ DENG2_PIMPL(GridLayout)
// the final column/row base widths.
if(mode == ColumnFirst && !fixedCellWidth)
{
if(cols.at(cell.x)->cellAlign & ui::AlignRight)
if(alignment(cell) & ui::AlignRight)
{
widget->rule()
.clearInput(Rule::Left)
Expand Down Expand Up @@ -695,3 +711,8 @@ Rule const &GridLayout::overrideHeight() const
DENG2_ASSERT(d->fixedCellHeight != 0);
return *d->fixedCellHeight;
}

void GridLayout::setCellAlignment(Vector2i const &cell, ui::Alignment cellAlign)
{
d->cellAlignment[cell] = cellAlign;
}
4 changes: 4 additions & 0 deletions doomsday/client/src/ui/widgets/dialogwidget.cpp
Expand Up @@ -622,3 +622,7 @@ DialogWidget::ButtonItem::ButtonItem(RoleFlags flags, String const &label, de::A
DialogWidget::ButtonItem::ButtonItem(RoleFlags flags, Image const &image, de::Action *action)
: ui::ActionItem(image, "", action), _role(flags)
{}

DialogWidget::ButtonItem::ButtonItem(RoleFlags flags, Image const &image, String const &label, de::Action *action)
: ui::ActionItem(image, label, action), _role(flags)
{}

0 comments on commit 8b85191

Please sign in to comment.