Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Consistent style
  • Loading branch information
mcmire committed Feb 3, 2013
1 parent d83560a commit ff77ed7
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion html/repulsion.html
Expand Up @@ -18,10 +18,10 @@
<script src="../js/lib/vec2.js"></script>
<script src="../js/lib/drawable.js"></script>
<script src="../js/lib/drawable_collection.js"></script>
<script src="../js/lib/canvas_helpers.js"></script>
<script src="../js/lib/collision.mixin.js"></script>
<script src="../js/lib/canvas_object.js"></script>
<script src="../js/lib/canvas.js"></script>
<script src="../js/lib/canvas_helpers.js"></script>

<script src="../js/demos/repulsion.js"></script>
</body>
Expand Down
8 changes: 3 additions & 5 deletions js/lib/canvas.js
@@ -1,8 +1,8 @@

'use strict';

var Canvas = P(function(proto, uber, klass, uberklass) {
$.v.extend(proto, {
window.Canvas = P(function(proto, uber, klass, uberklass) {
return {
init: function(id, options) {
this.$wrapperElement = $(id)
this.options = options || {}
Expand Down Expand Up @@ -271,8 +271,6 @@ var Canvas = P(function(proto, uber, klass, uberklass) {
_clearDebug: function() {
this.$debugDiv.html("")
}
})

$.v.extend(proto, CanvasHelpers)
}
})

6 changes: 3 additions & 3 deletions js/lib/canvas_helpers.js
@@ -1,7 +1,7 @@

'use strict'
'use strict';

var CanvasHelpers = {
$.v.extend(Canvas.prototype, {
line: function(x1, y1, x2, y2, options) {
var options
options = $.v.extend({}, options, {
Expand Down Expand Up @@ -131,5 +131,5 @@ var CanvasHelpers = {
options.origin = [0, 0]
return options
}
}
})

4 changes: 2 additions & 2 deletions js/lib/canvas_object.js
@@ -1,7 +1,7 @@

'use strict';

var CanvasObject = P(Drawable, function(proto, uber) {
window.CanvasObject = P(Drawable, function(proto, uber) {
return {
init: function(parent, opts) {
uber.init.call(this, parent)
Expand Down Expand Up @@ -35,7 +35,7 @@ var CanvasObject = P(Drawable, function(proto, uber) {
setPos: function(interpFactor) {
// this.pos + this.vel represents the target position
// however, we have to take the interpolation factor into play
// on every update, this.pos
// on every update, this.pos
this.pos[0] += this.vel[0] * interpFactor
this.pos[1] += this.vel[1] * interpFactor
},
Expand Down
3 changes: 2 additions & 1 deletion js/lib/collision.mixin.js
@@ -1,7 +1,7 @@

'use strict';

var collision = {
window.collision = {
applyTo: function(canvas, obj) {
var bb, newpos, ob, dxa, dxb, dya, dyb, velslope, newvel

Expand Down Expand Up @@ -56,3 +56,4 @@ var collision = {
}
}
}

4 changes: 2 additions & 2 deletions js/lib/drawable.js
@@ -1,7 +1,7 @@

'use strict'
'use strict';

var Drawable = P(function () {
window.Drawable = P(function () {
return {
init: function(parent) {
this.setParent(parent)
Expand Down
4 changes: 2 additions & 2 deletions js/lib/drawable_collection.js
@@ -1,7 +1,7 @@

'use strict'
'use strict';

var DrawableCollection = P(Drawable, function (proto, uber) {
window.DrawableCollection = P(Drawable, function (proto, uber) {
return {
init: function (parent) {
uber.init.call(this, parent)
Expand Down
5 changes: 3 additions & 2 deletions js/lib/gravity.mixin.js
@@ -1,7 +1,8 @@

'use strict'
'use strict';

var Gravity = {
// FIXME
window.Gravity = {
mixin: function(args) {
args.canvasClass.prototype.objectGravity = function(obj) {
var newvel, balls, newpos
Expand Down
2 changes: 2 additions & 0 deletions js/lib/request_anim_shims.js
@@ -1,4 +1,6 @@

'use strict';

(function() {
var fallbackCancelRequestAnimationFrame,
fallbackRequestAnimationFrame,
Expand Down
4 changes: 2 additions & 2 deletions js/lib/util.js
@@ -1,7 +1,7 @@

'use strict'
'use strict';

var util = (function () {
window.util = (function () {
var util = {},
rand = {},
arr = {},
Expand Down
2 changes: 2 additions & 0 deletions js/lib/valentine_ext.js
@@ -1,4 +1,6 @@

'use strict';

// Zip together multiple lists into a single array -- elements that share
// an index go together.
// Taken from Underscore
Expand Down
4 changes: 3 additions & 1 deletion js/lib/vec2.js
@@ -1,8 +1,10 @@

'use strict';

// The idea for the third argument to the operations comes from:
// http://media.tojicode.com/sfjs-vectors/#31

var Vec2 = function (x, y) {
window.Vec2 = function (x, y) {
// TODO: Use a Int16Array?
return [x, y]
}
Expand Down

0 comments on commit ff77ed7

Please sign in to comment.