Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411276 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 11:20:00 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Menus: God Dammit Why
Pages: [1]
Print
Author Topic: Menus: God Dammit Why  (Read 765 times)
Rat Casket
Level 10
*****


i can do what i want


View Profile WWW
« on: December 11, 2014, 10:48:48 AM »

Okay so I started making menus for the first time and its a nightmare. Mostly just because I feel like I have to brute force everything.

For the sake of ease I have my menu set up with a cursor ala Smash Bros where you just go click on what you want. Is the best way to do this to make each option its own object, and once clicked on it goes to the next set of options?

Versus > character screen > stage screen > game start

How do you guys do your menus?
Logged

Donutttt
Level 0
**



View Profile
« Reply #1 on: December 12, 2014, 08:16:14 AM »

I've seen general purpose menu systems, but it seems as though for most games it'll work out easier to tailor make each menu, as they are often very different. One thing I did, and I'm not sure if it's ideal at all, is to have a button object. It'd really only store the corner coordinates of the button, but it helped at least. My guess would be that the best way would be to have general menu objects that can be used in a variety of circumstances.
Logged
Sik
Level 10
*****


View Profile WWW
« Reply #2 on: December 12, 2014, 10:51:43 AM »

I don't tailor make each menu in my games anymore, but I do have a rather more involved setup than usual. Basically there's a list of options (as usual), and each option has:

  • Coordinates of the rectangle it covers on screen
  • IDs of the options to go to when pressing up/down/left/right
  • Pointers to functions to actions to be taken when pressing up/down/left/right/accept
  • Sound effect played when an action is triggered
  • Whatever is needed to display them (e.g. sprite or caption)

Note that the second and third points can have any of the parts undefined (meaning the corresponding keys won't do anything), and the fourth point can also be undefined. When creating a new option, all movement and action is by default set to undefined, and the sound effect is set to the usual beep, and then it's up to the code initializing the menu to fill in the gaps.

But yeah, if you handle all of the above, you'll probably have practically all use cases covered. It's quite complex, but you get the ability to make completely arbitrary menus while sharing the same code.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic