/* menu.c --- main menu
 *
 * This file is gift-ware.  This file is given to you freely
 * as a gift.  You may use, modify, redistribute, and generally hack
 * it about in any way you like, and you do not have to give anyone
 * anything in return.
 *
 * I do not accept any responsibility for any effects, adverse or
 * otherwise, that this code may have on just about anything that
 * you can think of.  Use it at your own risk.
 *
 * Copyright (C) 1999  Michael Bukin
 */

#include <allegro.h>

#include "game.h"
#include "menu.h"

/*
 * Dialog description for main menu.
 */
static DIALOG main_menu_dialog[] =
{
  /* proc              x   y    w    h    fg  bg key  flags   d1 d2 dp    dp2   dp3  */
  { d_shadow_box_proc, 0,  0,   160, 150, 15, 1, 0,   0,      0, 0, NULL, NULL, NULL },
  { d_ctext_proc,      80, 15,   0,   16,  15, 1, 0,   0,      0, 0, "THE GAME", NULL, NULL },
  { d_button_proc,     15, 35,  130, 16,  15, 1, 's', D_EXIT, 0, 0, "&Start Game", NULL, NULL  },
  { d_button_proc,     15, 55,  130, 16,  15, 1, 'o', D_EXIT, 0, 0, "&Options", NULL, NULL },
  { d_button_proc,     15, 75,  130, 16,  15, 1, 'h', D_EXIT, 0, 0, "&High Scores", NULL, NULL },
  { d_button_proc,     15, 95,  130, 16,  15, 1, 'c', D_EXIT, 0, 0, "&Credits", NULL, NULL },
  { d_button_proc,     15, 115, 130, 16,  15, 1, 27,  D_EXIT, 0, 0, "Quit", NULL, NULL },
  { NULL,              0,  0,   0,   0,   0,  0, 0,   0,      0, 0, NULL, NULL, NULL }
};

#define MAIN_MENU_START		2
#define MAIN_MENU_OPTIONS	3
#define MAIN_MENU_SCORES	4
#define MAIN_MENU_CREDITS	5
#define MAIN_MENU_QUIT		6

/*
 * Show main menu.
 */
void
game_menu (void)
{
  int choice = MAIN_MENU_START;

  /* Center dialog on screen.  */
  centre_dialog (main_menu_dialog);

  do
    {
      /* Prepare for dialog.  */
      clear (screen);

      /* Get user choice.  */
      choice = do_dialog (main_menu_dialog, choice);

      switch (choice)
	{
	case MAIN_MENU_START:
	  /* Start game at last.  */
	  game_start ();
	  break;
	case MAIN_MENU_OPTIONS:
	  break;
	case MAIN_MENU_SCORES:
	  break;
	case MAIN_MENU_CREDITS:
	  break;
	}
    }
  while (choice != MAIN_MENU_QUIT);
}

/*
 * menu.c ends here
 */
