Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tim #19

Merged
merged 14 commits into from
Sep 7, 2016
Merged

Tim #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "airbnb-base",
"rules": {
"no-use-before-define": 0,
"space-before-function-paren": ["error", "always"]
"space-before-function-paren": ["error", "always"],
"max-len": ["error", 120, 4]
}
}
51 changes: 51 additions & 0 deletions dreamcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,57 @@ swip(io, {

// client

/*
* automated
*
socket.emit('CONNECT_CLIENT', {
size: {
width: converter.toAbsPixel(container.width),
height: converter.toAbsPixel(container.height),
}
});

swip.sensor.onSwipe(container, function (evt) {
socket.emit('SWIPE', { direction: evt.direction, position: { x: converter.toAbsPixel(evt.position.x), y: converter.toAbsPixel(evt.position.y) }});
});

swip.sensor.onMotion(function () {
socket.emit('LEAVE_CLUSTER');
});
*
* */

swip.init({ socket: socket, container: container}, (client) => {

client.onSwip((evt) => {
//add animation
//what should happen on swipe
});

client.onJoin((evt) => {

});

client.onLeave((evt) => {
//add animation
//what should happen if client leaves
});

/*
client.onClick((evt) => {

});

//custom behaviour
client.emit('name', {data: data});

client.onUpdate((evt) => {

});

var converter = client.converter;
});*/

const client = swip.client(socket, container);

client.emit('movePaddle', { paddlePosition: 10 });
Expand Down
5 changes: 3 additions & 2 deletions examples/particleDemo/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ swip(io, {
particles: { $set: updatedParticles },
};
},
merge: () => ({}),
},
init: () => ({ particles: [] }),
},

client: {
init: () => ({}),
events: {
addParticle: ({ cluster, client }, particles) => {
addParticle: ({ cluster, client }, { particles }) => {
return {
cluster: {
data: { particles: { $push: particles } },
Expand All @@ -43,4 +44,4 @@ swip(io, {
});


server.listen(3000);
server.listen(3001);
Loading