Ejemplo n.º 1
0
        } /* draw() */

/***********************************************************
*
*   Method:
*       add_menu
*
*   Description:
*       Adds menu to the toolbar.
*
***********************************************************/

        public void add_menu(menu_type menu)
        {
/*----------------------------------------------------------
*  Local variable
*  ----------------------------------------------------------*/
            Vector2 origin;

/*----------------------------------------------------------
*  Determine origin point of menu
*  ----------------------------------------------------------*/
            if (menus.Count > 0)
            {
                menu_type m = menus[menus.Count - 1];
                origin = new Vector2(m.dims.toolbar_loc.Right, m.dims.toolbar_loc.Top);
            }
            else
            {
                origin = new Vector2(location.X, location.Y);
            }

/*----------------------------------------------------------
*  Set the menu dimensions
*  ----------------------------------------------------------*/
            menu_dimension_type d = new menu_dimension_type(font, menu, origin, location.Height);

            menu.dims = d;

/*----------------------------------------------------------
*  Add the menu to the toolbar
*  ----------------------------------------------------------*/
            menus.Add(menu);
        } /* add_menu() */
Ejemplo n.º 2
0
        } /* Initialize() */

/***********************************************************
*
*   Method:
*       configure
*
*   Description:
*       Sets the location and color of the tool bar
*
***********************************************************/

        public void configure(Rectangle menu_location, Color menu_color, SpriteFont menu_font)
        {
            int i = 0;

/*----------------------------------------------------------
*  Reset tool bar location
*  ----------------------------------------------------------*/
            location = menu_location;
            color    = menu_color;
            font     = menu_font;

            foreach (menu_type m in menus)
            {
                Vector2 origin;

                /*----------------------------------------------------------
                *  Determine origin point of menu
                *  ----------------------------------------------------------*/
                if (i > 0)
                {
                    origin = new Vector2(m.dims.toolbar_loc.Right, m.dims.toolbar_loc.Top);
                }
                else
                {
                    origin = new Vector2(location.X, location.Y);
                }

                /*----------------------------------------------------------
                *  Set the menu dimensions
                *  ----------------------------------------------------------*/
                menu_dimension_type d = new menu_dimension_type(font, m, origin, location.Height);
                m.dims = d;

                i++;
            }
        } /* configure() */