Pie Menu

For the people who want some UI stuff in XNA, here’s a small sample that contains a Pie Menu Component, attached to a cursor. If you don’t know what a pie menu is, read about it on wikipedia.

Now, about the sample.

My PieMenu supports deep menus. Currently it is just a quick version, made in two days. Because of this, the graphics are not spectacular, and some things may not be extremely flexible right now (the parameters passed to delegates).

But as it is, each menu entry has associated with it an image, a text description, and a delegate, for the action that should be performed. The PieMenu also supports submenus, as seen in this sample.

The cursor can operate in two modes: mouse-friendly and gamepad friendly. In the mouse friendly mode, the menu options are selected with the cursor, while in gamepad friendly mode, they are selected with the left thumbstick.

The current sample contains the following menus:

  • Change Gamerpic: allows navigation through a series of submenus, to select a gamerpic that will be displayed in the window
  • Change Background Color: randomly chooses a new background color
  • Toggle Input Mode: toggles between the mouse and gamepad friendly input modes. Default is mouse, so if you don’t have a gamepad, don’t worry.
  • Exit : exits the sample.

This is just as an example. The menu can be easily customized. Also, the Cursor.ShowPieMenu() function has an overload that allows you to specify the menu that will be shown. This allows for different menus, depending on the selected object (this is NOT illustrated in this sample)

Controls:

  • Gamepad A or Mouse Click : open menu, or selected submenu
  • Gamepad B, or Mouse Click when no submenu selected: return to upper menu / exit menu

You can find the sample here.

  • http://seo.allpcs.us Gnar’s Game

    Nice,
    I like this menu thanks for the help. We are currently working on a game for our midterm project. I will show the guys this, and see if we can incorporate a pie menu into our game. I will let you know how it turns out.

  • bob

    thanks alot for this sample ..this what i searching for ..