1.1.0 • Published 3 months ago

gamepadzilla v1.1.0

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
github
Last release
3 months ago

:t-rex: GamepadZilla la la!

npm cdn

A plug-and-play gamepad frontend framework for HTML5 mobile games, supporting both virtual and physical joysticks. No scripting required.

:video_game: Preview:joystick: Features
virtual gamepadgpz is fast. (no DOM manpulation)gpz is easy. (no Javascript needed, use only html5 attributes)gpz is pure. (made with only typescript without dependencies)gpz hates the van's old-man!

showcase

post your open-source game using gamepadzilla!

gamestacksource
Coco Battle Royale 2C, Assembly 6502, WebAssembly, Html, gampadzila.js:octocat:repo

How to use

  • import library with npm or cdn. :minibus:
  • create html5 canvas elements with class gpz-joy or gpz-btn and configure data attributes.
<!DOCTYPE html>
<html>
    <head>
        <script src='https://cdn.jsdelivr.net/npm/gamepadzilla@1/dist/gamepadzilla.js'></script>
    </head>
    <body style="touch-action: none">
        <canvas
            class="gpz-joy"
            data-gpz-bind="ArrowUp ArrowLeft ArrowDown ArrowRight">
        </canvas>
        <canvas
            class="gpz-btn"
            data-gpz-bind="KeyF">
        </canvas>
    </body>
</html>

How to build

if you intend to contribute, let's rock! :guitar:

bun :rice:

bun run build

nodejs :rage1:

npm install
npm run build

container :whale2:

podman run --rm -v $(pwd):/app -w /app  -it oven/bun bun run build
docker run --rm -v $(pwd):/app -w /app  -it ove/bun bun run build

Cheatsheet

main classes

html5 classdescription
gpz-dpadvirtual digital pad for directional input.
gpz-joyvirtual stick or gamepad analog for directional input.
gpz-btnvirtual circle buttons with various console layouts.

data attributes

html5 attributehtml5 classdescription
data-gpz-bind*keyboard to emulate(follows anti-clockwise button pattern like:WASD)
data-gpz-vibrate*vibration animation when pressed for feedbackfeedback vibration when interact
data-gpz-colorgpz-dpadgpz-btnbutton colors when is not pressed
data-gpz-color-actiongpz-dpadgpz-btnbuttons colors when is pressed
data-gpz-sizegpz-dpadsize of shapes elements
data-gpz-offsetgpz-dpadsize of gap in elements

This project is licensed under GNU Affero General Public License 3.0, please read the LICENSE file.

1.1.0

3 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago