Version 1 (modified by trac, 16 years ago) ( diff )

--

Entity and e.g. projectile classes derive from this and use it for sending/receiving events.

IEventTarget Methods

SetPriorObject

  • Overview:
    • Set target that will receive each event before it is processed.
  • Syntax:
    • SetPriorObject(event_target);
  • Parameters:
    • target object [IEventTarget*]
  • Returns:
  • Notes:
    • Unused.

SetNextObject

  • Overview:
    • Set target that will receive each event after it is processed.
  • Syntax:
    • SetNextObject(event_target);
  • Parameters:
    • target object [IEventTarget*]
  • Returns:
  • Notes:
    • Used by Entity and BaseEntity.

AddHandler

  • Overview:
    • Register a handler for the given event type.
  • Syntax:
    • added = AddHandler(type, handler);
  • Parameters:
    • type [int or CStrW], handler [DOMEventHandler]
  • Returns:
    • whether it was actually newly registered [bool]
  • Notes:

RemoveHandler

  • Overview:
    • Remove a previously registered handler for the specified event.
  • Syntax:
    • removed = RemoveHandler(type, handler);
  • Parameters:
    • type [int or CStrW], handler [DOMEventHandler]
  • Returns:
    • whether it was successfully removed [bool]
  • Notes:

!AddHandlerJS

!RemoveHandlerJS

Perform the same function as Add|RemoveHandler above; called by ScriptGlue.cpp for add|RemoveGlobalHandler

GetScriptExecContext

  • Overview:
    • Return the JSObject* we'd like to be the 'this' object when executing the handler.
  • Syntax:
    • _this = GetScriptExecContext(target);
  • Parameters:
    • target of the current event [IEventTarget*]
  • Returns:
    • JS 'this' [JSObject*]
  • Notes:
    • Passed to CScriptObject::DispatchEvent.

DispatchEvent

  • Overview:
    • Dispatch an event to its handler.
  • Syntax:
    • DispatchEvent( &evt );
  • Parameters:
    • Event [CScriptEvent*]
  • Returns:
    • whether the event arrived (i.e. wasn't cancelled) [bool]
  • Notes:
Note: See TracWiki for help on using the wiki.