World of Hello
game.h
1 
5 class game
6 {
7 public:
15  static int getWindowX(bool dpiAware=true);
23  static int getWindowY(bool dpiAware=true);
31  static int getWindowWidth(bool dpiAware=true);
39  static int getWindowHeight(bool dpiAware=true);
47  static element* getElementFromID(string ID);
56  static element* getElementFromPosition(int x, int y);
64  static mesh* getMeshFromID(string ID);
72  static game setTitle(string title="");
82  static game loadScripts(string filePath);
91  static bool scriptLoaded(string filePath);
100  static string[] getScripts(string folder="", string filter="");
110  static string getScript(string filePath);
120  static game setScript(string filePath, string code, bool remove=false);
128  static game setKeyDown(string key);
137  static game reload();
148  static game getOpenFileName(function func, ...);
159  static game getSaveFileName(function func, ...);
179  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());
190  static game setBackgroundColor(int r, int g, int b, int a);
197  static int getTime();
206  static string getOS();
213  static bool isMobile();
223  static bool isStatic();
234  static game addError(string err);
247  static game setTimeout(int milliseconds, string func="", ...);
260  static game removeTimeouts(string func="*", string script=script:thisName());
271  static game removeTimeouts(function func);
278  static element getFocusedElement();
296  static vector<vector<vector<int>>> getImagePixels(string imagePath, int x=0, int y=0, int w=-1, int h=-1);
308  static game openLink(string URL, bool newTab=true);
319  static game pushState(function func, ...);
327  static multiReturn<int, int> getDPI();
341  static game draw2dline(int startX, int startY, int endX, int endY, int r=255, int g=255, int b=255, int a=255);
350  static bool isKeyDown(string key);
351 protected:
352 private:
353 };
game::reload
static game reload()
reload all scripts.
script
used to control specific scripts.
Definition: script.h:6
game
the game program/application.
Definition: game.h:5
game::pushState
static game pushState(function func,...)
pushes a new state onto the state stack.
game::isKeyDown
static bool isKeyDown(string key)
checks if the given key is currently down or not.
game::setBackgroundColor
static game setBackgroundColor(int r, int g, int b, int a)
set the window's background color.
game::getWindowY
static int getWindowY(bool dpiAware=true)
get the window's y.
game::getWindowHeight
static int getWindowHeight(bool dpiAware=true)
get the window's height.
game::getMeshFromID
static mesh * getMeshFromID(string ID)
get a mesh from an ID.
game::setKeyDown
static game setKeyDown(string key)
set a key down.
game::scriptLoaded
static bool scriptLoaded(string filePath)
checks whether or not the script has loaded.
game::getSaveFileName
static game getSaveFileName(function func,...)
choose a file location to save using the operating system's file browser.
game::getTime
static int getTime()
get the time in milliseconds.
game::getOS
static string getOS()
get the operating system.
game::getScripts
static string[] getScripts(string folder="", string filter="")
get a table of all running script names.
game::isMobile
static bool isMobile()
get whether or not the OS is mobile.
game::drawRectangle
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.
game::getDPI
static multiReturn< int, int > getDPI()
gets the number of dots per inch on the screen.
game::setScript
static game setScript(string filePath, string code, bool remove=false)
set the code of the script with the given file path.
game::removeTimeouts
static game removeTimeouts(string func="*", string script=script:thisName())
removes one or more timers started by the matching script with the matching function name.
game::getElementFromPosition
static element * getElementFromPosition(int x, int y)
gets an element from an absolute position.
game::getWindowX
static int getWindowX(bool dpiAware=true)
get the window's x.
game::getElementFromID
static element * getElementFromID(string ID)
get a GUI element from an ID.
element
a 2D GUI element.
Definition: element.h:10
game::setTitle
static game setTitle(string title="")
sets the window title.
game::getImagePixels
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.
game::addError
static game addError(string err)
adds an error to be displayed.
game::isStatic
static bool isStatic()
gets whether or not the client is able to change worlds.
game::getOpenFileName
static game getOpenFileName(function func,...)
get a selected file from the operating system's file browser.
game::getFocusedElement
static element getFocusedElement()
gets the focused element.
game::openLink
static game openLink(string URL, bool newTab=true)
opens a link by URL.
game::getScript
static string getScript(string filePath)
get the code to the script with the given file path.
game::draw2dline
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.
game::loadScripts
static game loadScripts(string filePath)
load a script or scripts in a directory.
mesh
a 3D object.
Definition: mesh.h:7
game::getWindowWidth
static int getWindowWidth(bool dpiAware=true)
get the window's width.
game::setTimeout
static game setTimeout(int milliseconds, string func="",...)
sets a timer (in milliseconds) that is triggered when the time is up.