-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added virtualjoystick.js support + announce canvas version in nowebgl…
… dialog
- Loading branch information
1 parent
728ae6a
commit c809b6b
Showing
11 changed files
with
413 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
vphy.VirtualJoystickAccelerator = vphy.Class({ | ||
__extends__ : vphy.Accelerator, | ||
__init__ : function(args){ | ||
var params = vphy.extend({ | ||
}, args); | ||
this.bodies = params.bodies; | ||
this.joystick = params.joystick; | ||
this.acceleration = params.acceleration; | ||
}, | ||
perform : function(){ | ||
var joystick = this.joystick; | ||
var acc = this.acceleration; | ||
var key = { | ||
right : joystick.right(), | ||
up : joystick.up(), | ||
left : joystick.left(), | ||
down : joystick.down() | ||
}; | ||
// TODO do something like device orientation | ||
// something which takes advantage of the analogic part | ||
for(var i = 0; i < this.bodies.length; i++){ | ||
var body = this.bodies[i]; | ||
if( key.right ) body.accelerate(+acc,0,0); | ||
if( key.left ) body.accelerate(-acc,0,0); | ||
if( key.up ) body.accelerate(0,0,-acc); | ||
if( key.down ) body.accelerate(0,0,+acc); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# makefile to automatize simple operations | ||
|
||
server: | ||
python -m SimpleHTTPServer | ||
|
||
deploy: | ||
# assume there is something to commit | ||
# use "git diff --exit-code HEAD" to know if there is something to commit | ||
# so two lines: one if no commit, one if something to commit | ||
git commit -a -m "New deploy" && git push -f origin HEAD:gh-pages && git reset HEAD~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a virtual joystick for touchscreen. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | ||
|
||
<style> | ||
body { | ||
overflow : hidden; | ||
padding : 0; | ||
margin : 0; | ||
background-color: #BBB; | ||
-webkit-user-select : none; | ||
} | ||
#info { | ||
position : absolute; | ||
top : 0px; | ||
width : 100%; | ||
padding : 5px; | ||
text-align : center; | ||
} | ||
#info a { | ||
color : #66F; | ||
text-decoration : none; | ||
} | ||
#info a:hover { | ||
text-decoration : underline; | ||
} | ||
#container { | ||
width : 100%; | ||
height : 100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="container"></div> | ||
<div id="info"> | ||
<a href="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/jeromeetienne/virtualjoystick.js" target="_blank">VirtualJoystick.js</a> | ||
A library javascript to provide a virtual joystick on touchscreen. | ||
- | ||
inspired by this | ||
<a href="https://sebleedelisle.com/2011/04/multi-touch-game-controller-in-javascripthtml5-for-ipad/">post</a> | ||
from | ||
<a href="https://sebleedelisle.com/">seb.ly</a> | ||
<br/> | ||
Touch the screen and move | ||
- | ||
works with mouse too as debug | ||
</div> | ||
<script src="virtualjoystick.js"></script> | ||
<script> | ||
var joystick = new VirtualJoystick({ | ||
container : document.getElementById('container'), | ||
debug : true | ||
}); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.