Module AbstractRenderer-PIXI.Impl

let _create: system:string => ?⁠options:'a => unit => t;
let create: system:string => ?⁠options:Js.t({. antialias: Js.undefined(bool), autoDensity: Js.undefined(bool), backgroundColor: Js.undefined(int), clearBeforeRender: Js.undefined(bool), height: Js.undefined(float), preserveDrawingBuffer: Js.undefined(bool), resolution: Js.undefined(float), transparent: Js.undefined(bool), view: Js.undefined(Webapi.Dom.HtmlElement.t), width: Js.undefined(float), }) => unit => t;

creates a new abstract renderer

see /bs-pixi/PIXI/AbstactRenderer-PIXI/#val-createOptions

for options AbstractRenderer.createOptions

parameter system

The name of the system this renderer is for.

parameter options

The optional renderer parameters

let getAutoDensity: Js.t(_t) => bool;

Whether CSS dimensions of canvas view should be resized to screen dimensions automatically

let setAutoDensity: Js.t(_t) => bool => unit;

Whether CSS dimensions of canvas view should be resized to screen dimensions automatically

let getBackgroundColor: Js.t(_t) => int;

The background color to fill if not transparent

let setBackgroundColor: Js.t(_t) => int => unit;

The background color to fill if not transparent

let getCleanBeforeRender: Js.t(_t) => bool;

This sets if the CanvasRenderer will clear the canvas or not before the new render pass. If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect to clear the canvas every frame. Disable this by setting this to false. For example, if your game has a canvas filling background image you often don't need this set.

let setCleanBeforeRender: Js.t(_t) => bool => unit;

This sets if the CanvasRenderer will clear the canvas or not before the new render pass. If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect to clear the canvas every frame. Disable this by setting this to false. For example, if your game has a canvas filling background image you often don't need this set.

let getHeight: Js.t(_t) => float;

Same as view.height, actual number of pixels in the canvas by vertical

let getOptions: Js.t(_t) => 'a;

The supplied constructor options

let getPlugins: Js.t(_t) => rendererPlugins;

Collection of plugins

let getPreserveDrawingBuffer: Js.t(_t) => bool;

The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering

let setPreserveDrawingBuffer: Js.t(_t) => bool => unit;

The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering

let getResolution: Js.t(_t) => float;

The resolution / device pixel ratio of the renderer

let setResolution: Js.t(_t) => float => unit;

The resolution / device pixel ratio of the renderer

let getScreen: Js.t(_t) => Js.t(PIXI.Rectangle.#_t);

Measurements of the screen. (0, 0, screenWidth, screenHeight). Its safe to use as filterArea or hitArea for the whole stage

let setScreen: Js.t(_t) => Js.t(PIXI.Rectangle.#_t) => unit;

Measurements of the screen. (0, 0, screenWidth, screenHeight). Its safe to use as filterArea or hitArea for the whole stage

let getTransparent: Js.t(_t) => bool;

Whether the render view is transparent

let setTransparent: Js.t(_t) => bool => unit;

Whether the render view is transparent

let _getType: Js.t(_t) => int;
let getType: Js.t(_t) => PIXI.RENDERER_TYPE.t;

The type of the renderer

let getView: Js.t(_t) => Dom.element;

Whether the render view is transparent

let setView: Js.t(_t) => Dom.element => unit;

Whether the render view is transparent

let getWidth: Js.t(_t) => float;

Same as view.width, actual number of pixels in the canvas by horizontal

let destroy: Js.t(_t) => ?⁠removeView:bool => unit => unit;

Removes everything from the renderer and optionally removes the Canvas DOM element

parameter removeView

Removes the Canvas element from the DOM

let generateTexture: Js.t(_t) => displayObject:displayObjectOpaque => scaleMode:int => resolution:float => ?⁠region:Js.t(PIXI.Rectangle.#_t) => unit => renderTextureOpaque;

Useful function that returns a texture of the display object that can then be used to create sprites This can be quite useful if your displayObject is complicated and needs to be reused multiple times

parameter displayObject

The displayObject the object will be generated from

parameter scaleMode

Should be one of the scaleMode consts

parameter resolution

The resolution / device pixel ratio of the texture being generated

parameter region

The region of the displayObject, that shall be rendered, if no region is specified, defaults to the local bounds of the displayObject

returns

A texture of the graphics object

let initPlugins: Js.t(_t) => staticMap:'a => unit;

Resizes the screen and canvas to the specified width and height Canvas dimensions are multiplied by resolution

parameter screenWidth

The new width of the screen

parameter screenHeight

The new height of the screen

let resize: Js.t(_t) => screenWidth:float => screenHeight:float => unit;

Resizes the screen and canvas to the specified width and height Canvas dimensions are multiplied by resolution

parameter screenWidth

The new width of the screen

parameter screenHeight

The new height of the screen