AddTimer

edited November 2011 in Help request
orxClock_AddTimer(orxClock_FindFirst(orx2F(-1.0f), 
		(void *StartEnemyWave)(orxClock_GetInfo(orxClock_FindFirst(orx2F(-1.0f)), )
		,orxConfig_GetListString("ListDelay", wave_delay)), 1, );

i'm not sure what is suppose to go on the void *_pContext part of this function. i know it's a void pointer, but i don't know what its suppose to be pointing to..
i'm new on this new game engine.. THanks for your help

Comments

  • edited November 2011
    Hi javierely1 and welcome here!

    First of all, you don't need to cast your timer callback as long as its definition is compatible. The last parameter, context, is simply a value we'll then transmit to your callback when we call it. If you don't need any context to be transmitted to your callback, then you can simply leave it to orxNULL.

    Here's some code:
    
    // Your callback function
    void orxFASTCALL StartEnemyWave(const orxCLOCK_INFO *_pstInfo, void *_pContext)
    {
      // Do whatever you want in it
    }
    
    And its registration to the main clock:
    
    orxClock_AddTime(orxClock_FindFirst(orx2F(-1.0f), orxCLOCK_TYPE_CORE), StartEnemyWave, orxConfig_GetListFloat("ListDelay", wave_delay), 1, orxNULL);
    

    Note that in your exemple you were getting a string from config and not a float for your delay.
Sign In or Register to comment.