cheerpjCreateDisplay
Display GUI elements
cheerpjCreateDisplay
adds an element to the DOM which will be used for graphical rendering.
Parameters
- width (
number
) - The width of the display area in CSS pixels, or-1
to match parent width. - height (
number
) - The height of the display area in CSS pixels, or-1
to match parent height. - parent (
HTMLElement
, optional) - Element to add display as a child of.
Returns
cheerpjCreateDisplay
returns an HTMLElement
representing the created display.
Examples
Create a display
This creates a 800x600 display for rendering, and appends it to the document body.
Take up the whole page
This creates a display that takes up the whole page, and responds to changes in the page size.