Skip to content
Alessandro Febretti edited this page Aug 23, 2013 · 20 revisions

class Event

Last revision: ver. 4.1 - 23 August 2013

[[module omega]] wraps omicron::Event

Encapsulates information about input events. Input events are explained in more detail here. This class is used within the context of an event handler function, registered through the setEventFunction call. The EventType, EventFlags, EventExtraDataType, ServiceType are together with the event class.

Methods

Method(s) Description
isKeyDown(key), isKeyUp(key)
isButtonDown(button), isButtonUp(button)
getAxis(index) Gets the value for the specified axis (if available) Non available axes return 0 by default.
getSourceId()
getType()
getServiceType()
getPosition(), getOrientation()
isProcessed() Returns True if this event has already been handled somewhere else
setProcessed() Marks this event as processed

Event types

The method getType() returns a value from the EventType enumeration. The EventType enumeration contains the following values: Select, Toggle, ChangeValue, Update, Move, Down, Up, Trace, Connect, Untrace, Disconnect, Click, Zoom, Split, Rotate, Null

For more information about event types read the Event reference page of the omicron SDK

Event flags

The methods isKeyDown(), isKeyUp(), isButtonDown(), isButtonUp() return a value from the EventFlags enumeration. The EventFlags enumeration contains the following values: Left, Middle, Right, Button1, Button2, Button3, Button4, Button5, Button6, Button7, SpecialButton1, SpecialButton2, SpecialButton3, Ctrl, Alt, Shift, ButtonDown, ButtonUp, ButtonLeft, ButtonRight, Processed, User

For more information about event flags read the Event reference page of the omicron SDK

Event service types

The method getServiceType() returns a value from the ServiceType enumeration. The ServiceType enumeration contains the following values: Pointer, Mocap, Keyboard, Controller, Ui, Generic, Brain, Wand, Audio

For more information about event service types read the Event reference page of the omicron SDK

Example: PS3 Move Controller Button Mapping

Example Scripts

Button handling

	def handleEvent():
		e = getEvent()
		print(e.getPosition())
		if(e.isButtonDown(EventFlags.ButtonLeft)): 
			print("Left button pressed")
		if(e.isButtonDown(EventFlags.ButtonUp)): 
			print("Up button pressed")
			
	setEventFunction(handleEvent)

Axis handling

def onEvent():
     e = getEvent()
     if(e.getServiceType() = ServiceType.Wand):
          print("Wand analog X : " + str(e.getAxis(0)))
          
setEventFunction(handleEvent)
Clone this wiki locally