libscratchcpp
A library for C++ based Scratch project players
Toggle main menu visibility
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
11
namespace
libscratchcpp
12
{
13
14
class
Target
;
15
class
Block
;
16
class
IEngine
;
17
class
ExecutableCode
;
18
class
Thread
;
19
class
ScriptPrivate;
20
22
class
LIBSCRATCHCPP_EXPORT
Script
23
{
24
public
:
25
Script
(
Target
*
target
,
Block
*
topBlock
,
IEngine
*engine);
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
34
ExecutableCode
*
hatPredicateCode
()
const
;
35
void
setHatPredicateCode
(std::shared_ptr<ExecutableCode>
code
);
36
37
bool
runHatPredicate
(
Target
*
target
);
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
libscratchcpp::Block
The Block class represents a Scratch block.
Definition
block.h:24
libscratchcpp::ExecutableCode
The ExecutableCode class represents the code of a compiled Scratch script.
Definition
executablecode.h:18
libscratchcpp::IEngine
The IEngine interface provides an API for running Scratch projects.
Definition
iengine.h:41
libscratchcpp::Script::setCode
void setCode(std::shared_ptr< ExecutableCode > code)
Definition
script.cpp:41
libscratchcpp::Script::topBlock
Block * topBlock() const
Definition
script.cpp:29
libscratchcpp::Script::setHatPredicateCode
void setHatPredicateCode(std::shared_ptr< ExecutableCode > code)
Definition
script.cpp:53
libscratchcpp::Script::target
Target * target() const
Definition
script.cpp:23
libscratchcpp::Script::runHatPredicate
bool runHatPredicate(Target *target)
Definition
script.cpp:62
libscratchcpp::Script::Script
Script(Target *target, Block *topBlock, IEngine *engine)
Definition
script.cpp:17
libscratchcpp::Script::start
std::shared_ptr< Thread > start()
Definition
script.cpp:72
libscratchcpp::Script::code
ExecutableCode * code() const
Definition
script.cpp:35
libscratchcpp::Script::hatPredicateCode
ExecutableCode * hatPredicateCode() const
Definition
script.cpp:47
libscratchcpp::Script::Script
Script(const Script &)=delete
libscratchcpp::Target
The Target class is the Stage or a Sprite.
Definition
target.h:28
libscratchcpp::Thread
The Thread class represents a running Scratch script.
Definition
thread.h:19
global.h
LIBSCRATCHCPP_EXPORT
#define LIBSCRATCHCPP_EXPORT
Definition
global.h:17
libscratchcpp
The main namespace of the library.
Definition
asset.h:10
include
scratchcpp
script.h
Generated by
1.17.0