|API||Uses canvas||Graphics libraries||AB framework||Worlds using this API||Starter Worlds|
|P5 (r2)||Yes||P5||No||553 Worlds||None|
This API is for P5 Worlds. It has no Ancient Brain framework. Anything written in P5 should run using this API without change.
This API has the following features:
AB.mind.getAction ( state );
ABWorld; // instance of class ABWorldClass // Data and methods of ABWorld: ABWorld.canvas; // to point to the canvas // useful functions for creating/resizing canvas: ABWorld.fullwidth(); // return full width of window on desktop / screen on mobile ABWorld.fullheight(); // return full height of window on desktop / screen on mobileWorld code can normally createCanvas() and ignore return. The created canvas should display in the run window. The AB system will find the canvas automatically (e.g. when it needs to do a screenshot). If the canvas does not display normally, or if the AB system fails to find the canvas, you can help it out by creating the canvas as follows:
var canvas = createCanvas ( ... ); ABWorld.setCanvas ( canvas ); // tell the AB system where the canvas is