blueloveTH 3 лет назад
Родитель
Сommit
fcdff94be3

+ 1 - 1
plugins/flutter/CHANGELOG.md

@@ -1,4 +1,4 @@
-## 0.6.0+3
+## 0.6.0+4
 
 + Break change
 

+ 2 - 1
plugins/flutter/example/lib/main.dart

@@ -50,7 +50,8 @@ class _MyAppState extends State<MyApp> {
       buffer.write(needMoreLines ? '... $text' : '>>> $text\n');
     });
     if (text == "exit()") exit(0);
-    needMoreLines = repl.input(text) == 0;
+    repl.input(text);
+    needMoreLines = repl.last_input_result() == 0;
     refresh();
   }
 

+ 1 - 1
plugins/flutter/pubspec.yaml

@@ -1,6 +1,6 @@
 name: pocketpy
 description: A lightweight Python interpreter for game engines.
-version: 0.6.0+3
+version: 0.6.0+4
 homepage: https://pocketpy.dev
 repository: https://github.com/blueloveth/pocketpy
 

+ 11 - 5
plugins/flutter/src/pocketpy.h

@@ -4278,13 +4278,12 @@ public:
 
     void sleepForSecs(_Float sec){
         _Int ms = (_Int)(sec * 1000);
-        const _Int step = 20;
-        for(_Int i=0; i<ms; i+=step){
+        for(_Int i=0; i<ms; i+=20){
             _checkStopFlag();
 #ifdef __EMSCRIPTEN__
-            emscripten_sleep(step);
+            emscripten_sleep(20);
 #else
-            std::this_thread::sleep_for(std::chrono::milliseconds(step));
+            std::this_thread::sleep_for(std::chrono::milliseconds(20));
 #endif
         }
     }
@@ -5026,7 +5025,14 @@ public:
     void suspend(){
         if(_state != THREAD_RUNNING) UNREACHABLE();
         _state = THREAD_SUSPENDED;
-        while(_state == THREAD_SUSPENDED) _checkStopFlag();
+        while(_state == THREAD_SUSPENDED){
+            _checkStopFlag();
+#ifdef __EMSCRIPTEN__
+            emscripten_sleep(20);
+#else
+            std::this_thread::sleep_for(std::chrono::milliseconds(20));
+#endif
+        }
     }
 
     _Str readJsonRpcRequest(){

+ 1 - 1
plugins/godot/godot-cpp

@@ -1 +1 @@
-Subproject commit ac067d7f1f84cb757db20ffb3c929d880053c6c1
+Subproject commit ed849abe8ed709eb7e378d39f4b8709e4ff9667f

+ 11 - 5
src/vm.h

@@ -378,13 +378,12 @@ public:
 
     void sleepForSecs(_Float sec){
         _Int ms = (_Int)(sec * 1000);
-        const _Int step = 20;
-        for(_Int i=0; i<ms; i+=step){
+        for(_Int i=0; i<ms; i+=20){
             _checkStopFlag();
 #ifdef __EMSCRIPTEN__
-            emscripten_sleep(step);
+            emscripten_sleep(20);
 #else
-            std::this_thread::sleep_for(std::chrono::milliseconds(step));
+            std::this_thread::sleep_for(std::chrono::milliseconds(20));
 #endif
         }
     }
@@ -1126,7 +1125,14 @@ public:
     void suspend(){
         if(_state != THREAD_RUNNING) UNREACHABLE();
         _state = THREAD_SUSPENDED;
-        while(_state == THREAD_SUSPENDED) _checkStopFlag();
+        while(_state == THREAD_SUSPENDED){
+            _checkStopFlag();
+#ifdef __EMSCRIPTEN__
+            emscripten_sleep(20);
+#else
+            std::this_thread::sleep_for(std::chrono::milliseconds(20));
+#endif
+        }
     }
 
     _Str readJsonRpcRequest(){