Skip to content
DeflatedPickle edited this page Oct 27, 2022 · 1 revision

Rawky has the concept of guides. These are lines drawn on to the grid to highlight areas such as parts on a sprite sheet

File API

Files can be place in the users /guide folder or for devs can be extracted out to it on launch using the following code in your plugin

FileUtils.copyResourcesRecursively(
    MyPlugin::class.java.getResource("/guide"),
    RawkyPlugin.guideFolder
)

JSON

Guides are written in JSON as a list of objects, where the objects have a name that'll be drawn, an x and y to define where it'll be placed and a width and height to define the extent of the rectangle from where it's x and y

[
  {
    "name": "guide",
    "x": 0,
    "y": 0,
    "width": 16,
    "height": 16
  },
  {
    "name": "guide2",
    "x": 16,
    "y": 16,
    "width": 16,
    "height": 16
  }
]

Code API

a Guide instance can be added to the class's registry like so

Guide.registry["guide"] = listOf(
    Guide(
        name = "guide",
        x = 0,
        y = 0,
        width = 16,
        height = 16
    ),
    Guide(
        name = "guide2",
        x = 16,
        y = 16,
        width = 16,
        height = 16
    )
)
Clone this wiki locally