mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 05:00:06 -05:00
Add random Xaos button.
This commit is contained in:
parent
9e94170a70
commit
f51f210d15
@ -215,6 +215,7 @@ public slots:
|
||||
void OnXaosChanged(double d);
|
||||
void OnXaosFromToToggled(bool checked);
|
||||
void OnClearXaosButtonClicked(bool checked);
|
||||
void OnRandomXaosButtonClicked(bool checked);
|
||||
|
||||
//Palette.
|
||||
void OnPaletteAdjust(int d);
|
||||
|
@ -521,8 +521,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>847</height>
|
||||
<width>252</width>
|
||||
<height>852</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@ -2817,8 +2817,8 @@ SpinBox
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>118</width>
|
||||
<height>597</height>
|
||||
<width>238</width>
|
||||
<height>747</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="palette">
|
||||
@ -4371,7 +4371,10 @@ SpinBox
|
||||
<attribute name="title">
|
||||
<string>Xaos</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
@ -4534,6 +4537,12 @@ SpinBox
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="XaosFromToGroupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Direction</string>
|
||||
</property>
|
||||
@ -4543,7 +4552,7 @@ SpinBox
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
@ -4577,14 +4586,28 @@ SpinBox
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ClearXaosButton">
|
||||
<property name="toolTip">
|
||||
<string>Set all xaos values in all xforms to 1</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear Xaos</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="ClearXaosButton">
|
||||
<property name="toolTip">
|
||||
<string>Set all xaos values in all xforms to 1</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear Xaos</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="RandomXaosButton">
|
||||
<property name="toolTip">
|
||||
<string>Randomize all xaos values in all xforms</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Random Xaos</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -4988,8 +5011,8 @@ SpinBox
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<height>684</height>
|
||||
<width>256</width>
|
||||
<height>856</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -5833,7 +5856,6 @@ SpinBox
|
||||
<tabstop>InfoRenderingTextEdit</tabstop>
|
||||
<tabstop>PreAffineGroupBox</tabstop>
|
||||
<tabstop>scrollArea_4</tabstop>
|
||||
<tabstop>ClearXaosButton</tabstop>
|
||||
<tabstop>InfoBoundsGroupBox</tabstop>
|
||||
<tabstop>XaosFromRadio</tabstop>
|
||||
<tabstop>XaosToRadio</tabstop>
|
||||
|
@ -166,6 +166,7 @@ public:
|
||||
virtual QString MakeXaosNameString(unsigned int i) { return ""; }
|
||||
virtual void XaosChanged(DoubleSpinBox* sender) { }
|
||||
virtual void ClearXaos() { }
|
||||
virtual void RandomXaos() { }
|
||||
|
||||
//Palette.
|
||||
virtual bool InitPaletteTable(const string& s) { return false; }
|
||||
@ -384,6 +385,7 @@ public:
|
||||
virtual QString MakeXaosNameString(unsigned int i) override;
|
||||
virtual void XaosChanged(DoubleSpinBox* sender) override;
|
||||
virtual void ClearXaos() override;
|
||||
virtual void RandomXaos() override;
|
||||
|
||||
//Palette.
|
||||
virtual bool InitPaletteTable(const string& s) override;
|
||||
|
@ -8,6 +8,7 @@ void Fractorium::InitXformsXaosUI()
|
||||
{
|
||||
connect(ui.XaosToRadio, SIGNAL(toggled(bool)), this, SLOT(OnXaosFromToToggled(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ClearXaosButton, SIGNAL(clicked(bool)), this, SLOT(OnClearXaosButtonClicked(bool)), Qt::QueuedConnection);
|
||||
connect(ui.RandomXaosButton, SIGNAL(clicked(bool)), this, SLOT(OnRandomXaosButtonClicked(bool)), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -160,6 +161,7 @@ void Fractorium::FillXaosTable()
|
||||
w = SetTabOrder(this, w, ui.XaosToRadio);
|
||||
w = SetTabOrder(this, w, ui.XaosFromRadio);
|
||||
w = SetTabOrder(this, w, ui.ClearXaosButton);
|
||||
w = SetTabOrder(this, w, ui.RandomXaosButton);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -181,4 +183,36 @@ void FractoriumEmberController<T>::ClearXaos()
|
||||
spinBox->SetValueStealth(1.0);
|
||||
}
|
||||
|
||||
void Fractorium::OnClearXaosButtonClicked(bool checked) { m_Controller->ClearXaos(); }
|
||||
void Fractorium::OnClearXaosButtonClicked(bool checked) { m_Controller->ClearXaos(); }
|
||||
|
||||
/// <summary>
|
||||
/// Set all xaos values to random numbers.
|
||||
/// There is a 50% chance they're set to 0 or 1, and
|
||||
/// 50% that they're 0-3.
|
||||
/// </summary>
|
||||
/// <param name="checked">Ignored</param>
|
||||
template <typename T>
|
||||
void FractoriumEmberController<T>::RandomXaos()
|
||||
{
|
||||
UpdateCurrentXform([&](Xform<T>* xform)
|
||||
{
|
||||
for (size_t i = 0; i < m_Ember.XformCount(); i++)
|
||||
{
|
||||
if (Xform<T>* xform = m_Ember.GetXform(i))
|
||||
{
|
||||
for (size_t j = 0; j < m_Ember.XformCount(); j++)
|
||||
{
|
||||
if (m_Rand.RandBit())
|
||||
xform->SetXaos(j, (T)m_Rand.RandBit());
|
||||
else
|
||||
xform->SetXaos(j, m_Rand.Frand<T>(0, 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//If current is final, it will update when they change to a non-final xform.
|
||||
FillXaosWithCurrentXform();
|
||||
}
|
||||
|
||||
void Fractorium::OnRandomXaosButtonClicked(bool checked) { m_Controller->RandomXaos(); }
|
@ -34,10 +34,6 @@ FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, Q
|
||||
m_NickEdit = new QLineEdit(ui.OptionsIdentityTable);
|
||||
ui.OptionsIdentityTable->setCellWidget(2, 1, m_NickEdit);
|
||||
|
||||
//QWidget::setTabOrder(m_IdEdit, m_UrlEdit);
|
||||
//QWidget::setTabOrder(m_UrlEdit, m_NickEdit);
|
||||
//QWidget::setTabOrder(m_NickEdit, m_IdEdit);
|
||||
|
||||
m_IdEdit->setText(m_Settings->Id());
|
||||
m_UrlEdit->setText(m_Settings->Url());
|
||||
m_NickEdit->setText(m_Settings->Nick());
|
||||
|
Loading…
Reference in New Issue
Block a user