0.5.2 • Published 3 years ago

snex v0.5.2

Weekly downloads
5
License
MIT
Repository
github
Last release
3 years ago

SNEX Virtual Gamepad SDK

Build Status

Library for using SNEX.io virtual gamepads providing SVG surface interaction, peering, and message sending.

What is it?

SNEX provides on-screen virtual gamepads that can connect to any web application using WebRTC. Just create a session, share the session token, and start receiving signals right away.

Usage

Node environment

1) Install

npm install snex

2) Implement

const snex = require('snex');

snex.createSession()
.then(session => {

    session.on('connection', conn => {
        console.log('Player joined!');

        conn.on('data', data => {
            if (data.state && data.key === 'A') {
                console.log('User pressed "A"');
            }
        });
    });

    return session.createURL('nes');
})
.then(desc => {
    console.log('Go to url to play', desc.url);
});

Browser

1) Add the following snippet to your site.

<script src="https://snex-cdn.pomle.com/snex.latest.min.js"></script>

2) Implement.

window.snex.createSession()
.then(session => {

    session.on('connection', conn => {
        console.log('Player joined!');

        conn.on('data', data => {
            if (data.state && data.key === 'A') {
                console.log('Player pressed "A"');
            }
        });
    });

    return session.createURL('nes');
})
.then(desc => {
    console.log('Go to url to play', desc.url);
});
0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

8 years ago

0.5.0-0

8 years ago

0.3.5-1

8 years ago

0.3.5-0

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.0.0

9 years ago