WORD GOLMsgCallback( WORD translatedMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg ) { switch( screenState ) { case SCREEN_BOARD_TEST: // No messages are processed in this state. break; case SCREEN_DISPLAY_MAIN: // This state exists for the draw callback only. break; case SCREEN_MAIN: return ProcessMessageMain( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_FLASH: // This state exists for the draw callback only. break; case SCREEN_FLASH: return ProcessMessageFlash( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_FLASH_ERROR: // This state exists for the draw callback only. break; case SCREEN_FLASH_ERROR: return ProcessMessageFlashError( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_GAMES: // This state exists for the draw callback only. break; case SCREEN_GAMES: return ProcessMessageGames( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_SNAKE: // This state exists for the draw callback only. break; case SCREEN_SNAKE: return ProcessMessageSnake( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_SNAKE_SCORE: // This state exists for the draw callback only. break; case SCREEN_SNAKE_SCORE: return ProcessMessageScore( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_BLASTER: // This state exists for the draw callback only. break; case SCREEN_BLASTER: return ProcessMessageBlaster( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_BLASTER_SCORE: // This state exists for the draw callback only. break; case SCREEN_BLASTER_SCORE: return ProcessMessageScore( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_SHAPELET: // This state exists for the draw callback only. break; case SCREEN_SHAPELET: return ProcessMessageShapelet( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_SHAPELET_SCORE: // This state exists for the draw callback only. break; case SCREEN_SHAPELET_SCORE: return ProcessMessageScore( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_DEMOS: // This state exists for the draw callback only. break; case SCREEN_DEMOS: return ProcessMessageDemos( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_RGB: // This state exists for the draw callback only. break; case SCREEN_RGB: return ProcessMessageRGB( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_GRAPH: // This state exists for the draw callback only. break; case SCREEN_GRAPH: return ProcessMessageGraph( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_CAPTURE_MEDIA: // This state exists for the draw callback only. break; case SCREEN_CAPTURE_MEDIA: return ProcessMessageCapture( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_CAPTURE: // This state exists for the draw callback only. break; case SCREEN_CAPTURE: return ProcessMessageCapture( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_UTILITIES: // This state exists for the draw callback only. break; case SCREEN_UTILITIES: return ProcessMessageUtilities( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_TIME: // This state exists for the draw callback only. break; case SCREEN_TIME: return ProcessMessageTime( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_CTMU: // This state exists for the draw callback only. break; case SCREEN_CTMU: return ProcessMessageCTMU( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_BAR_DEMO: break; case SCREEN_BAR_DEMO: //return ProcessMessageBarDemo( translatedMsg, pObj, pMsg ); break; default: break; } return 1; }
/********************************************************************* * Function: WORD GOLMsgCallback(WORD objMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg) * * Overview: The user MUST implement this function. GOLMsg() calls * this function when a valid message for an object in the * active list is received. User action for the message should * be implemented here. If this function returns non-zero, * the message for the object will be processed by default. * If zero is returned, GOL will not perform any action. * * PreCondition: none * * Input: objMsg - Translated message for the object or the action ID response from the object. * pObj - Pointer to the object that processed the message. * pMsg - Pointer to the GOL message from user. * * Output: Return a non-zero if the message will be processed by default. * If a zero is returned, the message will not be processed by GOL. * * Example: * <CODE> * WORD GOLMsgCallback(WORD objMsg, OBJ_HEADER* pObj, GOL_MSG *pMsg){ * static char focusSwitch = 1; * * switch(GetObjID(pObj)){ * case ID_BUTTON1: * // Change text and focus state * if(objMsg == BTN_MSG_RELEASED){ * focusSwitch ^= 1; * if(focusSwitch){ * BtnSetText((BUTTON*)pObj, "Focused"); * SetState(pObj,BTN_FOCUSED); * }else{ * BtnSetText((BUTTON*)pObj, "Unfocused"); * ClrState(pObj,BTN_FOCUSED); * } * } * // Process by default * return 1; * case ID_BUTTON2: * // Change text * if(objMsg == BTN_MSG_PRESSED){ * BtnSetText((BUTTON*)pObj, "Pressed"); * } * if(objMsg == BTN_MSG_RELEASED){ * BtnSetText((BUTTON*)pObj, "Released"); * } * // Process by default * return 1; * case ID_BUTTON3: * // Change face picture * if(objMsg == BTN_MSG_PRESSED){ * BtnSetBitmap(pObj,arrowLeft); * } * if(objMsg == BTN_MSG_RELEASED){ * BtnSetBitmap(pObj,(char*)arrowRight); * } * // Process by default * return 1; * case ID_BUTTON_NEXT: * if(objMsg == BTN_MSG_RELEASED){ * screenState = CREATE_CHECKBOXES; * } * // Process by default * return 1; * case ID_BUTTON_BACK: * return 1; * default: * return 1; * } * } * </CODE> * * Side Effects: none * ********************************************************************/ WORD GOLMsgCallback( WORD translatedMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg ) { return ProcessMessageGraph( translatedMsg, pObj, pMsg ); }
/**************************************************************************** Function: WORD GOLMsgCallback( WORD translatedMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg ) Description: This callback is executed when a graphics message is being processed. Based on the currently displayed screen, we determine the next operation. Precondition: None Parameters: WORD translatedMsg - The message as translated by the processing routine for the object type. OBJ_HEADER* pObj - Pointer to the graphics object header. GOL_MSG* pMsg - Original graphics message. Return Values: 0 - Do not call the default message processing routine for the object. 1 - Call the default message processing routine for the object. Remarks: This function is called before the default processing. If default processing is required before other processing, it must be done explicitly in this function, and 0 must be returned. If default processing can be performed after this function, simply return 1. ***************************************************************************/ WORD GOLMsgCallback( WORD translatedMsg, OBJ_HEADER* pObj, GOL_MSG* pMsg ) { switch( screenState ) { case SCREEN_START: // No messages are processed in this state. break; case SCREEN_START_DELAY: // No messages are processed in this state. break; case SCREEN_DISPLAY_MAIN: // This state exists for the draw callback only. break; case SCREEN_MAIN: return ProcessMessageMain( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_GRAPH: // This state exists for the draw callback only. break; case SCREEN_GRAPH: return ProcessMessageGraph( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_ES_INFO: // This state exists for the draw callback only. break; case SCREEN_ES_INFO: // This state exists for the draw callback only. break; case SCREEN_DISPLAY_ES_GRAPH: // This state exists for the draw callback only. break; case SCREEN_ES_GRAPH: return ProcessMessageESGraph( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_ORIENTATION: // This state exists for the draw callback only. break; case SCREEN_ORIENTATION: return ProcessMessageOrientation( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_GAMES: // This state exists for the draw callback only. break; case SCREEN_GAMES: return ProcessMessageGames( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_SNAKE: // This state exists for the draw callback only. break; case SCREEN_SNAKE: return ProcessMessageSnake( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_JET: // This state exists for the draw callback only. break; case SCREEN_JET: return ProcessMessageJet( translatedMsg, pObj, pMsg ); break; case SCREEN_DISPLAY_SCORE: // This state exists for the draw callback only. break; case SCREEN_SCORE: return ProcessMessageScore( translatedMsg, pObj, pMsg ); break; default: break; } return 1; }