Skip to content

Commit 0413de0

Browse files
authored
Checking the Box (scratch-vm)
Adds checkboxes to NitroBolt, and makes it built into all boolean inputs. (VM side)
2 parents 510adce + 23c7270 commit 0413de0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/blocks/scratch3_operators.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ class Scratch3OperatorsBlocks {
3333
operator_contains: this.contains,
3434
operator_mod: this.mod,
3535
operator_round: this.round,
36-
operator_mathop: this.mathop
36+
operator_mathop: this.mathop,
37+
checkbox: this.checkbox
3738
};
3839
}
3940

41+
checkbox () {
42+
return true;
43+
}
44+
4045
add (args) {
4146
return Cast.toNumber(args.NUM1) + Cast.toNumber(args.NUM2);
4247
}

src/compiler/irgen.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ class ScriptTreeGenerator {
177177
kind: 'constant',
178178
value: block.fields.TEXT.value
179179
};
180+
case 'checkbox':
181+
return {
182+
kind: 'constant',
183+
value: true
184+
};
180185

181186
case 'argument_reporter_string_number': {
182187
const name = block.fields.VALUE.value;

0 commit comments

Comments
 (0)