Exemplo n.º 1
0
MenuItems options_menu_load (SoFont *font, SoFont *small_font)
{
  static MenuItemsTab option_menu = {
    //MENUITEM(kFullScreen),
#ifdef HAVE_OPENGL
    MENUITEM(kOpenGL),
#endif
    MENUITEM_BLANKLINE,
    MENUITEM(kMusic),
    MENUITEM(kAudioFX),
    MENUITEM_BLANKLINE,
    MENUITEM(kControls),
    MENUITEM_BLANKLINE,
    MENUITEM("Back"),
    MENUITEM_END
  };
  menu_items_set_font_for(option_menu,  kMusic, font);
  menu_items_set_font_for(option_menu,  kAudioFX, font);
  menu_items_set_font_for(option_menu,  kControls, font);
  menu_items_set_font_for(option_menu,  "Back", font);
 // menu_items_set_font_for(option_menu,  kFullScreen, font);
 // menu_items_set_value_for(option_menu, kFullScreen, fullscreen?"ON":"OFF");
#ifdef HAVE_OPENGL
  menu_items_set_font_for(option_menu,  kOpenGL, font);
  menu_items_set_value_for(option_menu, kOpenGL, useGL?"ON":"OFF");
#endif
  menu_items_set_value_for(option_menu, kMusic,      sound?"ON":"OFF");
  menu_items_set_value_for(option_menu, kAudioFX,    fx?"ON":"OFF");
  return option_menu;
}
Exemplo n.º 2
0
MenuItems looser_1p_menu_load (SoFont *font, SoFont *small_font)
{
  static MenuItemsTab go_menu = {
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kLooser),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kCurrentLevel),
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kContinueLeft),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kHitActionToContinue),
    MENUITEM("YES"),
    MENUITEM("NO"),
    MENUITEM_END
  };
  menu_items_set_font_for(go_menu, kLooser,  font);
  menu_items_set_font_for(go_menu, kCurrentLevel, font);
  menu_items_set_font_for(go_menu, kContinueLeft, font);
  menu_items_set_font_for(go_menu, kHitActionToContinue, small_font);
  return go_menu;
}
Exemplo n.º 3
0
void UpdateMenuStatusTo(int status)
{
   register int i;

   for (i = 0; i < HANDLESNUM; i++)
   {

#ifdef DEBUG
      printf("\n UpdateMenuStatusTo   handle %p    %c", MENUITEM(i), MenuStatus[status][i] + '0');
#endif

      XtSetSensitive(MENUITEM(i), MenuStatus[status][i]);
   }
}
Exemplo n.º 4
0
MenuItems about_menu_load (SoFont *font)
{
  static MenuItemsTab option_menu = {
    MENUITEM_INACTIVE(kAbout01),
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kVersion),
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kAbout02),
    MENUITEM_INACTIVE(kAbout03),
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kAbout04),
    MENUITEM_INACTIVE(kAbout05),
    MENUITEM_INACTIVE(kAbout06),
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kAbout07),
    MENUITEM_INACTIVE(kAbout08),
    MENUITEM_BLANKLINE,
    MENUITEM("Back"),
    MENUITEM_END
  };
  menu_items_set_font_for(option_menu, kAbout01, font);
  menu_items_set_font_for(option_menu, kVersion, font);
  menu_items_set_font_for(option_menu, kAbout02, font);
  menu_items_set_font_for(option_menu, kAbout03, font);
  menu_items_set_font_for(option_menu, kAbout04, font);
  menu_items_set_font_for(option_menu, kAbout05, font);
  menu_items_set_font_for(option_menu, kAbout06, font);
  menu_items_set_font_for(option_menu, kAbout07, font);
  menu_items_set_font_for(option_menu, kAbout08, font);

  return option_menu;
}
Exemplo n.º 5
0
MenuItems high_scores_menu_load (SoFont *font)
{
  static MenuItemsTab option_menu =
  {
    MENUITEM_INACTIVE(kHighScores),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(k01),
    MENUITEM_INACTIVE(k02),
    MENUITEM_INACTIVE(k03),
    MENUITEM_INACTIVE(k04),
    MENUITEM_INACTIVE(k05),
    MENUITEM_INACTIVE(k06),
    MENUITEM_INACTIVE(k07),
    MENUITEM_INACTIVE(k08),
    MENUITEM_INACTIVE(k09),
    MENUITEM_INACTIVE(k10),
    MENUITEM("Back"),
    MENUITEM_END
  };
  menu_items_set_font_for(option_menu, kHighScores, font);
  menu_items_set_font_for(option_menu, k01, font);
  menu_items_set_font_for(option_menu, k02, font);
  menu_items_set_font_for(option_menu, k03, font);
  menu_items_set_font_for(option_menu, k04, font);
  menu_items_set_font_for(option_menu, k05, font);
  menu_items_set_font_for(option_menu, k06, font);
  menu_items_set_font_for(option_menu, k07, font);
  menu_items_set_font_for(option_menu, k08, font);
  menu_items_set_font_for(option_menu, k09, font);
  menu_items_set_font_for(option_menu, k10, font);

  return option_menu;
}
Exemplo n.º 6
0
MenuItems
main_menu_load (SoFont * font)
{
  static MenuItemsTab main_menu = {
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM (SINGLE_PLAYER_GAME),
    //MENUITEM (TWO_PLAYERS_GAME),
    MENUITEM_BLANKLINE,
    MENUITEM ("Options"),
    MENUITEM_BLANKLINE,
    MENUITEM (kHighScores),
    MENUITEM_BLANKLINE,
    MENUITEM ("Rules"),
    MENUITEM ("About FloboPuyo"),
    MENUITEM_BLANKLINE,
    MENUITEM ("Quit"),
    MENUITEM_END
  };
  static int loaded = 0;

  if (!loaded) {
    menu_items_set_font_for (main_menu, SINGLE_PLAYER_GAME, font);
    //menu_items_set_font_for (main_menu, TWO_PLAYERS_GAME, font);
    menu_items_set_font_for (main_menu, kHighScores, font);
    menu_items_set_font_for (main_menu, "Options", font);
    menu_items_set_font_for (main_menu, "Rules", font);
    menu_items_set_font_for (main_menu, "About FloboPuyo", font);
    menu_items_set_font_for (main_menu, "Quit", font);
    loaded = 1;
    menuBGImage = IIM_Load_DisplayFormat("MenuBackground.jpg");
  }

  return main_menu;
}
Exemplo n.º 7
0
MenuItems single_game_menu_load (SoFont *font, SoFont *small_font)
{
  static MenuItemsTab go_menu =
  {
    MENUITEM(kPlayerName),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kGameLevel),
    MENUITEM_BLANKLINE,
    MENUITEM(kLevelEasy),
    MENUITEM(kLevelMedium),
    MENUITEM(kLevelHard),
    MENUITEM_END
  };
  menu_items_set_font_for(go_menu, kGameLevel,   font);
  menu_items_set_font_for(go_menu, kLevelEasy,   font);
  menu_items_set_font_for(go_menu, kLevelMedium, font);
  menu_items_set_font_for(go_menu, kLevelHard,   font);
  menu_items_set_font_for(go_menu, kPlayerName,  font);
  return go_menu;
}
Exemplo n.º 8
0
MenuItems pause_menu_load (SoFont * font)
{
  static MenuItemsTab main_menu = {
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM (kContinueGame),
    MENUITEM_BLANKLINE,
    MENUITEM (kOptions),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM (kAbortGame),
    MENUITEM_END
  };
  static int loaded = 0;

  if (!loaded) {
    menu_items_set_font_for (main_menu, kContinueGame, font);
    menu_items_set_font_for (main_menu, kOptions, font);
    menu_items_set_font_for (main_menu, kAbortGame, font);
    loaded = 1;
  }

  return main_menu;
}
Exemplo n.º 9
0
MenuItems gameover_1p_menu_load (SoFont *font, SoFont *small_font)
{
  static MenuItemsTab go_menu = {
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kGameOver),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kYouGotToLevel),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kHitActionForMenu),
    MENUITEM("YES"),
    MENUITEM("NO"),
    MENUITEM_END
  };
  menu_items_set_font_for(go_menu, kGameOver,    font);
  menu_items_set_font_for(go_menu, kYouGotToLevel, font);
  menu_items_set_font_for(go_menu, kHitActionForMenu,  small_font);
  return go_menu;
}
Exemplo n.º 10
0
MenuItems nextlevel_1p_menu_load (SoFont *font, SoFont *small_font)
{
  static MenuItemsTab go_menu = {
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kYouDidIt),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kNextLevel),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kHitActionToContinue),
    MENUITEM("YES"),
    MENUITEM("NO"),
    MENUITEM_END
  };
  menu_items_set_font_for(go_menu, kYouDidIt,  font);
  menu_items_set_font_for(go_menu, kNextLevel, font);
  menu_items_set_font_for(go_menu, kHitActionToContinue, small_font);
  return go_menu;
}
Exemplo n.º 11
0
MenuItems finished_1p_menu_load (SoFont *font, SoFont *small_font)
{
  static MenuItemsTab go_menu = {
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kCongratulations),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kPuyosInvasion),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kHitActionForMenu),
    MENUITEM("YES"),
    MENUITEM("NO"),
    MENUITEM_END
  };
  menu_items_set_font_for(go_menu, kCongratulations,  font);
  menu_items_set_font_for(go_menu, kPuyosInvasion, font);
  menu_items_set_font_for(go_menu, kHitActionForMenu, small_font);
  return go_menu;
}
Exemplo n.º 12
0
MenuItems gameover_2p_menu_load (SoFont *font, SoFont *small_font)
{
  static MenuItemsTab go_menu = {
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kPlayer),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kScore),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kContinue),
    MENUITEM("YES"),
    MENUITEM("NO"),
    MENUITEM_END
  };
  menu_items_set_font_for(go_menu, kPlayer,    font);
  menu_items_set_font_for(go_menu, kScore,     font);
  menu_items_set_font_for(go_menu, kContinue,  font);
  return go_menu;
}
Exemplo n.º 13
0
MenuItems must_restart_menu_load (SoFont *font)
{
  static MenuItemsTab option_menu = {
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kMustRestart1),
    MENUITEM_BLANKLINE,
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kMustRestart2),
    MENUITEM_BLANKLINE,
    MENUITEM("Back"),
    MENUITEM_END
  };
  menu_items_set_font_for(option_menu, kMustRestart1, font);
  menu_items_set_font_for(option_menu, kMustRestart2, font);
  return option_menu;
}
Exemplo n.º 14
0
MenuItems rules_menu_load (SoFont *font) {
  static MenuItemsTab option_menu = {
    MENUITEM_INACTIVE(kRules01),
    MENUITEM_INACTIVE(kRules02),
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kRules03),
    MENUITEM_BLANKLINE,
    MENUITEM_INACTIVE(kRules04),
    MENUITEM_INACTIVE(kRules05),
    MENUITEM_BLANKLINE,
    MENUITEM("Back"),
    MENUITEM_END
  };
  menu_items_set_font_for(option_menu, kRules01, font);
  menu_items_set_font_for(option_menu, kRules02, font);
  menu_items_set_font_for(option_menu, kRules03, font);
  menu_items_set_font_for(option_menu, kRules04, font);
  menu_items_set_font_for(option_menu, kRules05, font);

  return option_menu;
}
Exemplo n.º 15
0
MenuItems controls_menu_load (SoFont *font, SoFont *small_font)
{
  static MenuItemsTab controls_menu = {
    //MENUITEM("Player 1 Joystick"),
    //MENUITEM("Player 2 Joystick"),
    MENUITEM_BLANKLINE,
    MENUITEM(kPlayer2Left),
    MENUITEM(kPlayer2Right),
    MENUITEM(kPlayer2Down),
    MENUITEM(kPlayer2Clockwise),
    MENUITEM(kPlayer2Counterclockwise),
    MENUITEM_BLANKLINE,
    //MENUITEM(kPlayer1Left),
    //MENUITEM(kPlayer1Right),
    //MENUITEM(kPlayer1Down),
    //MENUITEM(kPlayer1Clockwise),
    //MENUITEM(kPlayer1Counterclockwise),
    //MENUITEM_BLANKLINE,
    MENUITEM("Back"),
    MENUITEM_END
  };
  //menu_items_set_font_for(controls_menu,  "Player 1 Joystick", font);

  //menu_items_set_font_for(controls_menu,  kPlayer1Left, font);
  //menu_items_set_font_for(controls_menu,  kPlayer1Right, font);
  //menu_items_set_font_for(controls_menu,  kPlayer1Down, font);
  //menu_items_set_font_for(controls_menu,  kPlayer1Clockwise, font);
  //menu_items_set_font_for(controls_menu,  kPlayer1Counterclockwise, font);

  menu_items_set_font_for(controls_menu,  kPlayer2Left, font);
  menu_items_set_font_for(controls_menu,  kPlayer2Right, font);
  menu_items_set_font_for(controls_menu,  kPlayer2Down, font);
  menu_items_set_font_for(controls_menu,  kPlayer2Clockwise, font);
  menu_items_set_font_for(controls_menu,  kPlayer2Counterclockwise, font);

  menu_items_set_font_for(controls_menu,  "Back", font);
 //menu_items_set_value_for(controls_menu, "Player 1 Joystick", SDL_JoystickName(0));
  //menu_items_set_value_for(controls_menu, kPlayer1Left, "s");
  return controls_menu;
}
Exemplo n.º 16
0
/** Handles highlighting of menuitems when the cursor is hovering over them. */
void widget_highlight_menu(widgetdata *widget)
{
    widgetdata *tmp, *tmp2, *tmp3, *submenuwidget = NULL;
    _menu *menu = NULL, *tmp_menu = NULL;
    _menuitem *menuitem = NULL, *submenuitem = NULL;
    int visible, create_submenu = 0, x = 0, y = 0;

    /* Sanity check. Make sure widget is a menu. */
    if (!widget || widget->sub_type != MENU_ID) {
        return;
    }

    /* Check to see if the cursor is hovering over a menuitem or a widget inside
     * it.
     * We don't need to go recursive here, just scan the immediate children. */
    for (tmp = widget->inv; tmp; tmp = tmp->next) {
        visible = 0;

        /* Menuitem is being directly hovered over. Make the background visible
         * for visual feedback. */
        if (tmp == widget_mouse_event.owner) {
            visible = 1;
        } else if (tmp->inv) {
            /* The cursor is hovering over something the menuitem contains. This
             * only needs to search the direct children,
             * as there should be nothing contained within the children. */

            for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->next) {
                if (tmp2 == widget_mouse_event.owner) {
                    /* The cursor was hovering over something inside the
                     * menuitem. */
                    visible = 1;
                    break;
                }
            }
        }

        /* Only do any real working if the state of the menuitem changed. */
        if (tmp->hidden != visible) {
            continue;
        }

        menu = MENU(widget);
        menuitem = MENUITEM(tmp);

        /* Cursor has just started to hover over the menuitem. */
        if (visible) {
            tmp->hidden = 0;

            /* If the highlighted menuitem is a submenu, we need to create a
             * submenu next to the menuitem. */
            if (menuitem->menu_type == MENU_SUBMENU) {
                create_submenu = 1;
                submenuitem = menuitem;
                submenuwidget = tmp;
                x = tmp->x + widget->w - 4;
                y = tmp->y - (CONTAINER(widget))->outer_padding_top;
            }
        } else {
            /* Cursor no longer hovers over the menuitem. */

            tmp->hidden = 1;

            /* Let's check if we need to remove the submenu.
             * Don't remove it if the cursor is hovering over the submenu
             * itself,
             * or a submenu of the submenu, etc. */
            if (menuitem->menu_type == MENU_SUBMENU && menu->submenu) {
                /* This will for sure get the menu that the cursor is hovering
                 * over. */
                tmp2 = get_outermost_container(widget_mouse_event.owner);

                /* Just in case the 'for sure' part of the last comment turns
                 * out to be incorrect... */
                if (tmp2 && tmp2->sub_type == MENU_ID) {
                    /* Loop through the submenus to see if we find a match for
                     * the menu the cursor is hovering over. */
                    for (tmp_menu = menu; tmp_menu->submenu && tmp_menu->submenu != tmp2; tmp_menu = MENU(tmp_menu->submenu)) {
                    }

                    /* Remove any submenus related to menu if the menu
                     * underneath the cursor is not a submenu of menu. */
                    if (!tmp_menu->submenu) {
                        tmp2 = menu->submenu;

                        while (tmp2) {
                            tmp3 = (MENU(tmp2))->submenu;
                            remove_widget_object(tmp2);
                            tmp2 = tmp3;
                        }

                        menu->submenu = NULL;
                    } else {
                        /* Cursor is hovering over the submenu, so leave this
                         * menuitem highlighted. */
                        tmp->hidden = 0;
                    }
                } else {
                    /* Cursor is not over a menu, so leave the menuitem containing
                     * the submenu highlighted.
                     * We want to keep the submenu open, which should reduce
                     * annoyance if the user is not precise with the mouse. */
                    tmp->hidden = 0;
                }
            }
        }
    }

    /* If a submenu needs to be created, create it now. Make sure there can be
     * only one submenu open here. */
    if (create_submenu && !menu->submenu) {
        tmp_menu = MENU(widget);

        tmp_menu->submenu = create_menu(x, y, tmp_menu->owner);

        if (submenuitem->menu_func_ptr) {
            submenuitem->menu_func_ptr(tmp_menu->owner, submenuwidget, NULL);
        }

        menu_finalize(tmp_menu->submenu);
    }
}