1.0.0 • Published 7 years ago
fyogametable v1.0.0
Fyo Game Table Controller API
Fyo Game Table javascript API for creating Socket Game Pad Controllers
Install
bower install fyogametable
Usage
Connection and basic messages
var connecter = new FYO.FyoConnection('base_controller' /*required*/);
// Example Message to send
connector.Send('Hello', { world: 1337 });
// Example Receive
connector.on('SGUpdateMsg', function(packet) {
if(packet.MessageType == 'Points') {
alert('I got ' + packet.data + ' points!');
}
});
// or
connector.on('Points', function(data) {
alert('I got ' + data + ' points!');
});
Rendered Controls
var thumbstick = new FYO.ThumbStick3D(connecter, {
side: false,
container: 'mainContainer',
onmoved: function (data) {
connecter.SetAxis(FYO.AXIS[0], data.x, FYO.AXIS[1], -data.y);
}
});
var button = new FYO.Button3D(connecter, {
container: 'mainContainer',
image: '/fyogametable/assets/imgs/Blue_B.png',
ondown: function () {
connecter.SetButtonOn(FYO.BUTTON[0]);
},
onup: function () {
connecter.SetButtonOff(FYO.BUTTON[0]);
}
});
1.0.0
7 years ago