Skip to content

Commit ec3eecc

Browse files
committed
add docs for all Matter.Render options
1 parent 6abb3b7 commit ec3eecc

1 file changed

Lines changed: 185 additions & 13 deletions

File tree

src/render/Render.js

Lines changed: 185 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* The `Matter.Render` module is a simple HTML5 canvas based renderer for visualising instances of `Matter.Engine`.
2+
* The `Matter.Render` module is a simple canvas based renderer for visualising instances of `Matter.Engine`.
33
* It is intended for development and debugging purposes, but may also be suitable for simple games.
44
* It includes a number of drawing options including wireframe, vector with support for sprites and viewports.
55
*
@@ -1424,6 +1424,38 @@ var Mouse = require('../core/Mouse');
14241424
* @default null
14251425
*/
14261426

1427+
/**
1428+
* A `Bounds` object that specifies the drawing view region.
1429+
* Rendering will be automatically transformed and scaled to fit within the canvas size (`render.options.width` and `render.options.height`).
1430+
* This allows for creating views that can pan or zoom around the scene.
1431+
* You must also set `render.options.hasBounds` to `true` to enable bounded rendering.
1432+
*
1433+
* @property bounds
1434+
* @type bounds
1435+
*/
1436+
1437+
/**
1438+
* The 2d rendering context from the `render.canvas` element.
1439+
*
1440+
* @property context
1441+
* @type CanvasRenderingContext2D
1442+
*/
1443+
1444+
/**
1445+
* The sprite texture cache.
1446+
*
1447+
* @property textures
1448+
* @type {}
1449+
*/
1450+
1451+
/**
1452+
* The mouse to render if `render.options.showMousePosition` is enabled.
1453+
*
1454+
* @property mouse
1455+
* @type mouse
1456+
* @default null
1457+
*/
1458+
14271459
/**
14281460
* The configuration options of the renderer.
14291461
*
@@ -1433,6 +1465,7 @@ var Mouse = require('../core/Mouse');
14331465

14341466
/**
14351467
* The target width in pixels of the `render.canvas` to be created.
1468+
* See also the `options.pixelRatio` property to change render quality.
14361469
*
14371470
* @property options.width
14381471
* @type number
@@ -1441,12 +1474,39 @@ var Mouse = require('../core/Mouse');
14411474

14421475
/**
14431476
* The target height in pixels of the `render.canvas` to be created.
1477+
* See also the `options.pixelRatio` property to change render quality.
14441478
*
14451479
* @property options.height
14461480
* @type number
14471481
* @default 600
14481482
*/
14491483

1484+
/**
1485+
* The [pixel ratio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio) to use when rendering.
1486+
*
1487+
* @property options.pixelRatio
1488+
* @type number
1489+
* @default 1
1490+
*/
1491+
1492+
/**
1493+
* A CSS background color string to use when `render.options.wireframes` is disabled.
1494+
* This may be also set to `'transparent'` or equivalent.
1495+
*
1496+
* @property options.background
1497+
* @type string
1498+
* @default '#14151f'
1499+
*/
1500+
1501+
/**
1502+
* A CSS background color string to use when `render.options.wireframes` is enabled.
1503+
* This may be also set to `'transparent'` or equivalent.
1504+
*
1505+
* @property options.wireframeBackground
1506+
* @type string
1507+
* @default '#14151f'
1508+
*/
1509+
14501510
/**
14511511
* A flag that specifies if `render.bounds` should be used when rendering.
14521512
*
@@ -1456,27 +1516,139 @@ var Mouse = require('../core/Mouse');
14561516
*/
14571517

14581518
/**
1459-
* A `Bounds` object that specifies the drawing view region.
1460-
* Rendering will be automatically transformed and scaled to fit within the canvas size (`render.options.width` and `render.options.height`).
1461-
* This allows for creating views that can pan or zoom around the scene.
1462-
* You must also set `render.options.hasBounds` to `true` to enable bounded rendering.
1519+
* A flag to enable or disable rendering entirely.
14631520
*
1464-
* @property bounds
1465-
* @type bounds
1521+
* @property options.enabled
1522+
* @type boolean
1523+
* @default false
14661524
*/
14671525

14681526
/**
1469-
* The 2d rendering context from the `render.canvas` element.
1527+
* A flag to toggle wireframe rendering otherwise solid fill rendering is used.
14701528
*
1471-
* @property context
1472-
* @type CanvasRenderingContext2D
1529+
* @property options.wireframes
1530+
* @type boolean
1531+
* @default true
14731532
*/
14741533

14751534
/**
1476-
* The sprite texture cache.
1535+
* A flag to enable or disable sleeping bodies indicators.
14771536
*
1478-
* @property textures
1479-
* @type {}
1537+
* @property options.showSleeping
1538+
* @type boolean
1539+
* @default true
1540+
*/
1541+
1542+
/**
1543+
* A flag to enable or disable the debug information overlay.
1544+
*
1545+
* @property options.showDebug
1546+
* @type boolean
1547+
* @default false
1548+
*/
1549+
1550+
/**
1551+
* A flag to enable or disable the collision broadphase debug overlay.
1552+
*
1553+
* @property options.showBroadphase
1554+
* @type boolean
1555+
* @default false
1556+
*/
1557+
1558+
/**
1559+
* A flag to enable or disable the body bounds debug overlay.
1560+
*
1561+
* @property options.showBounds
1562+
* @type boolean
1563+
* @default false
1564+
*/
1565+
1566+
/**
1567+
* A flag to enable or disable the body velocity debug overlay.
1568+
*
1569+
* @property options.showVelocity
1570+
* @type boolean
1571+
* @default false
1572+
*/
1573+
1574+
/**
1575+
* A flag to enable or disable the body collisions debug overlay.
1576+
*
1577+
* @property options.showCollisions
1578+
* @type boolean
1579+
* @default false
1580+
*/
1581+
1582+
/**
1583+
* A flag to enable or disable the collision resolver separations debug overlay.
1584+
*
1585+
* @property options.showSeparations
1586+
* @type boolean
1587+
* @default false
1588+
*/
1589+
1590+
/**
1591+
* A flag to enable or disable the body axes debug overlay.
1592+
*
1593+
* @property options.showAxes
1594+
* @type boolean
1595+
* @default false
1596+
*/
1597+
1598+
/**
1599+
* A flag to enable or disable the body positions debug overlay.
1600+
*
1601+
* @property options.showPositions
1602+
* @type boolean
1603+
* @default false
1604+
*/
1605+
1606+
/**
1607+
* A flag to enable or disable the body angle debug overlay.
1608+
*
1609+
* @property options.showAngleIndicator
1610+
* @type boolean
1611+
* @default false
1612+
*/
1613+
1614+
/**
1615+
* A flag to enable or disable the body and part ids debug overlay.
1616+
*
1617+
* @property options.showIds
1618+
* @type boolean
1619+
* @default false
1620+
*/
1621+
1622+
/**
1623+
* A flag to enable or disable the body vertex numbers debug overlay.
1624+
*
1625+
* @property options.showVertexNumbers
1626+
* @type boolean
1627+
* @default false
1628+
*/
1629+
1630+
/**
1631+
* A flag to enable or disable the body convex hulls debug overlay.
1632+
*
1633+
* @property options.showConvexHulls
1634+
* @type boolean
1635+
* @default false
1636+
*/
1637+
1638+
/**
1639+
* A flag to enable or disable the body internal edges debug overlay.
1640+
*
1641+
* @property options.showInternalEdges
1642+
* @type boolean
1643+
* @default false
1644+
*/
1645+
1646+
/**
1647+
* A flag to enable or disable the mouse position debug overlay.
1648+
*
1649+
* @property options.showMousePosition
1650+
* @type boolean
1651+
* @default false
14801652
*/
14811653

14821654
})();

0 commit comments

Comments
 (0)