Create Input.js

goo System which adds input to the goo canvas.  So far I have only ported mouse input, but will also add keyboard support.

To use the system, you add it to your world:

goo.world.setSystem(new Input(goo));

This is an event oriented System, not a 'polling' system.

To capture the event, you need to register to listen for the specific events:

Game.register("MouseMove", onMouseMove);

Events Raised:

MouseButton1: Left Mouse Button was pressed.
MouseButton2: Right Mouse Button was pressed.
MouseButton4: Middle Mouse Button was pressed.
MouseMove

You CAN poll for mouse button states with Input.mouseButton[], where you would enter the button you are interested in, inside the brackets:

if(true == Input.mouseButton[1]) {// it means the left button is down}

1 = left
2 = right
4 = middle

That is all I have put in so far.

It also handles change in position.

Input.mouseDelta is the Vector2 change in mouse position from the previous frame to the current one.

Input.mousePosition is updated every time anything happens with the mouse (button pressed, released, or moved).

The button events are the same for both Down and Up.  The event passes in which state the button is in (true or false):

function onLeftDown(bool){
  if(bool){
    // button was pressed
  }
  else{
    // button was released
  }
}