Browser::newHeadless
Client-Side Function
JavaScript |
---|
JavaScript Syntax
With headless browser, you can create anything in HTML and use it in game as game texture, for example applying its texture to a object or drawing it as a sprite.
Required Params
- url: string
- width: number
- height: number
- forceFlip: boolean
Return value
- Object
Syntax
mp.browsers.newHeadless(url, width, height, forceFlip);
Example
const browser = mp.browsers.newHeadless("http://package/page/index.html", 1920, 1080, false);
mp.events.add('render', () => {
if (browser && mp.browsers.exists(browser)) {
mp.game.graphics.drawSprite(browser.headlessTextureDict, browser.headlessTextureName, 0.5, 0.5, 0.1, 0.1, 0, 255, 255, 255, 100, true);
}
})
See also
- Functions:
- Properies: