Package org.mt4j.input.inputData

Examples of org.mt4j.input.inputData.InputCursor


   */
  private void sendEndedEvents(Iscene lastScene){
    logger.debug("Sending INPUT_ENDED events to the last scene, Active motions: " + ActiveCursorPool.getInstance().getActiveCursorCount());
    InputCursor[] activeCursors = ActiveCursorPool.getInstance().getActiveCursors();
    for (int i = 0; i < activeCursors.length; i++) {
      InputCursor inputCursor = activeCursors[i];
      if (inputCursor.getCurrentEvent() != null){
        AbstractCursorInputEvt lastEvt = inputCursor.getCurrentEvent();
        if (lastEvt.getId() != AbstractCursorInputEvt.INPUT_ENDED){
          try {
            AbstractCursorInputEvt endedEvt = (AbstractCursorInputEvt) lastEvt.clone();
            endedEvt.setId(AbstractCursorInputEvt.INPUT_ENDED);
            endedEvt.preFire();
View Full Code Here


   */
  private void sendStartedEvents(Iscene newScene){
    logger.debug("Sending INPUT_DETECTED events to the new scene, Active motions: " + ActiveCursorPool.getInstance().getActiveCursorCount());
    InputCursor[] activeCursors = ActiveCursorPool.getInstance().getActiveCursors();
    for (int i = 0; i < activeCursors.length; i++) {
      InputCursor inputCursor = activeCursors[i];
      if (inputCursor.getCurrentEvent() != null){
        //PROBLEM: if in lastscene last event in cursor was input_started enqueued
        //but not added to cursor yet,
        //shall we send it again in new scene? -> will input_started be sent twice?
        //- what if input started was enqueued during transition and not sent to any scene
        AbstractCursorInputEvt lastEvt = inputCursor.getCurrentEvent();
        /*
        if (//lastEvt.getId() != AbstractCursorInputEvt.INPUT_DETECTED
            true
          ){
        */
 
View Full Code Here

          //@Override
          public boolean processInputEvent(MTInputEvent inEvt){
            if(inEvt instanceof AbstractCursorInputEvt){
              AbstractCursorInputEvt posEvt = (AbstractCursorInputEvt)inEvt;
              if (posEvt.hasTarget() && posEvt.getTargetComponent().equals(getCanvas())){
                InputCursor m = posEvt.getCursor();
                AbstractCursorInputEvt prev = m.getPreviousEventOf(posEvt);
                if (prev == null)
                  prev = posEvt;

                Vector3D pos = new Vector3D(posEvt.getPosX(), posEvt.getPosY(), 0);
                Vector3D prevPos = new Vector3D(prev.getPosX(), prev.getPosY(), 0);
View Full Code Here

  public void mousePressed(MouseEvent e) {
    if (!mouseBusy )  {
      mousePressedButton = e.getButton();
      mouseBusy = true;
     
      InputCursor m = new InputCursor();
      MTFingerInputEvt touchEvt = new MTFingerInputEvt(this, e.getX(), e.getY(), MTFingerInputEvt.INPUT_DETECTED, m);
//      m.addEvent(touchEvt);
     
      lastUsedMouseID = m.getId();
      ActiveCursorPool.getInstance().putActiveCursor(lastUsedMouseID, m);
//     
//      System.out.println("MouseSource Finger DOWN, Motion ID: " + m.getId());
      //FIRE
      this.enqueueInputEvent(touchEvt);
View Full Code Here

  /* (non-Javadoc)
   * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
   */
  public void mouseDragged(MouseEvent e) {
    try {
      InputCursor m = ActiveCursorPool.getInstance().getActiveCursorByID(lastUsedMouseID);
      if (m != null){
        MTFingerInputEvt te = new MTFingerInputEvt(this, e.getX(), e.getY(), MTFingerInputEvt.INPUT_UPDATED, m);
//        m.addEvent(te);
//        System.out.println("MouseSource Finger UPDATE, Motion ID: " + m.getId());
        //FIRE
View Full Code Here

  /* (non-Javadoc)
   * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
   */
  public void mouseReleased(MouseEvent e) {
    if (e.getButton() == mousePressedButton) {
      InputCursor m = ActiveCursorPool.getInstance().getActiveCursorByID(lastUsedMouseID);
      MTFingerInputEvt te = new MTFingerInputEvt(this, e.getX(), e.getY(), MTFingerInputEvt.INPUT_ENDED, m);
//      m.addEvent(te);
     
      //System.out.println("MouseSource Finger UP, Motion ID: " + m.getId());
      this.enqueueInputEvent(te);
View Full Code Here


  public void processInputEvtImpl(MTInputEvent inputEvent) {
    if (inputEvent instanceof AbstractCursorInputEvt) {
      AbstractCursorInputEvt posEvt = (AbstractCursorInputEvt) inputEvent;
      InputCursor m = posEvt.getCursor();
     
      switch (posEvt.getId()) {
      case AbstractCursorInputEvt.INPUT_DETECTED:{
//        logger.debug("Finger DOWN-> " + " ID:" + posEvt.getId() + "; X:" + posEvt.getPosX() + " Y:" + posEvt.getPosY() + "; Source: " + posEvt.getSource());
//        System.out.println("Finger DOWN-> " + " ID:" + posEvt.getId() + "; X:" + posEvt.getPosX() + " Y:" + posEvt.getPosY() + "; Source: " + posEvt.getSource()+  " CursorID: " + m.getId() + " appInfoProv: " + appInfoProvider);
View Full Code Here

   */
  @Override
  public void processInputEvtImpl(MTInputEvent inputEvent) {
    if (inputEvent instanceof AbstractCursorInputEvt) {
      AbstractCursorInputEvt cursorEvt = (AbstractCursorInputEvt)inputEvent;
      InputCursor c = ((AbstractCursorInputEvt)inputEvent).getCursor();
      Vector3D position = new Vector3D(cursorEvt.getPosX(), cursorEvt.getPosY());

      AbstractShape displayShape = null;
      switch (cursorEvt.getId()) {
      case AbstractCursorInputEvt.INPUT_DETECTED:
View Full Code Here

      } catch (Exception e) {
        e.printStackTrace();
      }
    }
   
    InputCursor m = new InputCursor();
    MTFingerInputEvt touchEvt = new MTFingerInputEvt(this, mouseInfo.x, mouseInfo.y, MTFingerInputEvt.INPUT_DETECTED, m);
//    m.addEvent(touchEvt);
   
//    long motionID = m.getId();
    ActiveCursorPool.getInstance().putActiveCursor(device, m);
View Full Code Here

        mouseInfo.ellipse.setPositionRelativeToParent(new Vector3D(mouseInfo.x, mouseInfo.y,0));
      }
    }

    if (mouseInfo.isButtonPressed){
      InputCursor m = ActiveCursorPool.getInstance().getActiveCursorByID(device);
      MTFingerInputEvt te = new MTFingerInputEvt(this, mouseInfo.x, mouseInfo.y, MTFingerInputEvt.INPUT_UPDATED, m);
      //      m.addEvent(te);
//      System.out.println("Motion update on device: #" + device+  " X:" + mouseInfo.x + " Y:" + mouseInfo.y);
      this.enqueueInputEvent(te);
    }
View Full Code Here

TOP

Related Classes of org.mt4j.input.inputData.InputCursor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.