libscratchcpp
A library for C++ based Scratch project players
Loading...
Searching...
No Matches
script.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2
3#pragma once
4
5#include <vector>
6#include <memory>
7
8#include "global.h"
9#include "spimpl.h"
10
11namespace libscratchcpp
12{
13
14class Target;
15class Block;
16class IEngine;
17class ExecutableCode;
18class Thread;
19class ScriptPrivate;
20
23{
24 public:
26 Script(const Script &) = delete;
27
28 Target *target() const;
29 Block *topBlock() const;
30
31 ExecutableCode *code() const;
32 void setCode(std::shared_ptr<ExecutableCode> code);
33
35 void setHatPredicateCode(std::shared_ptr<ExecutableCode> code);
36
38
39 std::shared_ptr<Thread> start();
40 std::shared_ptr<Thread> start(Target *target);
41
42 private:
43 spimpl::unique_impl_ptr<ScriptPrivate> impl;
44};
45
46} // namespace libscratchcpp
The Block class represents a Scratch block.
Definition block.h:24
The ExecutableCode class represents the code of a compiled Scratch script.
Definition executablecode.h:18
The IEngine interface provides an API for running Scratch projects.
Definition iengine.h:41
void setCode(std::shared_ptr< ExecutableCode > code)
Definition script.cpp:41
Block * topBlock() const
Definition script.cpp:29
void setHatPredicateCode(std::shared_ptr< ExecutableCode > code)
Definition script.cpp:53
Target * target() const
Definition script.cpp:23
bool runHatPredicate(Target *target)
Definition script.cpp:62
Script(Target *target, Block *topBlock, IEngine *engine)
Definition script.cpp:17
std::shared_ptr< Thread > start()
Definition script.cpp:72
ExecutableCode * code() const
Definition script.cpp:35
ExecutableCode * hatPredicateCode() const
Definition script.cpp:47
Script(const Script &)=delete
The Target class is the Stage or a Sprite.
Definition target.h:28
The Thread class represents a running Scratch script.
Definition thread.h:19
#define LIBSCRATCHCPP_EXPORT
Definition global.h:17
The main namespace of the library.
Definition asset.h:10