mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-02-01 10:30:08 -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 OnXaosChanged(double d);
|
||||||
void OnXaosFromToToggled(bool checked);
|
void OnXaosFromToToggled(bool checked);
|
||||||
void OnClearXaosButtonClicked(bool checked);
|
void OnClearXaosButtonClicked(bool checked);
|
||||||
|
void OnRandomXaosButtonClicked(bool checked);
|
||||||
|
|
||||||
//Palette.
|
//Palette.
|
||||||
void OnPaletteAdjust(int d);
|
void OnPaletteAdjust(int d);
|
||||||
|
@ -521,8 +521,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>98</width>
|
<width>252</width>
|
||||||
<height>847</height>
|
<height>852</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
@ -2817,8 +2817,8 @@ SpinBox
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>118</width>
|
<width>238</width>
|
||||||
<height>597</height>
|
<height>747</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="palette">
|
<property name="palette">
|
||||||
@ -4371,7 +4371,10 @@ SpinBox
|
|||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Xaos</string>
|
<string>Xaos</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
@ -4534,6 +4537,12 @@ SpinBox
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="XaosFromToGroupBox">
|
<widget class="QGroupBox" name="XaosFromToGroupBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Direction</string>
|
<string>Direction</string>
|
||||||
</property>
|
</property>
|
||||||
@ -4543,7 +4552,7 @@ SpinBox
|
|||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
@ -4577,14 +4586,28 @@ SpinBox
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="ClearXaosButton">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="toolTip">
|
<item>
|
||||||
<string>Set all xaos values in all xforms to 1</string>
|
<widget class="QPushButton" name="ClearXaosButton">
|
||||||
</property>
|
<property name="toolTip">
|
||||||
<property name="text">
|
<string>Set all xaos values in all xforms to 1</string>
|
||||||
<string>Clear Xaos</string>
|
</property>
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<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>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -4988,8 +5011,8 @@ SpinBox
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>105</width>
|
<width>256</width>
|
||||||
<height>684</height>
|
<height>856</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -5833,7 +5856,6 @@ SpinBox
|
|||||||
<tabstop>InfoRenderingTextEdit</tabstop>
|
<tabstop>InfoRenderingTextEdit</tabstop>
|
||||||
<tabstop>PreAffineGroupBox</tabstop>
|
<tabstop>PreAffineGroupBox</tabstop>
|
||||||
<tabstop>scrollArea_4</tabstop>
|
<tabstop>scrollArea_4</tabstop>
|
||||||
<tabstop>ClearXaosButton</tabstop>
|
|
||||||
<tabstop>InfoBoundsGroupBox</tabstop>
|
<tabstop>InfoBoundsGroupBox</tabstop>
|
||||||
<tabstop>XaosFromRadio</tabstop>
|
<tabstop>XaosFromRadio</tabstop>
|
||||||
<tabstop>XaosToRadio</tabstop>
|
<tabstop>XaosToRadio</tabstop>
|
||||||
|
@ -166,6 +166,7 @@ public:
|
|||||||
virtual QString MakeXaosNameString(unsigned int i) { return ""; }
|
virtual QString MakeXaosNameString(unsigned int i) { return ""; }
|
||||||
virtual void XaosChanged(DoubleSpinBox* sender) { }
|
virtual void XaosChanged(DoubleSpinBox* sender) { }
|
||||||
virtual void ClearXaos() { }
|
virtual void ClearXaos() { }
|
||||||
|
virtual void RandomXaos() { }
|
||||||
|
|
||||||
//Palette.
|
//Palette.
|
||||||
virtual bool InitPaletteTable(const string& s) { return false; }
|
virtual bool InitPaletteTable(const string& s) { return false; }
|
||||||
@ -384,6 +385,7 @@ public:
|
|||||||
virtual QString MakeXaosNameString(unsigned int i) override;
|
virtual QString MakeXaosNameString(unsigned int i) override;
|
||||||
virtual void XaosChanged(DoubleSpinBox* sender) override;
|
virtual void XaosChanged(DoubleSpinBox* sender) override;
|
||||||
virtual void ClearXaos() override;
|
virtual void ClearXaos() override;
|
||||||
|
virtual void RandomXaos() override;
|
||||||
|
|
||||||
//Palette.
|
//Palette.
|
||||||
virtual bool InitPaletteTable(const string& s) override;
|
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.XaosToRadio, SIGNAL(toggled(bool)), this, SLOT(OnXaosFromToToggled(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.ClearXaosButton, SIGNAL(clicked(bool)), this, SLOT(OnClearXaosButtonClicked(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>
|
/// <summary>
|
||||||
@ -160,6 +161,7 @@ void Fractorium::FillXaosTable()
|
|||||||
w = SetTabOrder(this, w, ui.XaosToRadio);
|
w = SetTabOrder(this, w, ui.XaosToRadio);
|
||||||
w = SetTabOrder(this, w, ui.XaosFromRadio);
|
w = SetTabOrder(this, w, ui.XaosFromRadio);
|
||||||
w = SetTabOrder(this, w, ui.ClearXaosButton);
|
w = SetTabOrder(this, w, ui.ClearXaosButton);
|
||||||
|
w = SetTabOrder(this, w, ui.RandomXaosButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -181,4 +183,36 @@ void FractoriumEmberController<T>::ClearXaos()
|
|||||||
spinBox->SetValueStealth(1.0);
|
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);
|
m_NickEdit = new QLineEdit(ui.OptionsIdentityTable);
|
||||||
ui.OptionsIdentityTable->setCellWidget(2, 1, m_NickEdit);
|
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_IdEdit->setText(m_Settings->Id());
|
||||||
m_UrlEdit->setText(m_Settings->Url());
|
m_UrlEdit->setText(m_Settings->Url());
|
||||||
m_NickEdit->setText(m_Settings->Nick());
|
m_NickEdit->setText(m_Settings->Nick());
|
||||||
|
Loading…
Reference in New Issue
Block a user