pl0t engine - events

mouse and keyboard

These are all the different types used by the system, it is important to follow these standards so things will functions properly. One has not to support all these types. This information is importent to:

- JAVA developers
- web developers (javascript calls)
- MAX developers
- MAX composers
so if you don't fall in that category relax :D. The 'master' is defined in the file, one should follow the numbering used in it.

the different types

// Keybord and Mouse codes (some are natural for applets some for javascript)
KEY_PRESSED          = 0  key pressed down
KEY_RELEASED         = 1  key released
KEY_TYPED            = 2  key both pressed and released
MOUSE_PRESSED        = 3  button pressed down
MOUSE_RELEASED       = 4  button released
MOUSE_CLICKED        = 5  button both pressed and released
MOUSE_ENTERED_APPLET = 6  mouse pointer is over the applet
MOUSE_EXITED_APPLET  = 7  mouse pointer exited the applet
MOUSE_DRAGGED        = 8  mouse is being dragged with a button pressed
MOUSE_MOVED          = 9  mouse is being moved
MOUSE_ONMOUSEOVER    = 10 mouse has entered some area (ex: image)
MOUSE_ONMOUSEOUT     = 11 mouse has exited some area (ex: image)

Other events
APPLET_CHAT          = 20 a chat message

Info events
INFO_ENVIRONMENT    = 50  browser/os information
INFO_SCREEN_SIZE    = 51  screen/monitor size
INFO_BROWSER_SIZE   = 52  browser window size
INFO_LAYER_SIZE     = 53  local layer size
INFO_APPLET_STARTED = 54* applet has been started... Duh!
INFO_APPLET_STOPPED = 55* applet has been stopped
INFO_SERVER_TIME    = 56* server local-time

* these are sent automatically and should not be called/generated in
  the javascript. However they are important for MAX developers.

Format they are sent in:

    // format : ID[byte] type[byte] timestamp[long] 
    // * mouse: ID[byte] type[byte] timestamp[long] button[byte] clicks[byte] x[int] y[int]
    // *   key: ID[byte] type[byte] timestamp[long] code[int] modifier[byte]
    // *  size: ID[byte] type[byte] timestamp[long] x[int] y[int]
    // * envir: ID[byte] type[byte] timestamp[long] brNameLength[int] brName[bytes] brVerMajor[int] brVerMinor[int]
    //          osNameLength[int] osName[bytes] osVerMajor[int] osVerMinor[int]
    //          ipLength[int] ip[bytes] languageLength[int] language[bytes]
    // * start: ID[byte] type[byte] timestamp[long]
    // *  stop: ID[byte] type[byte] timestamp[long]
    // *  chat: ID[byte] type[byte] timestamp[long] msgLength[int] msg[bytes] toUser[byte]
    // *  time: ID[byte] type[byte] timestamp[long]

This is directly from the source code. Not all these events are logical to use in a webpage or in MAX but here they are anyway. When calling the send-functions in PlotIOApplet make sure to use these numbers to make things standard.

data types

The data sent over UDP is coded in the following way

byte:  1-byte value
 int:  four bytes, high byte first
long:  eight bytes, high byte first