Tabnine Logo
Platform.time
Code IndexAdd Tabnine to your IDE (free)

How to use
time
method
in
playn.core.Platform

Best Java code snippets using playn.core.Platform.time (Showing top 11 results out of 315)

origin: threerings/playn

/**
 * Returns the current time, as a double value in millis since January 1, 1970, 00:00:00 GMT.
 *
 * <p> This is equivalent to the standard JRE {@code new Date().getTime();}, but it slightly
 * terser, and avoids the use of {@code long} values, which are best avoided when translating to
 * JavaScript. </p>
 */
public static double currentTime() {
 return platform.time();
}
origin: playn/playn

private int elapsed(double start) {
 return (int)Math.round((game.plat.time() - start)/1000);
}
origin: threerings/tripleplay

@Override public void release () {
  if (_copies.size() < _reserveCopies) {
    releaseTime = _board.plat.time();
    _copies.add(this);
  }
}
origin: threerings/tripleplay

/**
 * Obtains a copy of the sound (from the reserves if possible or loaded from storage if not).
 * The copy must be {@link Copy#play}ed or {@link Copy#release}d by the caller.
 */
public Copy reserve () {
  double now = _board.plat.time();
  for (int ii = 0, ll = _copies.size(); ii < ll; ii++) {
    CopyImpl copy = _copies.get(ii);
    if (copy.releaseTime < now) {
      return _copies.remove(ii);
    }
  }
  return new CopyImpl();
}
origin: threerings/tripleplay

@Override public void play () {
  sound.play();
  if (_copies.size() < _reserveCopies) {
    releaseTime = _board.plat.time() + _duration;
    _copies.add(this);
  }
}
origin: threerings/tripleplay

@Override public void onEnd (Touch.Interaction iact) {
  if (!trackingTouch(iact.event)) return;
  _currentTouches.remove(iact.event.id);
  evaluateGestures(new GestureNode(_plat.time(), GestureNode.Type.END, iact));
}
origin: threerings/tripleplay

@Override public void onMove (Touch.Interaction iact) {
  if (!trackingTouch(iact.event)) return;
  _currentTouches.put(iact.event.id, iact.event);
  evaluateGestures(new GestureNode(_plat.time(), GestureNode.Type.MOVE, iact));
}
origin: threerings/tripleplay

@Override public void onCancel (Touch.Interaction iact) {
  if (!trackingTouch(iact.event)) return;
  _currentTouches.remove(iact.event.id);
  evaluateGestures(new GestureNode(_plat.time(), GestureNode.Type.CANCEL, iact));
}
origin: threerings/tripleplay

@Override public void onStart (Touch.Interaction iact) {
  if (!touchInBounds(iact)) return;
  if (_currentTouches.isEmpty()) {
    // new user interaction!
    for (Gesture<?> gesture : _gestures) gesture.start();
    _greedy.update(null);
  }
  _currentTouches.put(iact.event.id, iact.event);
  evaluateGestures(new GestureNode(_plat.time(), GestureNode.Type.START, iact));
}
origin: threerings/tripleplay

protected void onTouchPause (GestureNode node) {
  if (!trackingTouch(node.touch)) {
    Log.log.warning("Bad state: received pause dispatch for an event we're not tracking",
            "event", node.touch);
    return;
  }
  // no need to update _currentTouches, it already has this touch registered
  evaluateGestures(new GestureNode(_plat.time(), GestureNode.Type.PAUSE,
                   node.touch, node.location));
}
origin: playn/playn

@Override public void init() {
 double start = game.plat.time();
 conns.add(game.plat.lifecycle.connect(event -> {
  switch (event) {
  case PAUSE:
   game.log.info("Paused " + elapsed(start));
   notifications.add("Paused at " + elapsed(start) + "s");
   break;
  case RESUME:
   game.log.info("Resumed " + elapsed(start));
   notifications.add("Resumed at " + elapsed(start) + "s");
   updateDisplay();
   break;
  default:
   break; // nada
  }
 }));
 game.rootLayer.addAt(layer = new ImageLayer(), 15, 15);
 updateDisplay();
}
playn.corePlatformtime

Javadoc

Returns the current time, as a double value in millis since January 1, 1970, 00:00:00 GMT. This is equivalent to the standard JRE new Date().getTime();, but is terser and avoids the use of long, which is best avoided when translating to JavaScript.

Popular methods of Platform

  • log
    Returns the Log service.
  • graphics
    Returns the Graphics service.
  • assets
    Returns the Assets service.
  • input
    Returns the Input service.
  • invokeLater
  • exec
    Returns the Exec service.
  • json
    Returns the Json service.
  • storage
    Returns the Storage storage service.
  • type
    Returns the platform Platform.Type.
  • net
    Returns the Net service.
  • reportError
    Called when a backend (or other framework code) encounters an exception that it can recover from, bu
  • setPropagateEvents
  • reportError,
  • setPropagateEvents,
  • tick,
  • audio,
  • dispatchEvent,
  • keyboard,
  • mouse,
  • openURL,
  • pointer

Popular in Java

  • Making http requests using okhttp
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
  • compareTo (BigDecimal)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • BoxLayout (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top Vim 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