- Before getting started, please check the Article standards and practices.
- Click a red link.
- Place the following code in the empty edit box:
- For a new function:
{{subst:functemp|preamble=REPLACEME|function=REPLACEME|object=REPLACEME|returns=REPLACEME|params=REPLACEME}}
- For a new object:
{{subst:objecttemp|preamble=REPLACEME|function=REPLACEME|object=REPLACEME|returns=REPLACEME|params=REPLACEME}}
- For a new function:
- Check the minor edit flag and save.
- Click 'edit' at the top of the page to add content.
- Try to be objective when writing, and save when you're done.
- Remove description from this page, add page link to list at the top of the matching section.
Difference between revisions of "API:Functions"
m (Added category) |
Bruce Pascoe (talk | contribs) 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.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. | + | * [[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
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
- Sphere.APILevel
- Sphere.Compiler
- Sphere.Engine
- Sphere.Game
- Sphere.Version
- Sphere.frameRate
- Sphere.frameSkip
- Sphere.fullScreen
- Sphere.abort()
- Sphere.now()
- Sphere.restart()
- Sphere.setResolution()
- Sphere.shutDown()
- Sphere.sleep()
Debugging
Files and Directories
- new DirectoryStream()
- new FileStream()
- FS.createDirectory()
- FS.deleteFile()
- FS.directoryExists()
- FS.fileExists()
- FS.fullPath()
- FS.readFile()
- FS.relativePath()
- FS.removeDirectory()
- FS.rename()
- FS.writeFile()
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
- from()
- from::all()
- from::allIn()
- from::any()
- from::anyIn()
- from::anyIs()
- from::ascending()
- from::besides()
- from::count()
- from::descending()
- from::each()
- from::first()
- from::from()
- from::including()
- from::last()
- from::random()
- from::reduce()
- from::remove()
- from::sample()
- from::select()
- from::shuffle()
- from::skip()
- from::take()
- from::toArray()
- from::update()
- from::where()
image Module
logger Module
music Module
- Music.adjusting
- Music.adjustVolume()
- Music.override()
- Music.play()
- Music.pop()
- Music.push()
- Music.reset()
- Music.play()
prim Module
- Prim.blit()
- Prim.blitSection()
- Prim.drawCircle()
- Prim.drawEllipse()
- Prim.drawLine()
- Prim.drawPoint()
- Prim.drawRectangle()
- Prim.drawSolidCircle()
- Prim.drawSolidEllipse()
- Prim.drawSolidRectangle()
- Prim.fill()
random Module
thread Module
Miscellaneous
- SphereFS - How the file system prefixes work.