|
8 | 8 | #include <functional> |
9 | 9 |
|
10 | 10 | #include "global.h" |
| 11 | +#include "signal.h" |
11 | 12 |
|
12 | 13 | namespace libscratchcpp |
13 | 14 | { |
@@ -109,8 +110,11 @@ class LIBSCRATCHCPP_EXPORT IEngine |
109 | 110 | /*! Stops the event loop which is running in another thread. */ |
110 | 111 | virtual void stopEventLoop() = 0; |
111 | 112 |
|
112 | | - /*! Sets the function which is called on every frame. */ |
113 | | - virtual void setRedrawHandler(const std::function<void()> &handler) = 0; |
| 113 | + /*! Emits when rendering should occur. */ |
| 114 | + virtual sigslot::signal<> &aboutToRender() = 0; |
| 115 | + |
| 116 | + /*! Emits when a script is about to stop. */ |
| 117 | + virtual sigslot::signal<VirtualMachine *> &threadAboutToStop() = 0; |
114 | 118 |
|
115 | 119 | /*! Returns true if the project is currently running. */ |
116 | 120 | virtual bool isRunning() const = 0; |
@@ -345,23 +349,17 @@ class LIBSCRATCHCPP_EXPORT IEngine |
345 | 349 | /*! Sets the list of monitors. */ |
346 | 350 | virtual void setMonitors(const std::vector<std::shared_ptr<Monitor>> &newMonitors) = 0; |
347 | 351 |
|
348 | | - /*! Sets the function which is called when a monitor is added. */ |
349 | | - virtual void setAddMonitorHandler(const std::function<void(Monitor *)> &handler) = 0; |
350 | | - |
351 | | - /*! Sets the function which is called when a monitor is removed. */ |
352 | | - virtual void setRemoveMonitorHandler(const std::function<void(Monitor *, IMonitorHandler *)> &handler) = 0; |
353 | | - |
354 | | - /*! Returns the function which is called when a question is asked, for example using the 'ask and wait' block. */ |
355 | | - virtual const std::function<void(const std::string &)> &questionAsked() const = 0; |
| 352 | + /*! Emits when a monitor is added. */ |
| 353 | + virtual sigslot::signal<Monitor *> &monitorAdded() = 0; |
356 | 354 |
|
357 | | - /*! Sets the function which is called when a question is asked, for example using the 'ask and wait' block. */ |
358 | | - virtual void setQuestionAsked(const std::function<void(const std::string &)> &f) = 0; |
| 355 | + /*! Emits when a monitor is removed. */ |
| 356 | + virtual sigslot::signal<Monitor *, IMonitorHandler *> &monitorRemoved() = 0; |
359 | 357 |
|
360 | | - /*! Returns the function which should be called when a question is answered. */ |
361 | | - virtual const std::function<void(const std::string &)> &questionAnswered() const = 0; |
| 358 | + /*! Emits when a question is asked, for example using the 'ask and wait' block. */ |
| 359 | + virtual sigslot::signal<const std::string &> &questionAsked() = 0; |
362 | 360 |
|
363 | | - /*! Sets the function which should be called when a question is answered. */ |
364 | | - virtual void setQuestionAnswered(const std::function<void(const std::string &)> &f) = 0; |
| 361 | + /*! Emits when a question is answered. */ |
| 362 | + virtual sigslot::signal<const std::string &> &questionAnswered() = 0; |
365 | 363 |
|
366 | 364 | /*! Returns the list of extension names. */ |
367 | 365 | virtual const std::vector<std::string> &extensions() const = 0; |
|
0 commit comments