libscratchcpp
A library for C++ based Scratch project players
Loading...
Searching...
No Matches
thread.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
3#pragma once
4
5#include "valuedata.h"
6#include "spimpl.h"
7
8namespace libscratchcpp
9{
10
11class Target;
12class Promise;
13class IEngine;
14class Script;
15class ThreadPrivate;
16
19{
20 public:
22 Thread(const Thread &) = delete;
23
24 Target *target() const;
25 IEngine *engine() const;
26 Script *script() const;
27
28 void run();
30 bool runPredicate();
31 void kill();
32 void reset();
33
34 bool isFinished() const;
35
36 std::shared_ptr<Promise> promise() const;
37 void setPromise(std::shared_ptr<Promise> promise);
38
39 private:
40 spimpl::unique_impl_ptr<ThreadPrivate> impl;
41};
42
43} // namespace libscratchcpp
The IEngine interface provides an API for running Scratch projects.
Definition iengine.h:41
The Promise class represents the eventual completion of an asynchronous operation.
Definition promise.h:15
The Script class represents a compiled Scratch script.
Definition script.h:23
The Target class is the Stage or a Sprite.
Definition target.h:28
IEngine * engine() const
Definition thread.cpp:35
void reset()
Definition thread.cpp:76
Script * script() const
Definition thread.cpp:41
Thread(const Thread &)=delete
bool isFinished() const
Definition thread.cpp:82
Thread(Target *target, IEngine *engine, Script *script)
Definition thread.cpp:13
bool runPredicate()
Definition thread.cpp:60
std::shared_ptr< Promise > promise() const
Definition thread.cpp:88
ValueData runReporter()
Definition thread.cpp:53
void kill()
Definition thread.cpp:70
void run()
Definition thread.cpp:47
Target * target() const
Definition thread.cpp:29
void setPromise(std::shared_ptr< Promise > promise)
Definition thread.cpp:94
#define LIBSCRATCHCPP_EXPORT
Definition global.h:17
The main namespace of the library.
Definition asset.h:10
The ValueData struct holds the data of Value. It's used in compiled Scratch code for better performan...
Definition valuedata.h:26