2.0.0 • Published 6 years ago

settingspanel v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

settingspanel.js

hideable UI to change game settings during runtime

Live Example

https://davidfig.github.io/settingspanel/

Installation

npm i settingspanel

API Reference

SettingsPanel

a settings panel for changing and watching parameters during runtime

Kind: global class

new SettingsPanel(options)

ParamTypeDefaultDescription
optionsobject
options.styleobjectCSS style to apply to the parent div
options.parentobjectdocument.bodywhere to append div
options.colorstring"'white'"default foreground
options.backgroundstring"'black'"default background
options.openbooleantrueshow when starting
options.sidestring"'right'"change side: 'left' or 'right'

settingsPanel.button(text, callback, options)

adds a button with callback

Kind: instance method of SettingsPanel

ParamTypeDescription
textstringto display
callbackfunctionon button click if returns a value, then replaces button text with text + result
optionsobject
options.originalobjectoriginal settings for button - sets text as text + original change through callback (see above)
options.colorstringforeground color
options.backgroundstringbackground color
options.styleobjectCSS for button

settingsPanel.input(label, callback, options)

adds an input panel

Kind: instance method of SettingsPanel

ParamTypeDescription
labelstringtext
callbackfunctionon change input
optionsobject
options.originalobjectoriginal settings for input
options.colorstringforeground color
options.backgroundstringbackground color
options.styleobjectCSS for button
options.sameLinebooleansame line for label and text
options.sizenumbersize (number of characters) of input box

settingsPanel.hide()

hides the SettingsPanel

Kind: instance method of SettingsPanel

settingsPanel.show()

shows the SettingsPanel

Kind: instance method of SettingsPanel

settingsPanel.side(side)

change side of panel

Kind: instance method of SettingsPanel

ParamTypeDescription
sidestring'left' or 'right'

Copyright (c) 2017 YOPEY YOPEY LLC - MIT License - Documented by jsdoc-to-markdown

2.0.0

6 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago