Finished Planet editing GUI
This commit is contained in:
parent
6248f70bb7
commit
526ab00c33
8 changed files with 163 additions and 66 deletions
|
@ -31,8 +31,9 @@ void MainWindow::OpenPlanetDialog(Planet* planet)
|
|||
activePlanet = nullptr;
|
||||
|
||||
ui.config->Enable();
|
||||
ui.config->SetTitle("Planets don't have names yet");
|
||||
ui.config->SetTitle(planet->name);
|
||||
ui.config->SetRadius(planet->radius);
|
||||
ui.config->SetColor(planet->GetColor());
|
||||
ui.config->SetX(planet->position.rx());
|
||||
ui.config->SetY(planet->position.ry());
|
||||
|
||||
|
@ -45,17 +46,30 @@ void MainWindow::ClosePlanetDialog()
|
|||
|
||||
ui.config->SetTitle("No planet selected");
|
||||
ui.config->Disable();
|
||||
ui.config->SetColor(QColor(0, 0, 0, 0));
|
||||
ui.config->SetRadius(0.f);
|
||||
ui.config->SetX(0.f);
|
||||
ui.config->SetY(0.f);
|
||||
}
|
||||
|
||||
void MainWindow::OnNameChanged(const QString& name)
|
||||
{
|
||||
if (activePlanet != nullptr)
|
||||
activePlanet->name = name;
|
||||
}
|
||||
|
||||
void MainWindow::OnRadiusChanged(double radius)
|
||||
{
|
||||
if(activePlanet != nullptr)
|
||||
activePlanet->radius = radius;
|
||||
}
|
||||
|
||||
void MainWindow::OnColourChanged(const QColor& color)
|
||||
{
|
||||
if (activePlanet != nullptr)
|
||||
activePlanet->SetColor(color);
|
||||
}
|
||||
|
||||
void MainWindow::OnXChanged(double x)
|
||||
{
|
||||
if (activePlanet != nullptr)
|
||||
|
@ -67,3 +81,9 @@ void MainWindow::OnYChanged(double y)
|
|||
if (activePlanet != nullptr)
|
||||
activePlanet->position.ry() = y;
|
||||
}
|
||||
|
||||
void MainWindow::OnToggle()
|
||||
{
|
||||
isSimulating = !isSimulating;
|
||||
ui.config->SetButtonLabel((isSimulating) ? "Stop Simulation" : "Start Simulation");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue