0.0.1 • Published 6 years ago
@creenv/hud v0.0.1
Creenv HUD
The HUD object can be used to regroup different elements from the @creenv Creative Environment, such as . Any element added to the HUD must inherit the @creenv/hud-element HUDElement class.
Right now, @creenv supports officialy those elements:
- @creenv/gui GUI - a panel used to have a graphical control over parameters used within the algorithms
- @creenv/stats Stats - a wrapper of mrdoob stat.js, used to display statistics about the render
How to use
import HUD from "@creenv/hud";
// hud elements
import Stats from "@creenv/stats";
import GUI from "@creenv/gui";
let hud = new HUD();
let stats = new Stats();
hud.add(stats);
let controls = /* bla bla, see @creenv/gui for more details */;
let gui = new GUI(controls);
hud.add(gui);
That is done, stats will be added to the page so will the controls.
Full doc
Following is a full list of @creenv/hud available methods.
constructor (visible: ?boolean, toggleKey: ?string, infoMessage: false|string)
Name | Type | Definition | Default |
---|---|---|---|
visible | boolean | (Optional) Weither the HUD is visible at first or not | true |
toggleKey | string | (Optional) The keyboard key which toggle the visibility of all the items within the HUD (visible/hidden) | h |
infoMessage | false|string | (Optional) If set to false, no message will be displayed. However if a string is set it will be displayed at the bottom of the screen as a reminder for the users |
.toggle (visible: ?boolean)
Can force the visibility of the HUD if visible is defined, otherwise toggles the HUD to its opposite state.
Name | Type | Definition | Default |
---|---|---|---|
visible | boolean | If undefined, the elements from the HUD will be toggle to the opposite state of what they actually are. However if set to true or false, will force the visibility of the HUD to specified state |
.add (element: HUDElement)
Adds an element to the HUD. The element must be intance or child of @creenv/hud-element HUDElement.
Name | Type | Definition | Default |
---|---|---|---|
element | HUDElement | The HUDElement to be added |
0.0.1
6 years ago