Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@benev/nubs
Advanced tools
Readme
nubs is a user-input system for web games.
⚡ live demo! nubs.benevolent.games
👂 nubs listens to keyboards, mice, gamepads, etc
🕹️ nubs has mobile-friendly virtual devices, like thumbsticks and buttons
📝 nubs has a keybinds editor so users to customize their controls
🔠 nubs has a grid-based menu system that is good for hotkeys
👼 a project by benevolent.games
💖 free and open source
<head>
<script
type=importmap-shim
src="https://unpkg.com/@benev/nubs/x/importmap.json"
defer
></script>
<script
type=module-shim
src="https://unpkg.com/@benev/nubs/x/html.js"
defer
></script>
<script
src="https://unpkg.com/es-module-shims/dist/es-module-shims.wasm.js"
defer
></script>
npm install @benev/nubs
import {getElements, registerElements, themeElements, themeCss} from "@benev/nubs"
// run customElements.define
registerElements(
// apply a common css theme
themeElements(
// stylesheet applied into the shadow doms
themeCss,
// get all nub element classes
getElements(),
)
)
<body>
<nub-stick></nub-stick>
nub_cause
events<nub-pointer></nub-pointer>
nub_cause
events<nub-context>
<nub-context>
<nub-keyboard></nub-keyboard>
<nub-pointer></nub-pointer>
<nub-stick name=Stick1></nub-stick>
<nub-stick name=Stick2></nub-stick>
</nub-context>
bindings
bindings
KeyW
forward
nub_effect
events like forward
rather than the causesnub_cause
events:
like keyboard key presses and mouse movements.
all nub devices like <nub-keyboard>
or <nub-stick>
dispatch these events.nub_effect
events:
like "forward" or "open menu".
these are dispatched by a <nub-context>
element, based on the user's bindings.
the bindings allow users to customize which effects are triggered by which causes.devices
<nub-keyboard>
(real device)
listens to real mouse or touch inputs.<nub-pointer>
(real device)
listens to real keyboard inputs.<nub-stick>
(virtual device)
mobile-friendly thumbstick.<nub-stickpad>
(virtual device)
thumbstick area, which centers the stick wherever your touch starts.<nub-lookpad>
(virtual device)
area for tracking touch movements, to emulate a mouse.<nub-gridboard>
(hybrid device)bindings, editing, and troubleshooting
<nub-context>
listens for nub_cause
events, and dispatches nub_effect
events, based on the current bindings
.
only listens to nub_cause
events nested within the nub-context element.<nub-editor>
interface for users to customize their bindings.<nub-visualizer>
see what's going on, which nub_effect
events are being dispatched.FAQs
user-input system for web games
The npm package @benev/nubs receives a total of 4 weekly downloads. As such, @benev/nubs popularity was classified as not popular.
We found that @benev/nubs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.