Canvas

Jan 8, 2018
Canvas
  • ArcadeBoard API - Canvas


    Resolution(top)

    The pixel resolution is defined in your constructor of the Game. Each 'default' canvas in the game has that resolution. You have to use full width UTF-8 characters in each pixel. Each character can (but not has) have a color.

    The X and Y origin are located in the top left of the screen. Meaning that the more you go right the Y value will increase, the more you go down the more the X value will increase. It is indexed as an array where 0,0 is the start position and the maximum value is (width-1),(height-1).

    Title(top)

    You can set the title with the setTitle setter. The title will be formatted internally with colors and updated alongside the pixel updates.

    The maximum length of the title is 32 characters.

    Drawing(top)

    The canvas already has several methods included for drawing. Multiple overloaded methods exist with default values for arguments (such as pixel character).

    drawPixel(top)

    Allows you to draw a pixel at a specific X,Y position.

    drawLine(top)

    Allows you to draw a line between two points.

    drawRectangle(top)

    Allows you to draw a rectangle border starting at a specific X,Y position with a given width and height.

    fillRectangle(top)

    Allows you to draw a filled rectangle starting at a specific X,Y position with a given width and height.

    writeString(top)

    Draws a string with regular ASCII characters at a given X,Y position. In order to compensate for the non-monospace font in minecraft all the pixels left to the X,Y position will be cleared.

    The string you provide has to be color formatted if you use color characters.
  • Loading...
  • Loading...