Miscellaneous
Miscellaneous Funcions
getWindowWidth
getWindowWidth
Returns the width of your window
Returns
Returns: number
The width in pixels
getWindowHeight
getWindowHeight
Returns the height of your window
Returns
number
The height in pixels
getScreenSize
getScreenSize
If you have already called makeGraphicsWindow
, this will return the size of the graphics window you made. If you have not already called makeGraphicsWindow
, then it returns the current resolution of the browser window.
Returns
array
An array containing the width and height of the window or screen.
setBackground
setBackground
Sets the background color or image for your animation.
background
*
object
|array
|string
-
The color or image to use as a background. If the background is null
, then the background will not be erased between frames, so your moving object will leave trails (unless you erase them yourself).
Returns
nothing
setWindowTitle
setWindowTitle
Sets the title of the window.
title
*
string
-
the title for the window
Returns
nothing
getColorsList
getColorsList
Returns a list of the names of all of the built-in colors supported by this library.
Returns
array
An array of strings, each of which is the name of a built-in color.
getFontList
getFontList
Returns an array of the names of all of the built-in Fonts supported by this library.
Returns
array
An array of strings, each of which is the name of a built-in font.
sizeString
sizeString
Computes the number of pixels needed to draw a string
text
*
string
-
the text to display
size
number
30
the size of the letters in the text, in pixels
bold
boolean
false
true
for bold, false
for regular
italic
boolean
false
true
for italic, false
for regular
font
string
default system font
the name of the font to use - see getFontList
to find out what fonts are available
Returns
nothing
saveScreen
saveScreen
Draws a single pixel.
filename
*
string
'black'
The filename of the file in which to save the image. The format of the file will be determined by the filename extension.
Returns
nothing
getScreenPixel
getScreenPixel
Draws a single pixel.
x
*
number
-
the x coordinate of the pixel
y
*
number
-
the pixel coordinate of the point
Returns
array
An array containing the color. The tuple will have 4 parts, for the red, green, blue, and opacity components of the color, each of which is a number between 0 and 255.
Last updated