All pastes #161012 Raw Edit

Something

public text v1 · immutable
·published 2006-09-04 22:39 UTC
rendered paste body
/*********************************************************/
	// Used for buttons (which are touchable areas...)
		typedef struct sTouchableArea {
			void (*fCall)();	// Call this function when touched
			
			int16 x1, y1;		// Top left corner
			int16 x2, y2;		// Bottom right corner
		} touchableArea;
	
	// A button in an buttonList
		typedef struct sButtonListItem {
			touchableArea *ta;	// Pointer to touchableArea
			
			int action;		// Bitfield
			u8 oamEntry;		// Entry into OAM
		} buttonListItem;
	
	// A list of buttons to animate
		typedef struct sButtonList {
			u8 size;		// How many buttons are there?
			buttonListItem *list;	// Linear array of buttons
		} buttonList;
/*********************************************************/



/*********************************************************/
........
buttonList bl;
........
	if (bl.list[i].ta->fCall) {		// (yes, its touched) is it's function valid?
		(bl.list[i].ta->fCall)();	// (yes, func valid) call it
	} else {
		printf("fCall is null for this button!\n");
	}
........
/*********************************************************/