[FIXED]Releasing input fires orxFX_EVENT_STOP

I have my code set up to output to the log window input and FX events. However, when releasing an input, an orxFX_EVENT_STOP event is fired as well. Here is my event processing code.
Also, when an FX is added to an object, the input event fires as well.
/** Event handler
 */
orxSTATUS orxFASTCALL EventHandler(const orxEVENT *_pstEvent)
{
	orxFX_EVENT_PAYLOAD *fx_info;
	orxINPUT_EVENT_PAYLOAD *input_info;

	/* Is a new contact? */
	if(_pstEvent->eID == orxPHYSICS_EVENT_CONTACT_ADD)
	{
		orxOBJECT *pstObject1, *pstObject2;

		/* Gets colliding objects */
		pstObject1 = orxOBJECT(_pstEvent->hRecipient);
		pstObject2 = orxOBJECT(_pstEvent->hSender);

		/* On hit, delete the player and all bullet objects. */
	}

	if(_pstEvent->eID == orxFX_EVENT_STOP)
	{
		fx_info = (orxFX_EVENT_PAYLOAD *)_pstEvent->pstPayload;

		orxLOG("FX %s stopped.", fx_info->zFXName);
		
		if(!orxString_Compare(fx_info->zFXName, "FadeFX4"))
			LoadMenu(0);
	}

	if(_pstEvent->eID == orxINPUT_EVENT_ON)
	{
		input_info = (orxINPUT_EVENT_PAYLOAD *)_pstEvent->pstPayload;
		orxLOG("Input %s is on.", input_info->zInputName);
	}

	if(_pstEvent->eID == orxINPUT_EVENT_OFF)
	{
		input_info = (orxINPUT_EVENT_PAYLOAD *)_pstEvent->pstPayload;
		orxLOG("Input %s is off.", input_info->zInputName);
	}

	return orxSTATUS_SUCCESS;
}

Comments

  • edited November 2011
    If you're using the same handler for different event types, you first need to check for the event type before checking for the event ID. :)

    IDs are unique within one type but not globally.
  • edited November 2011
    Oh, thanks. I thought I was doing something wrong... Later.
  • edited November 2011
    Well, nothing wrong beside not checking for the event type. Should I mark this thread as solved?
  • edited November 2011
    Forgot to do that. Done!
Sign In or Register to comment.