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

Add reset button (Incomplete, work needed) #8589

Closed
wants to merge 4 commits into from

Conversation

An0n3m0us
Copy link
Contributor

@An0n3m0us An0n3m0us commented Jun 10, 2019

Ref: #8064
Adds a reset button for the keys.
keys

Here's the process:

  1. Mess up the keys.
  2. Press the reset button (menu quits)
  3. Open "Change Keys" and they are all already reset.

There are a few problems. It's my first time programming in C++ so some parts of the code are incorrect.

  1. The keys text needs to update when the reset button is pressed instead of having to quitMenu();
  2. Currently, the keys are reset to an array that I created in the loop (see line 290), instead of getting the list of keys from the settings script or elsewhere. The array isn't initialized properly either.
  3. I copied acceptInput() and used it as a template, but some of the code might not be needed.

Tasks:

  • Make buttons reset correctly.
  • Make GUI automatically update when reset button is pressed
  • Create an "Are you sure?" popup or double click to make sure.
  • Fix Segmentation fault (core dumped) error.

@@ -377,6 +416,10 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
case GUI_ID_ABORT_BUTTON: //abort
quitMenu();
return true;
case GUI_ID_RESET_BUTTON: //reset
resetInput();
quitMenu();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of quitting the menu, it needs to be updated somehow.

@paramat paramat added @ Client / Controls / Input Feature ✨ PRs that add or enhance a feature labels Jun 10, 2019
@paramat
Copy link
Contributor

paramat commented Jun 10, 2019

Why is this needed? Keybindings are changed occasionally one by one as required.

@An0n3m0us
Copy link
Contributor Author

In the case of someone wanting to reset them all, they don't have to delete minetest.conf.

@paramat paramat added the WIP label Jun 10, 2019
@paramat
Copy link
Contributor

paramat commented Jun 10, 2019

Ok, but why would they want to reset them all? This would be very rarely needed as players do not suddenly revert their controls to default one day. Changing controls is done one by one gradually.

@An0n3m0us
Copy link
Contributor Author

An0n3m0us commented Jun 10, 2019

True.
What about instead having a reset key for each key (or a button to reset each key)? Like escape or backspace?

Something or some way is needed to reset the keys other than deleting minetest.conf.

@SmallJoker
Copy link
Member

SmallJoker commented Jun 10, 2019

What about instead having a reset key for each key

Partially related: #8282 uses the keys to clear the contents.

@An0n3m0us
Copy link
Contributor Author

An0n3m0us commented Jun 10, 2019

Oh, oops I didn't come across that.
Is there a need to reset all the buttons at once? Personally, I think it wouldn't do any harm to have one anyway. It might be used rarely, but I'm sure it will still be used.

@Desour
Copy link
Member

Desour commented Jun 10, 2019

The reset all button could be pressed on accident, which might be very annoying.

@An0n3m0us
Copy link
Contributor Author

@DS-Minetest That's why it might need an "Are you sure" popup like I mentioned above.

@An0n3m0us
Copy link
Contributor Author

An0n3m0us commented Jun 30, 2019

Done! Everything seems to work fine now.
EDIT: Segmentation fault can still be triggered by pressing the button once then pressing cancel.

@paramat paramat added the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Dec 7, 2019
@paramat
Copy link
Contributor

paramat commented Dec 12, 2019

No progress for 6 months and seems mostly unnecessary.

@paramat paramat closed this Dec 12, 2019
@An0n3m0us An0n3m0us deleted the resetKeys branch December 12, 2019 08:10
@An0n3m0us An0n3m0us restored the resetKeys branch February 9, 2020 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Action / change needed Code still needs changes (PR) / more information requested (Issues) @ Client / Controls / Input Feature ✨ PRs that add or enhance a feature Possible close
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants