/* * "ESCMENU.H" * * Part of The Escotia Playstation Library * * Functions to make programming a chore not a pleasure * * Author: ScoTT Campbell * Date: 19/10/98 * */ #ifndef __ESCMENUHEADER #define __ESCMENUHEADER /*******************************/ /* Start of GsSPRITE functions */ /*******************************/ #define NULL_MENU ((void*) 0) typedef struct menu_node menu_item; typedef struct{ int x; // Top left display x position int y; // Top left display y position unsigned int spacing; // Space in pixels between menu items menu_item* menuArray; // Array of menu items unsigned char size; // Number of menu items in the menu unsigned char current; // The currently active item in a menu }menu_header; struct menu_node{ GsSPRITE itemSprite; // Main sprite for the item. Always displayed menu_header* subMenu; // Sub menu (optional) }; typedef menu_header* menu_type; menu_type CreateMenu(unsigned char size, int x, int y, int spacing); /* Creates a new empty menu */ int IsNullMenu(menu_type menu); /* Returns 1 if the menu is NULL_MENU; 0 otherwise */ int AddSubMenu(menu_type menu, menu_type subMenu, unsigned int position); /* Adds a sub menu to a menu item */ menu_type GetSubMenu(menu_item* menuItem); /* Returns a sub menu from a menu item if on exists */ int UpdateMenu(menu_type menu, unsigned long int pad); /* Update the menu depending on the value of pad1 */ /* The return value is the currently active items number */ int AddSpriteToMenuItem(menu_item* menuItem, GsSPRITE* sprite); /* Adds a sprite to a menu item */ int AddSpriteToMenu(menu_type menu, unsigned char position, GsSPRITE* sprite); /* Adds a new sprite to a menu at position */ int DestroyMenu(menu_type menu); /* Destroys a menu and frees up the memory being used by it */ menu_item* GetCurrentMenuItem(menu_type menu); /* Returns a pointer to the currently active node */ void StepCurrentForward(menu_type menu); /* Makes the currently active menu item the next one in the list */ void StepCurrentBackward(menu_type menu); /* Makes the currently active menu item the previous one in the list */ void SetMenuPosition(menu_type menu, int x, int y); /* Sets the menu's display position to x, y */ void SetMenuSpacing(menu_type menu, unsigned int space); /* Sets the space between menu items to space pixels */ int EsSortMenu(menu_type menu, GsOT* ot, unsigned int pri); /* Puts the menu drawing commands into ot with priorty pri */ #endif