.. Event

.. default - domain::js

.. include:: /includes/standard.rst

==========================
Event (of :class:`Object`)
==========================

.. class:: Event

	Defined in System.sc.

	
	The Event class is one of the most widely used classes in SCI games. It is used to find out if the user has given input.
	
	Event types:
	
	================= =========================================
	Event type          Description
	================= =========================================
	evNULL              A null event
	evMOUSEBUTTON       A mouse button press event
	evMOUSERELEASE      A mouse button press event
	evKEYBOARD          A keyboard event
	evJOYSTICK          A joystick event
	evMOUSEKEYBOARD     A mouse button press or keyboard event
	evALL_EVENTS        Check for all events	
	================= =========================================
	
	The following event types also exist, but are not generated by the Event class itself.
	These events are *manufactured* by the game code instead of directly caused by the user.
	
	- evVERB								
	- evMOVE
	- evHELP
	- evHELPVERB
	
	Event message:
	
	The event **message** property is used mainly for keyboard events, where it contains the keycode.
	
	The event **modifiers** property can contain any of the following flags for keyboard events:
	
	- emRIGHT_SHIFT
	- emLEFT_SHIFT
	- emSHIFT
	- emCTRL
	- emALT
	- emSCR_LOCK
	- emNUM_LOCK
	- emCAPS_LOCK
	- emINSERT
	
	For mouse events, the following flags may be set in **modifiers**:
	
	- emLEFT_BUTTON
	- emRIGHT_BUTTON


Properties
==========

Inherited from :class:`Object`:

======== ===========
Property Description
======== ===========
name                
======== ===========

Defined in Event:

========= =================================================
Property  Description                                      
========= =================================================
type      evKEYBOARD, evMOUSEBUTTON, etc...                
message   The key or mouse button that was pressed.        
modifiers emSHIFT, emCTRL or any of the other em\* defines.
y         The x for mouse events.                          
x         The y for mouse events.                          
claimed   Has the event been claimed?                      
port                                                       
========= =================================================


Methods
==========


.. function:: new([eventType])
	:noindex:

	Creates a new instance of the Event class. It then fills its properties accordingly with the lastest event information information.
	If eventType is specified, it retreives the event(s) specified by it. Otherwise, it retrieves all events. Finally, it returns a pointer to itself.



.. function:: localize()
	:noindex:

	Brings the event into the current port's local coordinates.


.. function:: globalize()
	:noindex:



