File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
FCL/src/main/java/com/tungsten/fcl/control Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,7 @@ public class GameMenu implements MenuCallback, View.OnClickListener {
139139 private TouchController touchController ;
140140
141141 private boolean gamepadDisabled = false ;
142+ private Thread fpsThread ;
142143
143144 public void setMenuView (MenuView menuView ) {
144145 this .menuView = menuView ;
@@ -441,17 +442,23 @@ private void initRightMenu() {
441442 return ;
442443 }
443444 if (isChecked ) {
444- Schedulers . io (). execute (() -> {
445+ fpsThread = new Thread (() -> {
445446 FCLBridge .getFps ();
446- while (showFps .isChecked ()) {
447+ while (showFps .isChecked () && ! Thread . currentThread (). isInterrupted () ) {
447448 Schedulers .androidUIThread ().execute (() -> fpsText .setText ("FPS:" + FCLBridge .getFps ()));
448449 try {
449450 Thread .sleep (1000 );
450451 } catch (InterruptedException ignored ) {
451452 }
452453 }
453454 });
455+ fpsThread .setName ("FCL FPS Thread" );
456+ fpsThread .start ();
454457 } else {
458+ if (fpsThread != null ) {
459+ fpsThread .interrupt ();
460+ fpsThread = null ;
461+ }
455462 fpsText .setText ("" );
456463 }
457464 });
You can’t perform that action at this time.
0 commit comments