The GTK::Runtime class is the core of DragonRuby. It is globally accessible via $gtk or inside of the tick method through args.
def tick args
args.gtk # accessible like this
$gtk # or like this
end
Function | Description |
---|---|
argv | Returns a String of the command line parameters. |
cli_arguments | Returns a Hash of the command line parameters. |
quit_requested? | Returns true if a request to quit the Application was made. |
request_quit | Makes a request for DragonRuby to clean up the Application process and quit to the operating system. |
Function | Description |
---|---|
benchmark | Used to compare the performance of blocks of code. |
production? | Returns true if the DragonRuby Application is running as a Production release. |
current_framerate | Returns a float representing the moving average of the frame rate. |
disable_console | Disables the DragonRuby Console so that it will no longer appear. |
download_stb_rb | Downloads a Ruby file from Github. |
download_stb_raw | Downloads a raw file from Github. |
enable_console | Enables the DragonRuby Console so that it can be shown and hidden. |
framerate_diagnostics_primitives | Primitives that display statistics about your DragonRuby app. |
hide_console | Hide the DragonRuby Console and resumes the game. |
notify_extended! | Displays a message banner even in Production mode. |
notify! | Displays a message banner while in Development mode. |
open_game_dir | Opens the OS’ file manager to the location of the game directory. |
reload_history | Returns a Hash of the code files and their load timings. |
reload_history_pending | Returns a Hash of files that are queued for loading. |
reload_if_needed | Queues a file for reload, if it has been modified. |
reset | Immediately resets DragonRuby to its starting state. |
reset_next_tick | Resets DragonRuby to its starting state by the next tick. |
reset_sprite | Invalidates a cached sprite causing it to be reloaded from disk. |
reset_sprites | Invalidates all cached sprites causing them to be reloaded. |
show_console | Displays the DragonRuby Console. |
slowmo! | Divides the target frame rate by a factor to simulate slow performance. |
version | Returns a String containing the DragonRuby version that is running. |
version_pro? | Returns True if DragonRuby can use non-Standard features. |
warn_array_primitives! | Logs warnings when array-based primitives are being used in your code. |
Function | Description |
---|---|
cancel_recording | Stops and discards current gameplay recording. |
start_recording | Resets DragonRuby engine and starts recording gameplay. |
start_replay | Runs a replay recording. |
stop_recording | Stops gameplay recording and writes the current session to a file. |
stop_replay | Stops a currently executing replay. |
Function | Description |
---|---|
append_file | Adds content to the end of an existing file. |
append_file_root | Adds content to the end of an existing file even outside the sandbox. |
delete_file | Removes a file from the OS file system. |
delete_file_if_exist | Removes a file from the OS file system. |
get_base_dir | Returns the location of the DragonRuby binary. |
get_game_dir | Returns the path to the sandbox game storage location. |
get_game_dir_url | Returns a URL to the sandbox game storage location. |
list_files | Returns an array of filenames in a given path. |
read_file | Returns the contents of a file as a String. |
stat_file | Returns a Hash containing statistics about the given file. |
write_file | Creates/Overwrites a given file with the supplied contents. |
write_file_root | Creates/Overwrites a given file with the supplied contents even outside the sandbox. |
Function | Description |
---|---|
get_pixels | Loads a sprite file as a 1D-array of color values. |
dlopen | Loads a Dynamic Library. Uses C-Extension feature. |
Function | Description |
---|---|
parse_json | Converts JSON data from a String into a Hash. |
parse_json_file | Converts JSON data from a File into a Hash. |
parse_xml | Converts XML data from a String into a Hash. |
parse_xml_file | Converts XML data from a File into a Hash. |
Function | Description |
---|---|
cursor_shown? | Returns true if the Mouse Cursor is visible. |
hide_cursor | Turns the Mouse Cursor invisible. |
set_cursor | Sets the sprite used for the Mouse Cursor. |
set_mouse_grab | Sets the Grab mode of the Mouse Cursor. |
set_system_cursor | Changes the appearance of the Mouse Cursor using system cursors. |
show_cursor | Turns the Mouse Cursor visible. |
Function | Description |
---|---|
http_get | Asynchronously, returns an object representing the HTTP response to a GET request. |
http_post | Asynchronously, returns an object representing the HTTP response to a POST request. |
http_post_body | Asynchronously, returns an object representing the HTTP response to a POST request. |
start_server! | Opens a networking port for listening as a server. |
Function | Description |
---|---|
exec | Executes a OS shell command and returns result in a string. |
open_url | Opens the URL in user’s default browser. |
platform_mappings | A hash of attributes related to each OS platform. |
platform? | The OS platform that DragonRuby is currently running on. |
system | Executes a OS shell command and returns result to the console. |
Function | Description |
---|---|
calcstringbox | Returns the pixel dimensions of a String should it be rendered in a font. |
Function | Description |
---|---|
set_window_fullscreen | Sets the game to Fullscreen or Windowed modes. |
set_window_scale | Sets a scaling factor for the Window. |
window_fullscreen? | Returns true if the Window is currently in Fullscreen mode. |