Class EntityComponent

Base class for attachable entity components.

class EntityComponent
  : EventListener
  , Updateable
  , Drawable;

Constructors

NameDescription
this (eventManager, hostEntity) Constructs an entity component and attaches it to the given entity.

Fields

NameTypeDescription
entity EntityThe entity this component is attached to.
visible boolIf false, the component is not rendered.
address stringAddress of this dispatcher.
enabled boolIf false, disables event processing.
eventManager EventManagerThe event manager used for polling events.
inputManager InputManagerThe input manager for input state queries.
domain intAddressing domain of this dispatcher.

Methods

NameDescription
render (state) Override to implement rendering logic.
update (t) Override to implement per-frame update logic.
onControllerAdd (deviceIndex, deviceType) Called when a controller is added.
onControllerAxisMotion (deviceIndex, axis, value) Called when a controller axis is moved.
onControllerButtonDown (deviceIndex, button) Called when a controller button is pressed.
onControllerButtonUp (deviceIndex, button) Called when a controller button is released.
onControllerRemove (deviceIndex) Called when a controller is removed.
onCustomResize (x, y, width, height)
onDropFile (filename) Called when a file is dropped onto the window.
onFileChange (filename) Called when a file change is detected.
onFocusGain () Called when the window gains focus.
onFocusLoss () Called when the window loses focus.
onHardwareSpecificEvent (deviceIndex, code, payload) Called when a hardware specific event is received from a custom InputDevice.
onJoystickAxisMotion (deviceIndex, axis, value) Called when a joystick axis is moved.
onJoystickButtonDown (deviceIndex, button) Called when a joystick button is pressed.
onJoystickButtonUp (deviceIndex, button) Called when a joystick button is released.
onKeyboardLayoutChange () Called when the user switches system keyboard layout.
onKeyDown (key) Called when a key is pressed.
onKeyUp (key) Called when a key is released.
onLocaleChange () Called when a user locale preferences have changed.
onMessage (domain, sender, message, payload) Called when a message event is received.
onMouseButtonDown (button) Called when a mouse button is pressed.
onMouseButtonUp (button) Called when a mouse button is released.
onMouseWheel (x, y) Called when the mouse wheel is scrolled.
onPenMotion (x, y, pressure) Called when a pen (stilus) is moved over a graphics tablet.
onQuit () Called when a quit event is received.
onResize (width, height) Called when the window is resized.
onTask (domain, sender, callback, payload) Called when a task event is received.
onTextInput (code) Called when text input is received.
onTimerEvent (timerID, userCode) Called when a timer event is received.
onUserEvent (code, payload) Called when a user event is received.
processEvent (e, enableInputEvents) Processes a single event, dispatching it to the appropriate handler.
processEvents (enableInputEvents) Processes all pending events, dispatching them to handler methods.
generateUserEvent (code, payload) Queues a user event with the given code and payload pointer.
queueLog (level, message) Queues a log event.
queueMessage (recipient, message, payload, domain) Queues a message event.
queueTask (callback, payload, domain) Queues a task event.

Description

Components can implement update and render logic, and are attached to entities.