-2

I've searched the web using all the search terms that my mind could come up with but all to no avail. I guess it's mainly because I can't explain my question with a couple of keywords. Anyway, here is my question:

You know how in games that use consoles you can navigate through the menu using the game pad buttons? And when you press right, it automatically selects the nearest control on the right of the current control. Likewise with up and down. And when you press a certain control and another list of menu unfolds on top the original control, and you are limited to select one of the new controls and can't select the other older controls even though they still appear on the screen? Well, how is that created programmatically? I'd love it if you can provide obj-c code of an implementation but any language would be fine. If not possible, then a pseudo code would also work fine with me. Even plain text would work with me but I wouldn't recommend it since I'm not a native speaker and may have issues understanding...

Basically, here is my question in bullet points in case I wasn't clear above due to my weak English:

1- How to move through a menu using a game pad.

2- Once a drop down list is selected, how to lock the contrils that can be selected to the controls that unfold from the drop down list.

And that's pretty much all of it. Thanks a lot for the help!

Brave Heart
  • 507
  • 2
  • 15
  • Ps: for those of you who are voting this question negatively, can you at least post a comment saying why so that I learn from my mistakes if I had done anything wrong or violated any of the rules? – Brave Heart Jan 23 '15 at 01:06
  • 1
    Make a collection of buttons. For each button, make each dpad direction optionally map to a new button. Make each button selection optionally map to a new collection. Done. – Drew Dormann Jan 23 '15 at 01:08
  • 2
    I have not voted on this question, but I'd speculate that it's because you seem to be 0% finished with a solution and you're asking someone else to do the remaining 100%. – Drew Dormann Jan 23 '15 at 01:11
  • @DrewDormann So I hardcode the left, right, top, and bottom controls relative to this control and use that for selection? – Brave Heart Jan 23 '15 at 01:12
  • @DrewDormann I honestly tried to think about it over the past week and haven't found any ideas. I think it's mainly because it is my first time working with controllers in general. And even though you mentioned that I require someone else to do the remaining 100%, I only asked for code if possible. But plain text just as you provided is absolutely acceptable and good. Thank you very much sir. – Brave Heart Jan 23 '15 at 01:15
  • 1
    Hard-coding is one way to map one piece of data to another. Or a file that describes it. Or static data. Or calculated algorithmically. – Drew Dormann Jan 23 '15 at 01:15
  • What does this even have to do with a game pad? You're just talking about submenus. And the details of how to do it depend entirely on your platform/GUI framework. – jscs Jan 23 '15 at 01:22

1 Answers1

1
  • Make a collection of buttons
  • For each button, make each dpad direction optionally map to a new button
  • Make each button selection optionally map to a new collection
  • Done

Hard-coding is one way to map one piece of data to another. Or a file that describes it. Or static data. Or calculated algorithmically.

Drew Dormann
  • 50,103
  • 11
  • 109
  • 162