Module: screen

Screen API The API is used to manage content on the screen: fullscreen, HMD, HUD.

Summary

Methods

Detailed Description

Methods

check_fullscreen() → {boolean}

Check whether fullscreen mode is available.
Returns:
Result of the check.
Type
boolean
Source:

check_fullscreen_hmd() → {boolean}

Check whether HMD fullscreen mode is available.
Returns:
The result of the checking.
Type
boolean
Source:

draw_mixer_strip()

Draw the mixer strip. Used by mixer addon.
Source:

exit_fullscreen()

Exit fullscreen mode.
Source:

exit_fullscreen_hmd()

Exit HMD fullscreen mode.
Source:

exit_split_screen() → {boolean}

Exit "split screen" mode.
Returns:
"Split screen" mode is disabled.
Type
boolean
Source:

plot_array(header, slot, arr, arg_min, arg_max, val_min, val_max)

Plot the array.
Parameters:
Name Type Description
header string Plot header
slot number Slot number
arr Float32Array Array
arg_min number Minimum plot argument value
arg_max number Maximum plot argument value
val_min number Minimum plot value
val_max number Maximum plot value
Source:

request_fullscreen(elemopt, enabled_cbopt, disabled_cbopt)

Request fullscreen mode, i.e. presenting element entire to a screen. It is better to use request_fullscreen_hmd for presenting VR content on head-mounted display. Security issues: execute by user event.
Parameters:
Name Type Attributes Default Description
elem HTMLElement <optional>
Canvas container element HTML element.
enabled_cb FullscreenEnabledCallback <optional>
Enabled callback.
disabled_cb FullscreenDisabledCallback <optional>
Disabled callback.
Source:

request_fullscreen_hmd(elementopt, enabled_cbopt, disabled_cbopt)

Request HMD fullscreen mode. Use the function for represent VR content on a head-mounted display. The function requires using of a browser supporting WebVR API or a mobile browser supporting Fullscreen API. Security issues: execute by user event.
Parameters:
Name Type Attributes Default Description
element HTMLElement <optional>
Canvas container element HTML element.
enabled_cb GenericCallback <optional>
The callback will be called right after switching HMD fullscreen mode on.
disabled_cb GenericCallback <optional>
The callback will be called right after switching HMD fullscreen mode off.
Source:
Example
var m_input = require("input");
var m_screen = require("screen");
m_input.add_click_listener(document.body, function() {
    m_screen.request_fullscreen_hmd();
});

request_split_screen(enter_cbopt, exit_cbopt)

Request "split screen" mode, which represent rendering two eyes suitable for head-mounted displays. The function requires setting the "stereo" config to "HMD" {see @link module:config}, using a browser supporting WebVR API or a mobile browser.
Parameters:
Name Type Attributes Description
enter_cb GenericCallback <optional>
The callback will be called right after turning split screen mode on.
exit_cb GenericCallback <optional>
The callback will be called right after turning split screen mode off.
Source:
Example
var m_app = require("app");
var m_screen = require("screen");
exports.init = function() {
    m_app.init({
        // . . .
        stereo: "HMD"
   });
}

m_screen.request_split_screen();

shot(formatopt, qualityopt)

Take a screenshot and download as screenshot.png image.
Parameters:
Name Type Attributes Default Description
format string <optional>
"image/png" The MIME image format ("image/png", "image/jpeg", "image/webp" and so on)
quality number <optional>
1.0 Number between 0 and 1 for types: "image/jpeg", "image/webp"
Source:
Example
var m_screen = require("screen");
m_screen.shot();