Skip to content

Commit

Permalink
Issue #8
Browse files Browse the repository at this point in the history
Fixing crafty debug bar broken reference.  The Crafty Modules cdn for
community code sharing was killed.  Moved references to pull locally.
  • Loading branch information
sgmeyer committed Feb 6, 2014
1 parent 8c6a1d8 commit 9789d4e
Show file tree
Hide file tree
Showing 7 changed files with 515 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ CraftyGenerator.prototype.projectfiles = function projectfiles() {

this.copy('src/libs/crafty/_crafty.js', 'app/src/libs/crafty/crafty.js');
this.copy('src/libs/crafty/_crafty.min.js', 'app/src/libs/crafty/crafty.min.js');

this.copy('src/libs/craftydebug/_craftyDebug.js', 'app/src/libs/craftydebug/craftyDebug.js');
this.copy('src/libs/craftydebug/panels/_assets.js', 'app/src/libs/craftydebug/panels/assets.js');
this.copy('src/libs/craftydebug/panels/_entities.js', 'app/src/libs/craftydebug/panels/entities.js');
};

CraftyGenerator.prototype.gruntfileJSON = function gruntfile() {
Expand Down
7 changes: 6 additions & 1 deletion app/templates/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<script src="src/bower_components/backbone/backbone.js"></script>
<script src="src/bower_components/requirejs-jquery/parts/require.js"></script>
<script src="src/game.js"></script>

<!-- These are debugging libraries and can be removed if you don't want the debugger. -->
<script src="src/libs/CraftyDebug/craftyDebug.js"></script>
<script src="src/libs/CraftyDebug/panels/assets.js"></script>
<script src="src/libs/CraftyDebug/panels/entities.js"></script>
<script type="text/javascript">
gameContainer = {
env : 'dev',
Expand All @@ -34,7 +39,7 @@
sc = [], // container for backbone scene elements
infc = [] // container for backbone interface elements

Crafty.modules({ 'crafty-debug-bar': 'DEV' }, function () {
$(document).ready(function () {
Crafty.debugBar.show();
});
</script>
Expand Down
149 changes: 149 additions & 0 deletions app/templates/src/libs/CraftyDebug/_craftyDebug.js

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions app/templates/src/libs/CraftyDebug/panels/_assets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
(function(){

var styles = '#crafty-debug #assets-box{position: fixed;left: 110px;bottom: 35px;height: 200px;border: 1px solid #2F2F2F;display: none;background-color: white;border-bottom: 0px;padding-right: 10px;}\n'+
'#crafty-debug #assets-box .list{height: 165px;width: 200px; float:left}\n'+
'#crafty-debug #assets-box .list ul{color: #2F2F2F; height: 150px;width: 195px;overflow-y: scroll;padding-left: 5px;list-style-type: none;padding-right: 10px;font-size: 11px;margin-top: 0px;padding-top: 5px;}\n'+
'#crafty-debug #assets-box .list ul li a{padding: 3px 0px 3px 0px;border-bottom: 1px dashed #BBB;color: #2F2F2F; display:block; text-decoration: none}\n'
;
var assetsBox = '<div id="assets-box" class="panel-box">'+
'<div class="content">'+
'<div class="list">'+
'<div class="header">ASSETS<div class="separator"></div></div>'+
'<ul id="assets-box-list"></ul>'+
'</div>'+
'</div>'+
'</div>';

/*********** Renders ***********/

Crafty.debugBar.renders['renderAssetsList'] = function(e) {
$('#crafty-debug #assets-box .list ul#assets-box-list').append('<li>'+e.key+'</li>');
};

/*********** Events ***********/

$('#crafty-debug ul.menu li.assets').live('click',function(){
if ($('#assets-box').is(':visible')) {
$('#assets-box').hide();
} else {
$('.panel-box').hide();
$('#assets-box').show();
}
});

Crafty.bind('NewAsset', function(e){
Crafty.debugBar.renders['renderAssetsList'](e);
});

/*********** Register Panel ***********/

Crafty.debugBar.registerPanel({
'name' : 'Assets',
'description' : 'Game assets',
'styles': styles,
'panelBox' : assetsBox,
});

})();
Loading

0 comments on commit 9789d4e

Please sign in to comment.