Two questions about gb.gui.menu()

General

Party_Pete

5 years ago

Hello! I had a couple of questions about the stock menu function.

1. Is there a way to put a variable in the title or option slots? Say I had a integer, char, or other numerical variable for Energy, and I wanted to display the number of Energy I have somewhere in the list. Could I even concatenate it to a char array to say "Current Energy: <energy>"?

2. From my game's title screen, pressing button A takes you to the primary menu. However, this press is counted by both the title screen and the menu, causing the first menu option to be picked on accident when all you wanted to do was advance past the title. Is there a way to prevent this sort of accident from occurring, short of mapping the title-to-menu key to another button?

Any help would be appreciated, and thank you in advance!

Sorunome

NEW 5 years ago

1. Is there a way to put a variable in the title or option slots? Say I had a integer, char, or other numerical variable for Energy, and I wanted to display the number of Energy I have somewhere in the list. Could I even concatenate it to a char array to say "Current Energy: <energy>"?

Yes, just put the pointer to the char array. Integers will need to be converted to char arrays, e.g. with sprintf

2. From my game's title screen, pressing button A takes you to the primary menu. However, this press is counted by both the title screen and the menu, causing the first menu option to be picked on accident when all you wanted to do was advance past the title. Is there a way to prevent this sort of accident from occurring, short of mapping the title-to-menu key to another button?

Before calling the menu do something like while(gb.buttons.repeat(BUTTON_A, 0)) gb.update(); That will pause execution until the A button is released

Party_Pete

5 years ago

Thank you so much for your help!

Party_Pete

NEW 5 years ago

Sorunome Sorunome

Thank you so much for your help!