ArcadeBoard API - Canvas
Introduction(top)The canvas is something you can draw on. Depending on the game settings, each player can have their own individual canvas or one canvas that is shared to all players playing that same game instance.
In the API, you will find that the Canvas class is abstract and extended by CharacterCanvas. This is done to allow for future canvasses such as maps, holograms or other interfaces you can display your game on. For now, only character based canvases for scoreboards are supported.
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.