menu.c File Reference

Implements the menu system. More...

#include "menu.h"
#include "genconmac.h"
#include "color.h"
#include "states.h"
#include "message.h"
#include "net.h"
#include <stdlib.h>
#include <assert.h>

Include dependency graph for menu.c:

Go to the source code of this file.

Defines

#define MARKER_LENGTH   24
 The length of the focus markers in pixels.
#define MARKER_THICKNESS   3
 The thickness of the focus markers in pixels.
#define MENU_MARGIN   96
 The margin between the sides of the window and the menu.

Functions

int MenuRun ()
 Runs a menu operating state.
static void PlaceMarkers ()
void RemoveMenu ()
 Removes intenal menu system data and prepares for a new menu.
static Bool ResizeMenu (int winW, int winH)
 Attempts to resize the menu items to fit the requested size window.
void SetupMenu (MenuItem *menu, int first, int count)
 Initalizes the menu system's internal data for a new menu.

Variables

RenderItem background
 The background image.
static int focus
 

For internal use only.

The index of the menu item that has input focus.


static MenuItemitems
 

For internal use only.

A pointer to the start of an array of items that will comprise the menu.


static RenderItemmarkers
 

For internal use only.

Used for the rectangle edge markers around the menu item with input focus.


static int numItems
 

For internal use only.

The number of elements in the items array.



Detailed Description

Implements the menu system.

Author:
Jeff Jackowski (jeffj@ro.com)
Copyright (C) 2007 Jeff Jackowski

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Or visit their website at: http://www.gnu.org/

Definition in file menu.c.


Define Documentation

#define MARKER_LENGTH   24

The length of the focus markers in pixels.

Definition at line 61 of file menu.c.

Referenced by SetupMenu().

#define MARKER_THICKNESS   3

The thickness of the focus markers in pixels.

Definition at line 56 of file menu.c.

Referenced by PlaceMarkers(), ResizeMenu(), and SetupMenu().

#define MENU_MARGIN   96

The margin between the sides of the window and the menu.

Definition at line 51 of file menu.c.

Referenced by ResizeMenu().


Function Documentation

static void PlaceMarkers (  )  [static]

Definition at line 92 of file menu.c.

References focus, items, RenderItem_t::loc, MARKER_THICKNESS, markers, PlaceRenderItem(), and MenuItem_t::region.

Referenced by MenuRun().

Here is the call graph for this function:

static Bool ResizeMenu ( int  winW,
int  winH 
) [static]

Attempts to resize the menu items to fit the requested size window.

Parameters:
winW The new width of the window.
winH The new height of the window.
Returns:
True if the menu items could fit and were resized. False if the items could not fit and were not altered.
Author:
Jeff Jackowski

Definition at line 127 of file menu.c.

References FALSE, items, MARKER_THICKNESS, MENU_MARGIN, MenuItem_t::minHeight, MenuItem_t::minWidth, numItems, and MenuItem_t::update.

Referenced by MenuRun(), and SetupMenu().


Variable Documentation

RenderItem* markers [static]

For internal use only.

Used for the rectangle edge markers around the menu item with input focus.

Definition at line 90 of file menu.c.

Referenced by PlaceMarkers(), RemoveMenu(), and SetupMenu().


Generated on Mon May 28 04:41:39 2007 for Retro Tank Super Attack by  doxygen 1.5.2