qol
This commit is contained in:
parent
43c8fb2cce
commit
42737c0a66
5 changed files with 107 additions and 18 deletions
|
|
@ -4,11 +4,14 @@
|
|||
#include <QObject>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
|
||||
class Machine;
|
||||
|
||||
class MachineController : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MachineController(QObject *parent = nullptr);
|
||||
explicit MachineController(std::shared_ptr<Machine> machine = nullptr, QObject *parent = nullptr);
|
||||
~MachineController() override;
|
||||
|
||||
void start();
|
||||
|
|
@ -17,11 +20,13 @@ public:
|
|||
|
||||
signals:
|
||||
void tick();
|
||||
void error(const QString &msg);
|
||||
|
||||
private:
|
||||
void runLoop();
|
||||
std::atomic<bool> m_running{false};
|
||||
std::thread m_thread;
|
||||
std::shared_ptr<Machine> m_machine;
|
||||
};
|
||||
|
||||
#endif // MACHINECONTROLLER_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue