Skip to content

Commit

Permalink
Clear keyboard buffer before and after the say command.
Browse files Browse the repository at this point in the history
Merge pull request #36 from haroldo-ok/fix-say-keyboard-buffer
This fixes #35
  • Loading branch information
haroldo-ok authored Oct 16, 2022
2 parents 6b9efdd + 89b8a7c commit a5548bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions blockly/apps/blocklyduino/base-project/src/vn_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ void waitJoyButtonRelease() {
while (!(GetJoy(0) & JOY_BTN1));
}

void waitNextButtonRelease() {
#ifdef __LYNX__
waitJoyButtonRelease();
#else
while (kbhit()) cgetc();
#endif
}

void drawScene() {
unsigned char* chunk = 0;

Expand Down Expand Up @@ -225,6 +233,8 @@ void vnText(char *text) {
char *textToDisplay;

for (textToDisplay = text; textToDisplay;) {
waitNextButtonRelease();

bufferClear();
textToDisplay = bufferWrappedText(textToDisplay, 0, 0, MSG_COL_COUNT, MSG_LINE_COUNT);

Expand All @@ -236,6 +246,7 @@ void vnText(char *text) {
waitJoyButtonRelease();
#else
cgetc();
waitNextButtonRelease();
#endif
}
}
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"projects": "./projects"
},
"project": {
"name": "test"
"name": "keyboard-buffer-test"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "BlocklyVN8bit",
"version": "0.2.5",
"version": "0.2.6",
"description": "Uses blockly to generate visual novels for 8bit-Unity",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit a5548bf

Please sign in to comment.