Skip to content

Commit

Permalink
Buzz now only renders changed layer while painting, and cleaned up im…
Browse files Browse the repository at this point in the history
…porting a bit.
  • Loading branch information
paulstraw committed Jan 10, 2013
1 parent 2784fbd commit 97c14f4
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 50 deletions.
16 changes: 9 additions & 7 deletions buzz/buzz.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion buzz/src/importer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Importer
levelObject.setPxSize()

# Remove old layers.
$('#layer-list').find('.delete').trigger('click')
$('#layer-list').find('li').off().remove()
window.buzz.layers = {}

for map in data.match(/c\.Map\((\[[^\n]+\],\n\{[^\}]+\})/g)
[fullMatch, data, options] = map.match(/c\.Map\((\[[^\n]+\]),\n(\{[^\}]+\})/)
Expand Down
2 changes: 1 addition & 1 deletion buzz/src/layerList.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class LayerList

layer.visible = !!clicked.prop('checked')

window.buzz.renderer.renderLayers()
window.buzz.renderer.renderLayer layer


addLayer: (e, data, options) =>
Expand Down
8 changes: 4 additions & 4 deletions buzz/src/layerOptions.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ class LayerOptions
@layer.type = type

window.buzz.renderer.switchLayer()
window.buzz.renderer.renderLayers()
window.buzz.renderer.renderLayer @layer

updateLayerTileSize: (e) =>
changed = $(e.target)
@layer.tileSize = parseInt(changed.val(), 10)
window.buzz.renderer.switchLayer()

window.buzz.renderer.renderLayers()
window.buzz.renderer.renderLayer @layer

updateLayerDistance: (e) =>
changed = $(e.target)
Expand All @@ -119,9 +119,9 @@ class LayerOptions
changed.blur()

window.buzz.renderer.switchLayer()
window.buzz.renderer.renderLayers()
window.buzz.renderer.renderLayer @layer

updateLayerZindex: (e) =>
changed = $(e.target)
@layer.zIndex = parseInt(changed.val(), 10)
window.buzz.renderer.renderLayers()
window.buzz.renderer.renderLayer @layer
2 changes: 2 additions & 0 deletions buzz/src/renderer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class Renderer


renderLayer: (layer) =>
$("#cider-layer-#{layer.id}").remove()

if layer.visible
$('#level-container').append layer.render()

Expand Down
2 changes: 1 addition & 1 deletion buzz/src/tileCursor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TileCursor
layer.data[row] ?= []
layer.data[row][col] = @index

window.buzz.renderer.renderLayers()
window.buzz.renderer.renderLayer layer


stopPainting: (e) =>
Expand Down
72 changes: 36 additions & 36 deletions codekit-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
"CodeKitInfo" : "This is a CodeKit project configuration file. It is designed to sync project settings across multiple machines. Modifying the contents of this file can be a poor life decision if you don't know what you're doing. This file is not useful unless accompanied by the project that created it in CodeKit. For more information, see: http:\/\/incident57.com\/codekit",
"creatorBuild" : "8241",
"files" : {
"\/docs\/gamecontroller.html" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/docs\/gamecontroller.html",
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 2048
},
"\/buzz\/jquery.js" : {
"ignoreWasSetByUser" : 1,
"ignore" : 1,
Expand All @@ -22,6 +13,15 @@
"outputAbbreviatedPath" : "\/buzz\/jquery-ck.js",
"fileType" : 64
},
"\/docs\/gamecontroller.html" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/docs\/gamecontroller.html",
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 2048
},
"\/src\/map.coffee" : {
"ignoreWasSetByUser" : 0,
"ignore" : 1,
Expand Down Expand Up @@ -188,14 +188,17 @@
"outputAbbreviatedPath" : "\/buzz\/buzz-ck.js",
"fileType" : 64
},
"\/docs\/docco.css" : {
"\/src\/platformerEntity.coffee" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
"ignore" : 1,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/docs\/docco.css",
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 16
"inputAbbreviatedPath" : "\/src\/platformerEntity.coffee",
"checkOutputStyle" : 0,
"minifyOutput" : 1,
"outputAbbreviatedPath" : "\/src\/platformerEntity.js",
"outputStyle" : 0,
"fileType" : 32
},
"\/buzz\/jquery-ui.js" : {
"ignoreWasSetByUser" : 1,
Expand All @@ -208,17 +211,14 @@
"outputAbbreviatedPath" : "\/buzz\/jquery-ui-ck.js",
"fileType" : 64
},
"\/src\/platformerEntity.coffee" : {
"\/docs\/docco.css" : {
"ignoreWasSetByUser" : 0,
"ignore" : 1,
"ignore" : 0,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/src\/platformerEntity.coffee",
"checkOutputStyle" : 0,
"minifyOutput" : 1,
"outputAbbreviatedPath" : "\/src\/platformerEntity.js",
"outputStyle" : 0,
"fileType" : 32
"inputAbbreviatedPath" : "\/docs\/docco.css",
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 16
},
"\/docs\/clock.html" : {
"ignoreWasSetByUser" : 0,
Expand Down Expand Up @@ -430,21 +430,23 @@
"fileType" : 4,
"debugStyle" : 0
},
"\/docs\/levelLoader.html" : {
"\/img\/box.png" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/docs\/levelLoader.html",
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 2048
"inputAbbreviatedPath" : "\/img\/box.png",
"processed" : 0,
"outputAbbreviatedPath" : "\/img\/box.png",
"initialSize" : 2612,
"fileType" : 8192
},
"\/docs\/modernizr.html" : {
"\/docs\/levelLoader.html" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/docs\/modernizr.html",
"inputAbbreviatedPath" : "\/docs\/levelLoader.html",
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 2048
},
Expand All @@ -459,25 +461,23 @@
"initialSize" : 3261,
"fileType" : 8192
},
"\/docs\/platformerEntity.html" : {
"\/docs\/modernizr.html" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/docs\/platformerEntity.html",
"inputAbbreviatedPath" : "\/docs\/modernizr.html",
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 2048
},
"\/img\/box.png" : {
"\/docs\/platformerEntity.html" : {
"ignoreWasSetByUser" : 0,
"ignore" : 0,
"hidden" : 0,
"outputPathIsSetByUser" : 0,
"inputAbbreviatedPath" : "\/img\/box.png",
"processed" : 0,
"outputAbbreviatedPath" : "\/img\/box.png",
"initialSize" : 2612,
"fileType" : 8192
"inputAbbreviatedPath" : "\/docs\/platformerEntity.html",
"outputAbbreviatedPath" : "No Output Path",
"fileType" : 2048
},
"\/src\/levelLoader.coffee" : {
"ignoreWasSetByUser" : 0,
Expand Down

0 comments on commit 97c14f4

Please sign in to comment.