libscratchcpp
A library for C++ based Scratch project players
Loading...
Searching...
No Matches
libscratchcpp::Thread Class Reference

The Thread class represents a running Scratch script. More...

#include <scratchcpp/thread.h>

Public Member Functions

 Thread (Target *target, IEngine *engine, Script *script)
 
 Thread (const Thread &)=delete
 
Targettarget () const
 
IEngineengine () const
 
Scriptscript () const
 
void run ()
 
ValueData runReporter ()
 
bool runPredicate ()
 
void kill ()
 
void reset ()
 
bool isFinished () const
 
std::shared_ptr< Promisepromise () const
 
void setPromise (std::shared_ptr< Promise > promise)
 

Detailed Description

The Thread class represents a running Scratch script.

Constructor & Destructor Documentation

◆ Thread() [1/2]

Thread::Thread ( Target * target,
IEngine * engine,
Script * script )

Constructs Thread.

◆ Thread() [2/2]

libscratchcpp::Thread::Thread ( const Thread & )
delete

Member Function Documentation

◆ engine()

IEngine * Thread::engine ( ) const

Returns the engine of the project.

◆ isFinished()

bool Thread::isFinished ( ) const

Returns true if the script is stopped or finished.

◆ kill()

void Thread::kill ( )

Stops the script.

◆ promise()

std::shared_ptr< Promise > Thread::promise ( ) const

Returns the script promise.

◆ reset()

void Thread::reset ( )

Resets the script to run from the start.

◆ run()

void Thread::run ( )

Runs the script until it finishes or yields.

◆ runPredicate()

bool Thread::runPredicate ( )

Runs the hat predicate and returns its return value.

◆ runReporter()

ValueData Thread::runReporter ( )

Runs the reporter and returns its return value.

◆ script()

Script * Thread::script ( ) const

Returns the Script.

◆ setPromise()

void Thread::setPromise ( std::shared_ptr< Promise > promise)

Sets the script promise (yields until the promise is resolved).

◆ target()

Target * Thread::target ( ) const

Returns the Target of the script.


The documentation for this class was generated from the following files: