gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Menu With Selection Highlighted

#23794 - enliteneer - Wed Jul 21, 2004 9:18 pm

Ive seen a couple of games where the menu is highlighted as you
move up or down.

Is this done by inverting the pallete or is it some sprite thing?
I havent seen any example source code for this type of thing.

#23795 - poslundc - Wed Jul 21, 2004 9:32 pm

There are approximately 1,000,000 ways to do it, depending on the kind of visual effect you want to achieve for hilighting and what the graphical constraints on your menu system are.

Can you be a bit more specific?

Dan.

#23805 - Abscissa - Thu Jul 22, 2004 12:00 am

enliteneer wrote:
Ive seen a couple of games where the menu is highlighted as you move up or down.

Is this done by inverting the pallete or is it some sprite thing?
I havent seen any example source code for this type of thing.


You could do it either way. Although using an alternate "selected" image would probably look a lot better than inverting the palette.

#23807 - tepples - Thu Jul 22, 2004 12:05 am

Or by drawing a colored bar in a layer under the menu text.

Or by assigning each item a separate palette index and setting the selected item's color different from the others.

Or by using two 16-color palettes and drawing selected items in one and unselected items in another.

Or by using code triggered on vcount to change either a particular palette color or the blending registers on scanlines that contain a selected item.

Or by using two layers, one with selected images and one with unselected images, and using a window to show and hide them.

Could you draw a mock-up of the precise effect you want?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#23811 - enliteneer - Thu Jul 22, 2004 12:46 am

Well, ultimately I would like to play a small wav drop as the
selection is changed. So I guess my only constraint is that the
highlighting be fast to leave time for other processing.

For those of you that have ever seen a Tivo, thats a good example of
nice clean simple menu interface. BTW, for those of you that dont,
http://www.tivo.com/1.0.demo.asp

#23812 - tepples - Thu Jul 22, 2004 12:50 am

For an interface like what I saw on the TiVo site, you'll probably want to put the text in one layer and the borders and highlights in a second layer.

If you're already running a mixer, such as to play your game's background music, then adding another channel to play keypress sounds probably won't take too much more CPU time.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#23820 - MumblyJoe - Thu Jul 22, 2004 7:08 am

Best way I have found is to draw a menu up in whatever graphical program you use, make each selection a different color, convert it to a .cpp/.h file using whatever tool you use, edit the palette so that all the colors you used for selections are all the same color, then you can fade in and out selections etc just by changing a single 16 bit integer.

I know this is a VERY old technique, but I actually came up with it myself before I had ever heard of it so I like to pretend I invented it :P
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!