Added gravitation
This commit is contained in:
parent
61afefa6b5
commit
64419997dd
12 changed files with 294 additions and 51 deletions
|
@ -33,6 +33,7 @@ void MainWindow::OpenPlanetDialog(Planet* planet)
|
|||
ui.config->Enable();
|
||||
ui.config->SetTitle(planet->name);
|
||||
ui.config->SetRadius(planet->radius);
|
||||
ui.config->SetMass(planet->mass);
|
||||
ui.config->SetColor(planet->GetColor());
|
||||
ui.config->SetX(planet->position.rx());
|
||||
ui.config->SetY(planet->position.ry());
|
||||
|
@ -48,10 +49,17 @@ void MainWindow::ClosePlanetDialog()
|
|||
ui.config->Disable();
|
||||
ui.config->SetColor(QColor(0, 0, 0, 0));
|
||||
ui.config->SetRadius(0.f);
|
||||
ui.config->SetMass(0.f);
|
||||
ui.config->SetX(0.f);
|
||||
ui.config->SetY(0.f);
|
||||
}
|
||||
|
||||
void MainWindow::UpdatePlanetPositionInDialog(const QPointF& position)
|
||||
{
|
||||
ui.config->SetX(position.x());
|
||||
ui.config->SetY(position.y());
|
||||
}
|
||||
|
||||
void MainWindow::OnNameChanged(const QString& name)
|
||||
{
|
||||
if (activePlanet != nullptr)
|
||||
|
@ -64,6 +72,12 @@ void MainWindow::OnRadiusChanged(double radius)
|
|||
activePlanet->radius = radius;
|
||||
}
|
||||
|
||||
void MainWindow::OnMassChanged(double mass)
|
||||
{
|
||||
if (activePlanet != nullptr)
|
||||
activePlanet->mass = mass;
|
||||
}
|
||||
|
||||
void MainWindow::OnColourChanged(const QColor& color)
|
||||
{
|
||||
if (activePlanet != nullptr)
|
||||
|
@ -92,4 +106,5 @@ void MainWindow::OnToggle()
|
|||
{
|
||||
isSimulating = !isSimulating;
|
||||
ui.config->SetButtonLabel((isSimulating) ? "Stop Simulation" : "Start Simulation");
|
||||
ui.screen->simulate = isSimulating;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue