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:
- The complete API changes are summarized in this JDiff report.
- Below is a summary of the interesting changes.
- The way projects are organized has changed, please see Migrating15to16 for details.
- 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).
- 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).
- 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.
- 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.
- 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:
For existing PlayN 1.5 developers, there is a guide for migrating to 1.6.