Module AbstractRenderer-PIXI

type displayObjectOpaque;

used to resolve dependency cycle dependency cycle: src/C-PIXI.cmj -> src/Filter-PIXI.cmj -> src/RenderTexture-PIXI.cmj -> src/BaseRenderTexture-PIXI.cmj -> src/C1-PIXI.cmj -> src/Renderer-PIXI.cmj -> src/AbstractRenderer-cmj -> src/C-PIXI.cmj

FIXME: until this is resolved, feel free to force cast it with Obj.magic to DisplayObject.t or any structural subtype of Js.t(#C.displayObject)

type renderTextureOpaque;

used to resolve dependency cycle dependency cycle: src/RenderTexture-PIXI.cmj -> src/Texture-PIXI.cmj -> src/BaseTexture-PIXI.cmj -> src/Resource-PIXI.cmj -> src/Renderer-PIXI.cmj -> src/AbstractRenderer-PIXI.cmj -> src/RenderTexture-PIXI.cmj

FIXME: until this is resolved, feel free to force cast it with Obj.magic to RenderTexture.t or any structural subtype of Js.t(#RenderTexture._t)

include { ... };
include { ... };
type rendererPlugins;
let rendererPlugins: accessiblity:PIXI.Accessibility.AccessibilityManager.t => extract:PIXI.Extract.Extract.t => interaction:PIXI.Interaction.InteractionManager.t => prepare:PIXI.Prepare.Prepare.t => rendererPlugins;
let accessiblity: rendererPlugins => PIXI.Accessibility.AccessibilityManager.t;
let accessiblityGet: rendererPlugins => PIXI.Accessibility.AccessibilityManager.t;
let extract: rendererPlugins => PIXI.Extract.Extract.t;
let extractGet: rendererPlugins => PIXI.Extract.Extract.t;
let interaction: rendererPlugins => PIXI.Interaction.InteractionManager.t;
let interactionGet: rendererPlugins => PIXI.Interaction.InteractionManager.t;
let prepare: rendererPlugins => PIXI.Prepare.Prepare.t;
let prepareGet: rendererPlugins => PIXI.Prepare.Prepare.t;
let createOptions: ?⁠width:float => ?⁠height:float => ?⁠view:Webapi.Dom.HtmlElement.t => ?⁠transparent:bool => ?⁠autoDensity:bool => ?⁠antialias:bool => ?⁠resolution:float => ?⁠preserveDrawingBuffer:bool => ?⁠clearBeforeRender:bool => ?⁠backgroundColor:int => unit => Js.t({. width: Js.undefined(float), height: Js.undefined(float), view: Js.undefined(Webapi.Dom.HtmlElement.t), transparent: Js.undefined(bool), autoDensity: Js.undefined(bool), antialias: Js.undefined(bool), resolution: Js.undefined(float), preserveDrawingBuffer: Js.undefined(bool), clearBeforeRender: Js.undefined(bool), backgroundColor: Js.undefined(int), });

the optional create renderer parameters

parameter width

The width of the screen

parameter height

The height of the screen

parameter view

The canvas to use as a view

parameter transparent

If the render view is transparen

parameter autoDensity

Resizes renderer view in CSS pixels to allow for resolutions other than 1

parameter antialias

Sets antialias

parameter resolution

The resolution / device pixel ratio of the renderer. The resolution of the renderer retina would be 2

parameter preserveDrawingBuffer

Enables drawing buffer preservation, enable this if you need to call toDataUrl on the WebGL context

parameter clearBeforeRender

This sets if the renderer will clear the canvas or not before the new render pass

parameter backgroundColor

The background color of the rendered area (shown if not transparent)

class type _t = { ... }
type t = Js.t(_t);

The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the PIXI.CanvasRenderer and PIXI.Renderer which can be used for rendering a PixiJS scene.

module Impl: { ... };
include PIXI.EventEmitter.Impl;
let create: unit => PIXI.EventEmitter.t;
let eventNames: Js.t(PIXI.EventEmitter._t) => array(string);
let listeners: Js.t(PIXI.EventEmitter._t) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => array((Js.t({.. }) => unit));
let listenerCount: Js.t(PIXI.EventEmitter._t) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => int;
let emit: Js.t(PIXI.EventEmitter._t) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => bool;
let on: Js.t(PIXI.EventEmitter._t as 'd) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => fn:('b => unit) => ?⁠context:'c => unit => Js.t('d);
let addListener: Js.t(PIXI.EventEmitter._t as 'd) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => fn:('b => unit) => ?⁠context:'c => unit => Js.t('d);
let once: Js.t(PIXI.EventEmitter._t as 'd) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => fn:('b => unit) => ?⁠context:'c => unit => Js.t('d);
let removeListener: Js.t(PIXI.EventEmitter._t as 'b) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => ?⁠fn:(Js.t({.. }) => unit) => ?⁠context:Js.t({.. }) => ?⁠once:bool => unit => Js.t('b);
let off: Js.t(PIXI.EventEmitter._t as 'b) => event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => ?⁠fn:(Js.t({.. }) => unit) => ?⁠context:Js.t({.. }) => ?⁠once:bool => unit => Js.t('b);
let removeAllListeners: Js.t(PIXI.EventEmitter._t as 'b) => ?⁠event:[ `String(string) | `Symbol(PIXI.Symbol.t) ] => unit => Js.t('b);
include 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