ResourcePack

Feb 13, 2019
ResourcePack
  • ArcadeBoard API - ResourcePack


    Introduction(top)

    By default you can use any ASCII or UTF character when drawing pixels on the canvas. However these characters are limited or not correctly sized making them hard to use.

    Resource packs are very well integrated in the plugin, allowing you to draw sprites without having to deal with the creation of resource packs. The plugin will handle the creation, you just need to remember the name you gave to individual sprites.


    Based on your resource pack settings you provide the pack can be forced to the user (forced as in: If you don't want it, you can't play).

    ResourceIcon(top)

    A resource icon is an icon (image) that will replace an unused UTF-8 character. You do not have to worry about which character is replaced, or remember the character.

    ResourceImage(top)

    A resource image is a combined collection of individual resource icons. It provides one big image that is split in 16x16 chunks to create one image.


    ResourceSong(top)

    A resource song is an OGG song that can be used in the game. It can be used for in-game music or effects.

    ResourceFont(top)

    A resource font is an additional font that uses ResourceIcon's to display the characters. Multiple games can multiple fonts.

    Usage(top)


    Adding an icon(top)

    Adding an icon takes two arguments. The first being a name you give to your icon and the second being a file, input stream or BufferedImage.
    Code (Text):
    resourcePack.addIcon("PACMAN_IDLE",new File(....));
    Note: You can automatically generate rotated versions of your icon by specifying "allowRotation"

    Adding an image(top)

    Adding an image takes two arguments. The first being a name you give to your image and the second being a file, input stream or BufferedImage.
    Code (Text):
    resourcePack.addImage("MyPicture",new File(....));
    Note: You can automatically generate rotated versions of your icon by specifying "allowRotation"


    Using an icon(top)

    Using an icon is as simple as getting it by the name you created it with.
    Code (Text):
    resourcePack.getIconByName("PACMAN_IDLE");
    The above code returns a "ResourceIcon" that has a toString() method you can use.
    You can also use this instance of ResourceIcon directly when drawing to a canvas.
    Note: When you've added the icon with "allowRotation" you can use toString(rotation)
    rotation is a number between 0 and 3

    Using an image(top)

    Using an image is as simple as getting it by the name you created it with.
    Code (Text):
    resourcePack.getImageByName("MyPicture");
    The above code returns a "ResourceImage" that you can use to draw to a canvas.

    Note: When you've added the icon with "allowRotation" you can use toString(rotation)
    rotation is a number between 0 and 3
  • Loading...
  • Loading...