Difference between revisions of "API:Functions"

From Spherical
Jump to: navigation, search
m (Added category)
m (Sphere Game Platform: Add APIs from mS 5 final)
 
Line 26: Line 26:
 
<tt>
 
<tt>
 
* [[API:Sphere.APILevel|Sphere.APILevel]]
 
* [[API:Sphere.APILevel|Sphere.APILevel]]
 +
* [[API:Sphere.Compiler|Sphere.Compiler]]
 +
* [[API:Sphere.Engine|Sphere.Engine]]
 
* [[API:Sphere.Game|Sphere.Game]]
 
* [[API:Sphere.Game|Sphere.Game]]
* [[API:Sphere.Platform|Sphere.Platform]]
 
 
* [[API:Sphere.Version|Sphere.Version]]
 
* [[API:Sphere.Version|Sphere.Version]]
 
* [[API:Sphere.frameRate|Sphere.frameRate]]
 
* [[API:Sphere.frameRate|Sphere.frameRate]]
 +
* [[API:Sphere.frameSkip|Sphere.frameSkip]]
 +
* [[API:Sphere.fullScreen|Sphere.fullScreen]]
 
* [[API:Sphere.abort|Sphere.abort()]]
 
* [[API:Sphere.abort|Sphere.abort()]]
 
* [[API:Sphere.now|Sphere.now()]]
 
* [[API:Sphere.now|Sphere.now()]]
 
* [[API:Sphere.restart|Sphere.restart()]]
 
* [[API:Sphere.restart|Sphere.restart()]]
* [[API:Sphere.exit|Sphere.shutDown()]]
+
* [[API:Sphere.setResolution|Sphere.setResolution()]]
 +
* [[API:Sphere.shutDown|Sphere.shutDown()]]
 
* [[API:Sphere.sleep|Sphere.sleep()]]
 
* [[API:Sphere.sleep|Sphere.sleep()]]
 
</tt>
 
</tt>

Latest revision as of 16:05, 2 November 2017


The Sphere API is the collective name for the set of bindings (functions, objects, and methods) available for use by all Sphere games. The API provides access to a host of convenient features, allowing you to get up and running quickly.


Making new function/object pages

Simple steps:
  1. Before getting started, please check the Article standards and practices.
  2. Click a red link.
  3. Place the following code in the empty edit box:
    1. For a new function: {{subst:functemp|preamble=REPLACEME|function=REPLACEME|object=REPLACEME|returns=REPLACEME|params=REPLACEME}}
    2. For a new object: {{subst:objecttemp|preamble=REPLACEME|function=REPLACEME|object=REPLACEME|returns=REPLACEME|params=REPLACEME}}
  4. Check the minor edit flag and save.
  5. Click 'edit' at the top of the page to add content.
  6. Try to be objective when writing, and save when you're done.
  7. Remove description from this page, add page link to list at the top of the matching section.


Core API

The Core API provides low-level access to the engine's features and includes all bindings provided directly by the engine. These bindings are exposed to the global scope and can be used without importing any extra modules.

Sphere Game Platform

Debugging

Files and Directories

Random Number Generation

Sphere Runtime

The Sphere Runtime is a standard collection of JavaScript modules included with the engine. Some modules can even be used in Cellscripts as well! Unlike the Core API above which was organized by category, the following list is organized by module. Most modules export only a single object or function; to import more than one at a time, you can use an ES2015 import statement and import objects from the sphere-runtime or cell-runtime module, as appropriate:

In a Sphere game

import { from, Music, Thread } from 'sphere-runtime';

In a Cellscript

import { assert, transpile } from 'cell-runtime';

from Module

image Module

logger Module

music Module

prim Module

random Module

thread Module

Miscellaneous

  • SphereFS - How the file system prefixes work.