Package org.inspirenxe.strata.swing
Most code needs only StrataPanel, which shows a stack of screens in a
Swing window, or SwingSnapshot, which renders a screen to an image without a
display. To host Strata in other Java2D code, use the SPI pieces directly:
SwingPlatform and SwingCanvas, with
SwingInput to translate AWT key and button codes.
Sprites load through SwingSprites: from the class path, at
assets/<namespace>/sprites/<path>.png unless a SpriteResolver names
another place, or from anywhere a SpriteSource reads. Images drawn for denser
displays sit beside them as <path>@2x.png and <path>@1.5x.png.
SwingThemeSource finds theme files at
assets/<namespace>/themes/<path>.json unless a ThemePathResolver
names another place. Fonts are SwingFonts held by
SwingTextMetrics: an AwtFont or a
BitmapFont. SwingTranslations sets where
translated text comes from, and SwingVisuals makes visuals of
BufferedImages.
Like Swing itself, the classes here must be used on the Swing event thread unless their documentation says otherwise.
-
ClassDescriptionA
SwingFontthat draws an AWT font.ASwingFontthat draws glyphs cut from images, for previewing engines whose fonts are bitmaps.Collects a font's sheets and advances.Turns a sprite id into the class path resource that holds its image.Loads the image for a sprite id, from wherever the images live: the class path, a folder, a zip file, or images made in code.A Swing component that shows a stack of Strata screens.The SwingCanvas: draws straight onto aGraphics2D, in call order.A font the Swing adapter measures and draws text with.Maps AWT key codes, mouse buttons and modifier masks to Strata's input types.The SwingPlatform.Renders one frame of a screen to an image, with no window or display.Loads sprites for the Swing canvas from aSpriteSource: by default the class path, at the resource aSpriteResolvernames (SpriteResolver.DEFAULTunless one is given).The SwingTextMetrics: picks aSwingFontfor each text style and measures with it.Finds theme files on the class path atassets/<namespace>/themes/<path>.json, next to whereSpriteResolver.DEFAULTlooks for sprites, or wherever aThemePathResolversays.Sets where translated text comes from in a Swing application.MakesVisuals thatSwingCanvasdraws, so Swing code can show its own images through the API.Turns a theme id into the class path resource that holds its theme files, forSwingThemeSource.