Cross platform Java game library PlayN v1.6 was released

Version 1.6 of the cross platform Java based game library PlayN was released recently.  PlayN enables you to target desktop, HTML 5, iOS and Android all using a single Java code base. 

 

  

Here are the release notes for this release:

PlayN v1.6

  • The complete API changes are summarized in this JDiff report.
  • Below is a summary of the interesting changes.

Project Layout

  • The way projects are organized has changed, please see Migrating15to16 for details.

Core

  • Implemented tinting for layers (only on GL backends). See Layer.setTint and Layer.tint.
  • Added Log.setMinLevel to allow suppressing log messages below a certain level. (Recommended by Google for Android release builds.)
  • Added Sound.release for releasing audio resources sooner than waiting for GC to do it.
  • Added Assets.getMusic which allows backends to make some optimizations relating to large audio files.
  • Graphics.setSize was removed, and special setSize methods were added to individual platform backend code that can reasonably support them (e.g. HtmlGraphics.setSize).
  • Added GLContext.Stats for debugging rendering performance on GL backends. (See Triple Play’s HUD class for an easy way to display these stats.)
  • Deprecated Canvas.setTransform because it interacts poorly with automatic scale factor management in HiDPI modes.
  • Added CanvasImage.snapshot which can be used to create an immutable snapshot of a canvas image which has higher render performance.
  • Added TextLayout.ascent/descent/leading for cases where an app needs to know more about the text that will be rendered by aTextLayout (for underlining, for example).
  • Added Json.Writer.useVerboseFormat to cause the JSON writer to generate pretty printed output (rather than compact, everything on one line output).
  • Added support for nested clipping regions (e.g. clipped groups inside of clipped groups).

Java

  • Made the Java backend look for .wav audio files and then fall back to .mp3. This allows a game to use uncompressed .wav audio files, and only compress them when preparing an Android, iOS, or HTML build.
  • Made playback of large MP3s work (when loaded as music).

HTML

  • Added HtmlAssets.ImageManifest which can be used to pre-load the dimensions of all images known to your app, and enableAssets.getImageSync to (sort of) work in the HTML backend. A wiki article explaining this will be forthcoming.
  • Added support for HiDPI mode. See HtmlPlatform.Config.scaleFactor and HtmlAssets.setAssetScale.
  • Added HtmlGraphics.registerFontMetrics for overriding the (hacky) measurement of font line height.
  • Removed source code from the stock POMs. HTML backends now need to add the source jar files to their html/pom.xml. See playn-samples for an example.

Android

  • Fixed issue with audio not stopping when device was put to sleep.
  • Images loaded locally are now marked as “purgeable” and “input shareable”. Google for “android” and those terms to learn more.
  • Added AndroidGraphics.setCanvasScaleFunc which allows games to use lower resolution canvas images if desired. This is useful on devices with low memory.
  • Added AndroidAssets.BitmapOptions which allows games to downsample images if desired. This is useful on devices with low memory.
  • Added GameActivity.prefsName for customizing the name of the Android preferences file.
  • Added GameActivity.logIdent for customizing the Android log identifier. It defaults to playn which is what was hard-coded before.
  • Rewrote sound backend based on SoundPool. Music (large audio files) still relies on the old more-hardware-resource-intensive approach.

iOS

  • Added IOSPlatform.Config for specifying configuration options.
  • Added IOSPlatform.Config.frameInterval for specifying target FPS on iOS.
  • Added IOSImage.toUIImage for custom platform code that needs to manipulate an image loaded via IOSAssets.getImage.
  • Numerous bug fixes and performance improvements.

 

Additionally, TriplePlay 1.6 was also released.  TriplePlay is a library built over top of PlayN to support higher level functionality like UIs and animation.

The following are TriplePlays release notes:

 

TPUI:

  • Added Scroller makeVisible.
  • Added LongPressButton which supports both a normal press interaction and a long-press interaction.
  • Added AxisLayout.Policy CONSTRAIN off-axis sizing policy.
  • Added Field MAXIMUM_INPUT_LENGTH style.
  • Added TableLayout colspan for configuring a column span on an element.
  • Added ValueLabel.
  • Added Style ICON_CUDDLE and UNDERLINE (the latter for underlined text).
  • Added TableLayout.Column free to allow weighting of free columns.

TPAnim:

  • Added AnimGroup for creating a group of invoked-in-parallel of animations that are either added to an Animator later, or are added to a serial animation chain.
  • Moved animation creation methods from Animator to AnimBuilderAnimation then now returns an AnimBuilder which is a cleaner design.
  • Clarified behavior of Animator add and then, made then freak out if used incorrectly.
  • Fixed bugs with repeating animations.

TPSound:

TPParticle:

  • Added Transform randomScale and randomOffset.

TPFlump:

  • Various bug fixes and small API improvements. See API changes.

TPPlatform:

  • Added NativeTextField Validator and Transformer for (native) text validation and transformation.

TPShader:

  • TintingShader was removed as PlayN layers now support tinting directly.

TPUtil:

 

 

For existing PlayN 1.5 developers, there is a guide for migrating to 1.6.

PlayN


Scroll to Top