World of Hello
|
the game program/application. More...
#include <game.h>
Static Public Member Functions | |
static int | getWindowX (bool dpiAware=true) |
get the window's x. More... | |
static int | getWindowY (bool dpiAware=true) |
get the window's y. More... | |
static int | getWindowWidth (bool dpiAware=true) |
get the window's width. More... | |
static int | getWindowHeight (bool dpiAware=true) |
get the window's height. More... | |
static element * | getElementFromID (string ID) |
get a GUI element from an ID. More... | |
static element * | getElementFromPosition (int x, int y) |
gets an element from an absolute position. More... | |
static mesh * | getMeshFromID (string ID) |
get a mesh from an ID. More... | |
static game | setTitle (string title="") |
sets the window title. More... | |
static game | loadScripts (string filePath) |
load a script or scripts in a directory. More... | |
static bool | scriptLoaded (string filePath) |
checks whether or not the script has loaded. More... | |
static string[] | getScripts (string folder="", string filter="") |
get a table of all running script names. More... | |
static string | getScript (string filePath) |
get the code to the script with the given file path. More... | |
static game | setScript (string filePath, string code, bool remove=false) |
set the code of the script with the given file path. More... | |
static game | setKeyDown (string key) |
set a key down. More... | |
static game | reload () |
reload all scripts. More... | |
static game | getOpenFileName (function func,...) |
get a selected file from the operating system's file browser. More... | |
static game | getSaveFileName (function func,...) |
choose a file location to save using the operating system's file browser. More... | |
static game | drawRectangle (int x, int y, int width=100, int height=50, bool border=false, int r=0, int g=0, int b=0, int a=255, int clipX=0, int clipY=0, int clipWidth=game:getWindowWidth(), int clipHeight=game:getWindowHeight()) |
draw a rectangle onto the screen. More... | |
static game | setBackgroundColor (int r, int g, int b, int a) |
set the window's background color. More... | |
static int | getTime () |
get the time in milliseconds. More... | |
static string | getOS () |
get the operating system. More... | |
static bool | isMobile () |
get whether or not the OS is mobile. More... | |
static bool | isStatic () |
gets whether or not the client is able to change worlds. More... | |
static game | addError (string err) |
adds an error to be displayed. More... | |
static game | setTimeout (int milliseconds, string func="",...) |
sets a timer (in milliseconds) that is triggered when the time is up. More... | |
static game | removeTimeouts (string func="*", string script=script:thisName()) |
removes one or more timers started by the matching script with the matching function name. More... | |
static game | removeTimeouts (function func) |
removes one or more timers started by this script that calls the given function. More... | |
static element | getFocusedElement () |
gets the focused element. More... | |
static vector< vector< vector< int > > > | getImagePixels (string imagePath, int x=0, int y=0, int w=-1, int h=-1) |
gets a list of all pixel colors from an image. More... | |
static game | openLink (string URL, bool newTab=true) |
opens a link by URL. More... | |
static game | pushState (function func,...) |
pushes a new state onto the state stack. More... | |
static multiReturn< int, int > | getDPI () |
gets the number of dots per inch on the screen. More... | |
static game | draw2dline (int startX, int startY, int endX, int endY, int r=255, int g=255, int b=255, int a=255) |
draws a 2d line. More... | |
static bool | isKeyDown (string key) |
checks if the given key is currently down or not. More... | |
the game program/application.
|
static |
adds an error to be displayed.
Adds an error to an error list to be displayed.\n If the error is already in the error list, then it is not added.
The | error message to be displayed. |
|
static |
draws a 2d line.
The | starting X of the line. |
The | starting Y of the line. |
The | ending X of the line. |
The | ending Y of the line. |
(optional) | The amount of red (0-255). |
(optional) | The amount of green (0-255). |
(optional) | The amount of blue (0-255). |
(optional) | The amount of alpha (transparency) (0-255). |
|
static |
draw a rectangle onto the screen.
The | X axis of the rectangle. |
The | Y axis of the rectangle. |
(optional) | The width of the rectangle. |
(optional) | The height of the rectangle. |
(optional) | Whether the rectangle is only the border or filled. |
(optional) | The amount of red (0-255). |
(optional) | The amount of green (0-255). |
(optional) | The amount of blue (0-255). |
(optional) | The amount of alpha (transparency) (0-255). |
(optional) | The clipping X (the rectangle will not draw pixels lower than the clipping X). |
(optional) | The clipping Y. |
(optional) | The clipping width (the rectangle will not draw pixels above the clipping X + the clipping width). |
(optional) | The clipping height. |
|
static |
gets the number of dots per inch on the screen.
Converts an inch to pixels and returns the horizontal (X) and vertical (Y) dots per inch.
|
static |
get a GUI element from an ID.
The | GUI element's ID. |
|
static |
gets an element from an absolute position.
The | x axis of the position. |
The | y axis of the position. |
|
static |
gets the focused element.
|
static |
gets a list of all pixel colors from an image.
Gets all pixel colors from an image or part of an image.\n The returned variable looks something like, for example:\n \t { { { 255, 255, 255, 255 }, { 0, 0, 0, 0 }, ... }, ... }\n Where the numbers represent red, green blue, and alpha respectively.\n Returns nil if the image file does not exist or is not yet downloaded.
The | path of the image file. |
(optional) | The starting X, in pixels, to grab from the image. |
(optional) | The starting Y, in pixels, to grab from the image. |
(optional) | The amount of pixels, in width, to grab from the image. If negative, will grab until the end width of the image. |
(optional) | The amount of pixels, in height, to grab from the image. If negative, will grab until the end height of the image. |
|
static |
get a mesh from an ID.
The | mesh's ID. |
|
static |
get a selected file from the operating system's file browser.
Opens the operating system's default file browser to select a file. Calls the given function upon file selection.
The | function to trigger with the server response. |
(optional) | Any number of values to pass to the function, func, when invoked. |
|
static |
get the operating system.
Get which operating system the user is running. Currently only "Windows", "Android", "iOS", and "Web" are supported.
|
static |
choose a file location to save using the operating system's file browser.
Opens the operating system's default file browser to save a file. Calls the given function upon file selection.
The | function to trigger with the server response. |
(optional) | Any number of values to pass to the function, func, when invoked. |
|
static |
get the code to the script with the given file path.
Get the content of a running script. If the script is not loaded but it is saved locally, gets the contents of the script file. If the script doesn't exist, returns nil.
the | script's file path. |
|
static |
get a table of all running script names.
Get a table list of all running scripts, filtered if a filter is given and in a folder if a folder path is given. If there are no scripts, returns nil.
|
static |
get the time in milliseconds.
|
static |
get the window's height.
Whether | or not the return value is based on DPI. |
|
static |
get the window's width.
Whether | or not the return value is based on DPI. |
|
static |
get the window's x.
Whether | or not the return value is based on DPI. |
|
static |
get the window's y.
Whether | or not the return value is based on DPI. |
|
static |
checks if the given key is currently down or not.
Gets whether or not the key is currently being held down.\n WARNING: This is different than adding a key event (see: game:addEventListener(Event.Game.onKeyDown) and game:addEventListener(Event.Game.onKeyUp)), as this checks at the time that keyIsDown is called.
The | key to check if it is currently down. |
|
static |
get whether or not the OS is mobile.
|
static |
gets whether or not the client is able to change worlds.
A game is static if, upon joining the app, the user did not go through the login screen but instead directly went to a world.
|
static |
load a script or scripts in a directory.
Load a script with the given file path. If the path ends with a slash ('/'), then load all scripts in the folder directory.
The | script file path or the directory that contains one or more scripts. |
|
static |
opens a link by URL.
Opens the given URL in the default system browser.\n Allows the option to open the link in a new tab or the same window, only if the client is on the web version.
The | URL to open. |
(optional) | Whether or not the link should open in a new tab. Only usable on web. |
|
static |
pushes a new state onto the state stack.
Adds a state. States are used for the back/forward arrows on web browsers or mobile devices (such as Android).\n When the state is changed, the given function is triggered.
The | ID to identify the state. |
|
static |
reload all scripts.
Reloads all scripts, starting at onCreated(). All elements and objects are also reset.
|
static |
removes one or more timers started by this script that calls the given function.
Removes a timer set with game:setTimeout() that matches the given function.\n Removed timers will no longer be triggered in the script(s). Only removes timers started in this script.
Removes | (a) timeout(s) that trigger the given function. |
|
static |
removes one or more timers started by the matching script with the matching function name.
Removes a timer set with game:setTimeout() that matches the given function name.\n You may use an asterisk (*) to match multiple timeouts.\n Removed timers will no longer be triggered in the script(s). Only removes timers started in the script(s) that match the given script name.
(optional) | Removes (a) timeout(s) that match the given function name. If no function is given, all timers will be cleared. |
(optional) | Removes the timeout(s) from the scripts matching the given script name. If no script name given, only removes from the current script. |
|
static |
checks whether or not the script has loaded.
If the script has been loaded, returns true. Otherwise, returns false. NOTE: loaded means that the script has been loaded using loadScripts(), and that it has successfully downloaded from the server and ran it's onCreated() function.
|
static |
set the window's background color.
The | amount of red (0-255). |
The | amount of green (0-255). |
The | amount of blue (0-255). |
The | amount of alpha (transparency) (0-255). |
|
static |
set a key down.
The | key to set as down. |
|
static |
set the code of the script with the given file path.
The | script's file path to set the code to. |
The | new code to the given script. |
(optional) | Whether or not the script should be entirely removed and re-created or not (if not, just clears the script and re-runs). |
|
static |
sets a timer (in milliseconds) that is triggered when the time is up.
Sets a timer for the given amount of time.\n After the time has passed and no function, func, was given, function onTimeout() is triggered. If func was given, the function, func, is called with the given params (if any). See Events for additional params that are passed.
The | amount of time in milliseconds until onTimeout() is called. |
(optional) | The function to be triggered after the given time has passed. If no function given, onTimeout() is called. |
(optional) | Any number of arguments to be passed to the function. |
|
static |
sets the window title.
(optional) | The title to set. Leave blank to use the default title. |