Tabnine Logo
PApplet.postEvent
Code IndexAdd Tabnine to your IDE (free)

How to use
postEvent
method
in
processing.core.PApplet

Best Java code snippets using processing.core.PApplet.postEvent (Showing top 9 results out of 315)

origin: ajavamind/Processing-Cardboard

protected void nativeKeyEvent(android.view.KeyEvent event) {
  // event.isPrintingKey() returns false for whitespace and others,
  // which is a problem if the space bar or tab key are used.
  char key = (char) event.getUnicodeChar();
  // if not mappable to a unicode character, instead mark as coded key
  if (key == 0 || key == 0xFFFF) {
    key = CODED;
  }
  int keyCode = event.getKeyCode();
  int keAction = 0;
  int action = event.getAction();
  if (action == android.view.KeyEvent.ACTION_DOWN) {
    keAction = KeyEvent.PRESS;
  } else if (action == android.view.KeyEvent.ACTION_UP) {
    keAction = KeyEvent.RELEASE;
  }
  // TODO set up proper key modifier handling
  int keModifiers = 0;
  KeyEvent ke = new KeyEvent(event, event.getEventTime(),
      keAction, keModifiers, key, keyCode);
  postEvent(ke);
}
origin: org.processing/core

sketch.postEvent(new MouseEvent(nativeEvent, nativeEvent.getWhen(),
                peAction, peModifiers,
                nativeEvent.getX() / windowScaleFactor,
origin: org.processing/core

 protected void nativeKeyEvent(java.awt.event.KeyEvent event) {
  int peAction = 0;
  switch (event.getID()) {
  case java.awt.event.KeyEvent.KEY_PRESSED:
   peAction = KeyEvent.PRESS;
   break;
  case java.awt.event.KeyEvent.KEY_RELEASED:
   peAction = KeyEvent.RELEASE;
   break;
  case java.awt.event.KeyEvent.KEY_TYPED:
   peAction = KeyEvent.TYPE;
   break;
  }

//    int peModifiers = event.getModifiersEx() &
//      (InputEvent.SHIFT_DOWN_MASK |
//       InputEvent.CTRL_DOWN_MASK |
//       InputEvent.META_DOWN_MASK |
//       InputEvent.ALT_DOWN_MASK);
  int peModifiers = event.getModifiers() &
   (InputEvent.SHIFT_MASK |
    InputEvent.CTRL_MASK |
    InputEvent.META_MASK |
    InputEvent.ALT_MASK);

  sketch.postEvent(new KeyEvent(event, event.getWhen(),
                 peAction, peModifiers,
                 event.getKeyChar(), event.getKeyCode()));
 }

origin: ajavamind/Processing-Cardboard

case MotionEvent.ACTION_DOWN:
  motionPointerId = motionEvent.getPointerId(0);
  postEvent(new MouseEvent(motionEvent, motionEvent.getEventTime(),
      MouseEvent.PRESS, modifiers,
      (int) motionEvent.getX(), (int) motionEvent.getY(),
    postEvent(new MouseEvent(motionEvent, motionEvent.getEventTime(),
        MouseEvent.DRAG, modifiers,
        (int) motionEvent.getX(index), (int) motionEvent.getY(index),
  index = motionEvent.findPointerIndex(motionPointerId);
  if (index != -1) {
    postEvent(new MouseEvent(motionEvent, motionEvent.getEventTime(),
        MouseEvent.RELEASE, modifiers,
        (int) motionEvent.getX(index), (int) motionEvent.getY(index),
origin: org.processing/core

protected void fxKeyEvent(javafx.scene.input.KeyEvent fxEvent) {
 int action = 0;
 EventType<? extends KeyEvent> et = fxEvent.getEventType();
 if (et == KeyEvent.KEY_PRESSED) {
  action = processing.event.KeyEvent.PRESS;
 } else if (et == KeyEvent.KEY_RELEASED) {
  action = processing.event.KeyEvent.RELEASE;
 } else if (et == KeyEvent.KEY_TYPED) {
  action = processing.event.KeyEvent.TYPE;
 }
 int modifiers = 0;
 if (fxEvent.isShiftDown()) {
  modifiers |= processing.event.Event.SHIFT;
 }
 if (fxEvent.isControlDown()) {
  modifiers |= processing.event.Event.CTRL;
 }
 if (fxEvent.isMetaDown()) {
  modifiers |= processing.event.Event.META;
 }
 if (fxEvent.isAltDown()) {
  modifiers |= processing.event.Event.ALT;
 }
 long when = System.currentTimeMillis();
 char keyChar = getKeyChar(fxEvent);
 int keyCode = getKeyCode(fxEvent);
 sketch.postEvent(new processing.event.KeyEvent(fxEvent, when,
                         action, modifiers,
                         keyChar, keyCode));
}
origin: org.processing/core

protected void fxScrollEvent(ScrollEvent fxEvent) {
 // the number of steps/clicks on the wheel for a mouse wheel event.
 int count = (int) -(fxEvent.getDeltaY() / fxEvent.getMultiplierY());
 int action = processing.event.MouseEvent.WHEEL;
 int modifiers = 0;
 if (fxEvent.isShiftDown()) {
  modifiers |= processing.event.Event.SHIFT;
 }
 if (fxEvent.isControlDown()) {
  modifiers |= processing.event.Event.CTRL;
 }
 if (fxEvent.isMetaDown()) {
  modifiers |= processing.event.Event.META;
 }
 if (fxEvent.isAltDown()) {
  modifiers |= processing.event.Event.ALT;
 }
 // FX does not supply button info
 int button = 0;
 long when = System.currentTimeMillis();
 int x = (int) fxEvent.getX();  // getSceneX()?
 int y = (int) fxEvent.getY();
 sketch.postEvent(new processing.event.MouseEvent(fxEvent, when,
                          action, modifiers,
                          x, y, button, count));
}
origin: org.processing/core

int y = (int) fxEvent.getY();
sketch.postEvent(new processing.event.MouseEvent(fxEvent, when,
                         action, modifiers,
                         x, y, button, count));
origin: org.processing/core

              nativeEvent.isAutoRepeat());
sketch.postEvent(ke);
                nativeEvent.isAutoRepeat());
  sketch.postEvent(tke);
origin: org.processing/core

                peCount);
sketch.postEvent(me);
processing.corePAppletpostEvent

Javadoc

Add an event to the internal event queue, or process it immediately if the sketch is not currently looping.

Popular methods of PApplet

  • constrain
  • createGraphics
    Create an offscreen graphics surface for drawing, in this case for a renderer that writes to a file
  • loadStrings
    ( begin auto-generated from loadStrings.xml ) Reads the contents of a file or url and creates a Stri
  • saveStrings
    ( begin auto-generated from saveStrings.xml ) Writes an array of strings to a file, one line per str
  • abs
  • createImage
    ( begin auto-generated from createImage.xml ) Creates a new PImage (the datatype for storing images)
  • createShape
  • createWriter
    ( begin auto-generated from createWriter.xml ) Creates a new file in the sketch folder, and a PrintW
  • loadImage
  • main
    main() method for running this class from the command line. Usage: PApplet [options] [s
  • max
  • parseInt
  • max,
  • parseInt,
  • random,
  • round,
  • split,
  • sqrt,
  • unhex,
  • arrayCopy,
  • ceil,
  • checkExtension

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • setScale (BigDecimal)
  • findViewById (Activity)
  • Menu (java.awt)
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now