Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] How to Pause and resume the tree? #743

Open
HBing110 opened this issue Jan 15, 2024 · 3 comments
Open

[4.x] How to Pause and resume the tree? #743

HBing110 opened this issue Jan 15, 2024 · 3 comments

Comments

@HBing110
Copy link

What is the best way to implement pause and resume the tree in the 4.x version of the program? Can you provide an example,thx

@jdemir
Copy link

jdemir commented Jan 16, 2024

You are planning to pause/resume the tree from a higher level application, right? Why not creating a State Machine in higher level so you just tick the tree on Running state, while in Pause you will wait the user to click/request Start/Continue again.

@HBing110
Copy link
Author

You are planning to pause/resume the tree from a higher level application, right? Why not creating a State Machine in higher level so you just tick the tree on Running state, while in Pause you will wait the user to click/request Start/Continue again.

Sorry, I still didn't understand what you meant. Can you give a simple example?Thank you very much

@jdemir
Copy link

jdemir commented May 13, 2024

so, the tree has the following method called tickOnce, let's the user to tick the tree only once when they want to. So, if you create an object that has the tree as a member variable and it has a run or update method so it can run synchronously (every X ms), you can double check within that run method whether anyone requested any Pause or Resume and tick the tree the accordingly. Roughly,

Update() {

if(userRequestedPause()){
    pause();
} else{
    tree.tickOnce();
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants