Structure Breakdown

Photoshop layer

  • normal

    book1/
      page1.psd
        layer1
          layer1_1
          layer1_2
        layer2
      page2.psd

    one .psd makes a omposer.scene of Solar2D

  • lang code

    book1/
      page1.psd
        layer1
          en
          jp
          sp
        layer2

    layer is displayed according to language choise of user.

Solar2D

display.newGroup is available for layer management

group
  layer1
  layer2

Layer image is replaced with the following media

  • imagesheet(spritesheet)
  • video
  • particles
  • web
  • map

Layer can be configured with

  • button
  • animation
  • physics

Other Solar2D components

  • audio
    • short (event)
    • long (stream)
    • sync (audio and text)
  • timer

imported

See the detain in [get_started/import_component/]

set “imported” class in index.lua

for example, page1.psd index.lua

layers = {
  ...
  rectCopied = {class = {"imported"}
  ...
  }

rectCopied_imported.lua, it recycles the layer specified in props.path, and assigns a new different properties.

for instance, buttonGroup/redRect exsists in parts.psd, and imported into page1 index.lua

local props={
  path = "book.components.parts.layers.buttonGroup.redRect",
  name = "rectCopied",
  class = {"button", "linear"},
  text = "hello importer class",
}

local layerProps = {
  x         = display.contentCenterX - 150,
  y         = display.contentCenterY - 100,
  color     = {1, 1, 0}
}

props.layerProps = layerProps
props.classProps = {
  button = {},
  linear = {}
}
return require("components.kwik.importer").new(props)