27 lines
517 B
C++
27 lines
517 B
C++
|
#pragma once
|
||
|
|
||
|
#include <iostream>
|
||
|
|
||
|
class RubixSimulation {
|
||
|
public:
|
||
|
virtual bool Init() = 0;
|
||
|
virtual void Run() = 0;
|
||
|
};
|
||
|
|
||
|
class RubixSimulationRunner {
|
||
|
public:
|
||
|
void SetSimulation(RubixSimulation *simulation) { sim = simulation; }
|
||
|
void StartSimulation() {
|
||
|
if (sim == nullptr) {
|
||
|
std::cout << "No simulation has been set\n";
|
||
|
return;
|
||
|
}
|
||
|
if (!sim->Init()) {
|
||
|
std::cout << "There was an error creating simulation\n";
|
||
|
}
|
||
|
sim->Run();
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
RubixSimulation *sim = nullptr;
|
||
|
};
|