Tilemap collision working but needs speeding up

This commit is contained in:
Richard Davey
2013-04-25 20:05:56 +01:00
parent b8ab13fec8
commit b2e1434f5e
1336 changed files with 277759 additions and 6786 deletions
+14
View File
@@ -0,0 +1,14 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"boss": true,
"eqnull": true,
"node": true,
"es5": true
}
+3
View File
@@ -0,0 +1,3 @@
node_modules
npm-debug.log
tmp
+6
View File
@@ -0,0 +1,6 @@
language: node_js
node_js:
- "0.8"
- "0.10"
before_install:
- npm install -g grunt-cli
+5
View File
@@ -0,0 +1,5 @@
Chris Talkington (http://christalkington.com/)
Tyler Kellen (http://goingslowly.com/)
Kyle Robinson Young (http://twitter.com/shamakry)
Nathan Bleigh (http://www.nathanbleigh.com)
Eric Clemmons (http://ericclemmons.github.com)
+50
View File
@@ -0,0 +1,50 @@
v0.4.0:
date: 2013-03-26
changes:
- Output summary by default ("Copied N files, created M folders"). Individual transaction output available via `--verbose`.
v0.4.0:
date: 2013-02-15
changes:
- First official release for Grunt 0.4.0.
v0.4.0rc7:
date: 2013-01-23
changes:
- Updating grunt/gruntplugin dependencies to rc7.
- Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
v0.4.0rc5:
date: 2013-01-14
changes:
- Updating to work with grunt v0.4.0rc5.
- Conversion to grunt v0.4 conventions.
- Replace basePath with cwd.
- Empty directory support.
v0.3.2:
date: 2012-10-18
changes:
- Pass copyOptions on single file copy.
v0.3.1:
date: 2012-10-12
changes:
- Rename grunt-contrib-lib dep to grunt-lib-contrib.
v0.3.0:
date: 2012-09-24
changes:
- General cleanup and consolidation.
- Global options depreciated.
v0.2.4:
date: 2012-09-18
changes:
- No valid source check.
v0.2.3:
date: 2012-09-17
changes:
- Path.sep fallback for node <= 0.7.9.
v0.2.2:
date: 2012-09-17
changes:
- Single file copy support.
- Test refactoring.
v0.2.0:
date: 2012-09-07
changes:
- Refactored from grunt-contrib into individual repo.
+1
View File
@@ -0,0 +1 @@
Please see the [Contributing to grunt](http://gruntjs.com/contributing) guide for information on contributing to this project.
+90
View File
@@ -0,0 +1,90 @@
/*
* grunt-contrib-copy
* http://gruntjs.com/
*
* Copyright (c) 2012 Chris Talkington, contributors
* Licensed under the MIT license.
*/
module.exports = function(grunt) {
'use strict';
// Make an empty dir for testing as git doesn't track empty folders.
grunt.file.mkdir('test/fixtures/empty_folder');
grunt.file.mkdir('test/expected/copy_test_mix/empty_folder');
// Project configuration.
grunt.initConfig({
jshint: {
all: [
'Gruntfile.js',
'tasks/*.js',
'<%= nodeunit.tests %>'
],
options: {
jshintrc: '.jshintrc'
}
},
// Before generating any new files, remove any previously-created files.
clean: {
test: ['tmp']
},
test_vars: {
name: 'grunt-contrib-copy',
version: '0.1.0',
match: 'folder_one/*'
},
// Configuration to be run (and then tested).
copy: {
main: {
files: [
{expand: true, cwd: 'test/fixtures', src: ['*.*'], dest: 'tmp/copy_test_files/'},
{expand: true, cwd: 'test/fixtures', src: ['**'], dest: 'tmp/copy_test_mix/'},
{expand: true, cwd: 'test/fixtures', src: ['<%= test_vars.match %>'], dest: 'tmp/copy_test_v<%= test_vars.version %>/'}
]
},
flatten: {
files: [
{expand: true, flatten: true, filter: 'isFile', src: ['test/fixtures/**'], dest: 'tmp/copy_test_flatten/'}
]
},
single: {
files: [
{src: ['test/fixtures/test.js'], dest: 'tmp/single.js'}
]
},
verbose: {
files: [
{expand: true, src: ['test/fixtures/**'], dest: 'tmp/copy_test_verbose/'}
]
}
},
// Unit tests.
nodeunit: {
tests: ['test/*_test.js']
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-internal');
// Whenever the "test" task is run, first clean the "tmp" dir, then run this
// plugin's task(s), then test the result.
grunt.registerTask('test', ['clean', 'copy', 'nodeunit']);
// By default, lint and run all tests.
grunt.registerTask('default', ['jshint', 'test', 'build-contrib']);
};
+22
View File
@@ -0,0 +1,22 @@
Copyright (c) 2012 Chris Talkington, contributors
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
+75
View File
@@ -0,0 +1,75 @@
# grunt-contrib-copy [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-copy.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-copy)
> Copy files and folders.
## Getting Started
This plugin requires Grunt `~0.4.0`
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
```shell
npm install grunt-contrib-copy --save-dev
```
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
```js
grunt.loadNpmTasks('grunt-contrib-copy');
```
*This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that [you upgrade](http://gruntjs.com/upgrading-from-0.3-to-0.4), but in case you can't please use [v0.3.2](https://github.com/gruntjs/grunt-contrib-copy/tree/grunt-0.3-stable).*
## Copy task
_Run this task with the `grunt copy` command._
Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
### Options
#### processContent
Type: `Function(content, srcpath)`
This option is passed to `grunt.file.copy` as an advanced way to control the file contents that are copied.
#### processContentExclude
Type: `String`
This option is passed to `grunt.file.copy` as an advanced way to control which file contents are processed.
### Usage Examples
```js
copy: {
main: {
files: [
{src: ['path/*'], dest: 'dest/', filter: 'isFile'}, // includes files in path
{src: ['path/**'], dest: 'dest/'}, // includes files in path and its subdirs
{expand: true, cwd: 'path/', src: ['**'], dest: 'dest/'}, // makes all src relative to cwd
{expand: true, flatten: true, src: ['path/**'], dest: 'dest/', filter: 'isFile'} // flattens results to a single level
]
}
}
```
## Release History
* 2013-02-14v0.4.0First official release for Grunt 0.4.0.
* 2013-01-22v0.4.0rc7Updating grunt/gruntplugin dependencies to rc7. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.
* 2013-01-13v0.4.0rc5Updating to work with grunt v0.4.0rc5. Conversion to grunt v0.4 conventions. Replace basePath with cwd. Empty directory support.
* 2012-10-17v0.3.2Pass copyOptions on single file copy.
* 2012-10-11v0.3.1Rename grunt-contrib-lib dep to grunt-lib-contrib.
* 2012-09-23v0.3.0General cleanup and consolidation. Global options depreciated.
* 2012-09-17v0.2.4No valid source check.
* 2012-09-16v0.2.3Path.sep fallback for node <= 0.7.9.
* 2012-09-16v0.2.2Single file copy support. Test refactoring.
* 2012-09-06v0.2.0Refactored from grunt-contrib into individual repo.
---
Task submitted by [Chris Talkington](http://christalkington.com/)
*This file was generated on Fri Feb 22 2013 09:26:58.*
+14
View File
@@ -0,0 +1,14 @@
# Usage Examples
```js
copy: {
main: {
files: [
{src: ['path/*'], dest: 'dest/', filter: 'isFile'}, // includes files in path
{src: ['path/**'], dest: 'dest/'}, // includes files in path and its subdirs
{expand: true, cwd: 'path/', src: ['**'], dest: 'dest/'}, // makes all src relative to cwd
{expand: true, flatten: true, src: ['path/**'], dest: 'dest/', filter: 'isFile'} // flattens results to a single level
]
}
}
```
+11
View File
@@ -0,0 +1,11 @@
# Options
## processContent
Type: `Function(content, srcpath)`
This option is passed to `grunt.file.copy` as an advanced way to control the file contents that are copied.
## processContentExclude
Type: `String`
This option is passed to `grunt.file.copy` as an advanced way to control which file contents are processed.
+1
View File
@@ -0,0 +1 @@
Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
+1
View File
@@ -0,0 +1 @@
*This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that [you upgrade](http://gruntjs.com/upgrading-from-0.3-to-0.4), but in case you can't please use [v0.3.2](https://github.com/gruntjs/grunt-contrib-copy/tree/grunt-0.3-stable).*
+73
View File
@@ -0,0 +1,73 @@
{
"name": "grunt-contrib-copy",
"description": "Copy files and folders.",
"version": "0.4.1",
"homepage": "https://github.com/gruntjs/grunt-contrib-copy",
"author": {
"name": "Grunt Team",
"url": "http://gruntjs.com/"
},
"repository": {
"type": "git",
"url": "git://github.com/gruntjs/grunt-contrib-copy.git"
},
"bugs": {
"url": "https://github.com/gruntjs/grunt-contrib-copy/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/gruntjs/grunt-contrib-copy/blob/master/LICENSE-MIT"
}
],
"main": "Gruntfile.js",
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "grunt test"
},
"devDependencies": {
"grunt-contrib-jshint": "~0.2.0",
"grunt-contrib-nodeunit": "~0.1.2",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-internal": "~0.4.2",
"grunt": "~0.4.0"
},
"peerDependencies": {
"grunt": "~0.4.0"
},
"keywords": [
"gruntplugin"
],
"contributors": [
{
"name": "Chris Talkington",
"url": "http://christalkington.com/"
},
{
"name": "Tyler Kellen",
"url": "http://goingslowly.com/"
},
{
"name": "Kyle Robinson Young",
"url": "http://twitter.com/shamakry"
},
{
"name": "Nathan Bleigh",
"url": "http://www.nathanbleigh.com"
},
{
"name": "Eric Clemmons",
"url": "http://ericclemmons.github.com"
}
],
"readme": "# grunt-contrib-copy [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-copy.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-copy)\n\n> Copy files and folders.\n\n\n\n## Getting Started\nThis plugin requires Grunt `~0.4.0`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-contrib-copy --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-contrib-copy');\n```\n\n*This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that [you upgrade](http://gruntjs.com/upgrading-from-0.3-to-0.4), but in case you can't please use [v0.3.2](https://github.com/gruntjs/grunt-contrib-copy/tree/grunt-0.3-stable).*\n\n\n\n## Copy task\n_Run this task with the `grunt copy` command._\n\nTask targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.\n### Options\n\n#### processContent\nType: `Function(content, srcpath)`\n\nThis option is passed to `grunt.file.copy` as an advanced way to control the file contents that are copied.\n\n#### processContentExclude\nType: `String`\n\nThis option is passed to `grunt.file.copy` as an advanced way to control which file contents are processed.\n\n### Usage Examples\n\n```js\ncopy: {\n main: {\n files: [\n {src: ['path/*'], dest: 'dest/', filter: 'isFile'}, // includes files in path\n {src: ['path/**'], dest: 'dest/'}, // includes files in path and its subdirs\n {expand: true, cwd: 'path/', src: ['**'], dest: 'dest/'}, // makes all src relative to cwd\n {expand: true, flatten: true, src: ['path/**'], dest: 'dest/', filter: 'isFile'} // flattens results to a single level\n ]\n }\n}\n```\n\n\n## Release History\n\n * 2013-02-14v0.4.0First official release for Grunt 0.4.0.\n * 2013-01-22v0.4.0rc7Updating grunt/gruntplugin dependencies to rc7. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions.\n * 2013-01-13v0.4.0rc5Updating to work with grunt v0.4.0rc5. Conversion to grunt v0.4 conventions. Replace basePath with cwd. Empty directory support.\n * 2012-10-17v0.3.2Pass copyOptions on single file copy.\n * 2012-10-11v0.3.1Rename grunt-contrib-lib dep to grunt-lib-contrib.\n * 2012-09-23v0.3.0General cleanup and consolidation. Global options depreciated.\n * 2012-09-17v0.2.4No valid source check.\n * 2012-09-16v0.2.3Path.sep fallback for node <= 0.7.9.\n * 2012-09-16v0.2.2Single file copy support. Test refactoring.\n * 2012-09-06v0.2.0Refactored from grunt-contrib into individual repo.\n\n---\n\nTask submitted by [Chris Talkington](http://christalkington.com/)\n\n*This file was generated on Fri Feb 22 2013 09:26:58.*\n",
"readmeFilename": "README.md",
"_id": "grunt-contrib-copy@0.4.1",
"dist": {
"shasum": "f0753b40ae21bb706daefb0b299e03cdf5fa9d6e"
},
"_from": "grunt-contrib-copy@",
"_resolved": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-0.4.1.tgz"
}
+85
View File
@@ -0,0 +1,85 @@
/*
* grunt-contrib-copy
* http://gruntjs.com/
*
* Copyright (c) 2012 Chris Talkington, contributors
* Licensed under the MIT license.
* https://github.com/gruntjs/grunt-contrib-copy/blob/master/LICENSE-MIT
*/
module.exports = function(grunt) {
'use strict';
var path = require('path');
grunt.registerMultiTask('copy', 'Copy files.', function() {
var kindOf = grunt.util.kindOf;
var options = this.options({
processContent: false,
processContentExclude: []
});
var copyOptions = {
process: options.processContent,
noProcess: options.processContentExclude
};
grunt.verbose.writeflags(options, 'Options');
var dest;
var isExpandedPair;
var tally = {
dirs: 0,
files: 0
};
this.files.forEach(function(filePair) {
isExpandedPair = filePair.orig.expand || false;
filePair.src.forEach(function(src) {
if (detectDestType(filePair.dest) === 'directory') {
dest = (isExpandedPair) ? filePair.dest : unixifyPath(path.join(filePair.dest, src));
} else {
dest = filePair.dest;
}
if (grunt.file.isDir(src)) {
grunt.verbose.writeln('Creating ' + dest.cyan);
grunt.file.mkdir(dest);
tally.dirs++;
} else {
grunt.verbose.writeln('Copying ' + src.cyan + ' -> ' + dest.cyan);
grunt.file.copy(src, dest, copyOptions);
tally.files++;
}
});
});
if (tally.dirs) {
grunt.log.write('Created ' + tally.dirs.toString().cyan + ' directories');
}
if (tally.files) {
grunt.log.write((tally.dirs ? ', copied ' : 'Copied ') + tally.files.toString().cyan + ' files');
}
grunt.log.writeln();
});
var detectDestType = function(dest) {
if (grunt.util._.endsWith(dest, '/')) {
return 'directory';
} else {
return 'file';
}
};
var unixifyPath = function(filepath) {
if (process.platform === 'win32') {
return filepath.replace(/\\/g, '/');
} else {
return filepath;
}
};
};
+48
View File
@@ -0,0 +1,48 @@
var grunt = require('grunt');
var fs = require('fs');
exports.copy = {
main: function(test) {
'use strict';
test.expect(3);
var actual = fs.readdirSync('tmp/copy_test_files').sort();
var expected = fs.readdirSync('test/expected/copy_test_files').sort();
test.deepEqual(expected, actual, 'should copy several files');
actual = fs.readdirSync('tmp/copy_test_mix').sort();
expected = fs.readdirSync('test/expected/copy_test_mix').sort();
test.deepEqual(expected, actual, 'should copy a mix of folders and files');
actual = fs.readdirSync('tmp/copy_test_v0.1.0').sort();
expected = fs.readdirSync('test/expected/copy_test_v0.1.0').sort();
test.deepEqual(expected, actual, 'should parse both dest and src templates');
test.done();
},
flatten: function(test) {
'use strict';
test.expect(1);
var actual = fs.readdirSync('tmp/copy_test_flatten').sort();
var expected = fs.readdirSync('test/expected/copy_test_flatten').sort();
test.deepEqual(expected, actual, 'should create a flat structure');
test.done();
},
single: function(test) {
'use strict';
test.expect(1);
var actual = grunt.file.read('tmp/single.js');
var expected = grunt.file.read('test/expected/single.js');
test.equal(expected, actual, 'should allow for single file copy');
test.done();
}
};
@@ -0,0 +1 @@
$(document).ready(function(){});
@@ -0,0 +1 @@
console.log('hello');
@@ -0,0 +1 @@
$(document).ready(function(){$.noConflict();});
@@ -0,0 +1 @@
$(document).ready(function(){});
@@ -0,0 +1 @@
console.log('hello');
@@ -0,0 +1 @@
$(document).ready(function(){jQuery});
@@ -0,0 +1 @@
$(document).ready(function(){$.noConflict();});
@@ -0,0 +1 @@
$(document).ready(function(){jQuery});
+1
View File
@@ -0,0 +1 @@
$(document).ready(function(){});
+1
View File
@@ -0,0 +1 @@
console.log('hello');
@@ -0,0 +1 @@
$(document).ready(function(){$.noConflict();});
+1
View File
@@ -0,0 +1 @@
$(document).ready(function(){});
+1
View File
@@ -0,0 +1 @@
#This is a hidden file!!!
+1
View File
@@ -0,0 +1 @@
$(document).ready(function(){$.noConflict();});
+1
View File
@@ -0,0 +1 @@
$(document).ready(function(){jQuery});
+1
View File
@@ -0,0 +1 @@
$(document).ready(function(){});
+1
View File
@@ -0,0 +1 @@
console.log('hello');