Skip to content

Commit fc1b8d0

Browse files
committed
initial commit
1 parent b4d9d87 commit fc1b8d0

39 files changed

+38816
-3
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
npm-debug.log
3+
build/matter-tools-dev.js
4+
build/matter-tools-dev.min.js

.jshintrc

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// settings
3+
"passfail" : false, // Stop on first error.
4+
"maxerr" : 100, // Maximum error before stopping.
5+
6+
// dev
7+
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
8+
"devel" : true, // Allow developments statements e.g. `console.log();`.
9+
10+
// ECMAScript 5
11+
"es5" : false, // Allow ECMAScript 5 syntax.
12+
"strict" : false, // Require `use strict` pragma in every file.
13+
"globalstrict" : false, // Allow global "use strict" (also enables 'strict').
14+
15+
// options
16+
"laxbreak" : true, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
17+
18+
// style
19+
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
20+
"noempty" : true, // Prohibit use of empty blocks.
21+
"nonew" : true, // Prohibit use of constructors for side-effects.
22+
"onevar" : false, // Allow only one `var` statement per function.
23+
"plusplus" : false, // Prohibit use of `++` & `--`.
24+
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
25+
"trailing" : false, // Prohibit trailing whitespaces.
26+
"white" : false, // Check against strict whitespace and indentation rules.
27+
"indent" : 4 // Specify indentation spacing
28+
}

.travis.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: node_js
2+
node_js:
3+
- "0.10"
4+
before_install: npm install -g grunt-cli
5+
install: npm install
6+
before_script: grunt

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Matter Tools Changelog
2+
3+
[brm.io/matter-js](http://brm.io/matter-js)
4+
5+
----------
6+
7+
## 0.5.0-alpha
8+
9+
- initial release

Gruntfile.js

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
module.exports = function(grunt) {
2+
grunt.initConfig({
3+
pkg: grunt.file.readJSON('package.json'),
4+
buildName: 'matter-tools',
5+
buildVersion: '<%= pkg.version %>-edge',
6+
docVersion: 'v<%= pkg.version %>',
7+
concat: {
8+
build: {
9+
options: {
10+
process: function(src, filepath) {
11+
return '// Begin ' + filepath + '\n\n' + src + '\n\n; // End ' + filepath + '\n\n';
12+
}
13+
},
14+
src: ['src/**/*.js', '!src/module/*'],
15+
dest: 'build/<%= buildName %>.js'
16+
},
17+
pack: {
18+
options: {
19+
banner: '/**\n* <%= buildName %>.js <%= buildVersion %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n'
20+
},
21+
src: ['src/module/Intro.js', 'build/<%= buildName %>.js', 'src/module/Outro.js', 'libs/**/*.js'],
22+
dest: 'build/<%= buildName %>.js'
23+
},
24+
buildCss: {
25+
src: ['libs/jstree/themes/default/style.min.css', 'src/css/*.css'],
26+
dest: 'build/matter-tools.css'
27+
}
28+
},
29+
uglify: {
30+
min: {
31+
options: {
32+
banner: '/**\n* <%= buildName %>.min.js <%= buildVersion %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n'
33+
},
34+
src: 'build/<%= buildName %>.js',
35+
dest: 'build/<%= buildName %>.min.js'
36+
},
37+
dev: {
38+
options: {
39+
mangle: false,
40+
compress: false,
41+
preserveComments: false,
42+
beautify: {
43+
width: 32000,
44+
indent_level: 2,
45+
space_colon: false,
46+
beautify: true
47+
},
48+
banner: '/**\n* <%= buildName %>.min.js <%= buildVersion %> <%= grunt.template.today("yyyy-mm-dd") %>\n* <%= pkg.homepage %>\n* License: <%= pkg.license %>\n*/\n\n'
49+
},
50+
src: 'build/<%= buildName %>.js',
51+
dest: 'build/<%= buildName %>.js'
52+
}
53+
},
54+
cssmin: {
55+
minify: {
56+
src: ['build/matter-tools.css'],
57+
dest: 'build/matter-tools.min.css'
58+
}
59+
},
60+
copy: {
61+
demo: {
62+
files: [
63+
{
64+
src: 'build/<%= buildName %>.js',
65+
dest: 'demo/js/libs/<%= buildName %>.js'
66+
},
67+
{
68+
src: 'build/matter-tools.css',
69+
dest: 'demo/css/matter-tools.css'
70+
}
71+
]
72+
}
73+
},
74+
jshint: {
75+
options: {
76+
jshintrc: '.jshintrc'
77+
},
78+
all: ['src/**/*.js', '!src/module/*']
79+
},
80+
connect: {
81+
watch: {
82+
options: {
83+
port: 9000,
84+
open: 'http://localhost:9000/demo',
85+
livereload: 9001
86+
}
87+
}
88+
},
89+
watch: {
90+
options: {
91+
livereload: {
92+
port: 9001
93+
}
94+
},
95+
src: {
96+
files: ['src/**/*.js', 'src/**/*.css'],
97+
tasks: ['build:dev']
98+
},
99+
demo: {
100+
files: ['demo/js/**/*.html', 'demo/js/**/*.js', 'demo/css/**/*.css']
101+
}
102+
}
103+
});
104+
105+
grunt.loadNpmTasks('grunt-contrib-concat');
106+
grunt.loadNpmTasks('grunt-contrib-uglify');
107+
grunt.loadNpmTasks('grunt-contrib-connect');
108+
grunt.loadNpmTasks('grunt-contrib-watch');
109+
grunt.loadNpmTasks('grunt-contrib-jshint');
110+
grunt.loadNpmTasks('grunt-contrib-copy');
111+
grunt.loadNpmTasks('grunt-contrib-cssmin');
112+
113+
grunt.registerTask('default', ['test', 'build']);
114+
grunt.registerTask('test', ['jshint']);
115+
grunt.registerTask('dev', ['build:dev', 'connect:watch', 'watch']);
116+
117+
grunt.registerTask('build', function(mode) {
118+
var isDev = (mode === 'dev'),
119+
isRelease = (mode === 'release'),
120+
isEdge = (mode === 'edge'),
121+
pkg = grunt.file.readJSON('package.json'),
122+
uglifyTask;
123+
124+
// development build mode
125+
if (isDev) {
126+
grunt.config.set('buildName', 'matter-tools-dev');
127+
grunt.config.set('buildVersion', pkg.version + '-dev');
128+
grunt.task.run('concat', 'uglify:dev', 'uglify:min', 'cssmin', 'copy');
129+
}
130+
131+
// release build mode
132+
if (isRelease) {
133+
grunt.config.set('buildName', 'matter-tools-' + pkg.version);
134+
grunt.config.set('buildVersion', pkg.version + '-alpha');
135+
grunt.task.run('concat', 'uglify:min', 'cssmin', 'copy');
136+
}
137+
138+
// edge build mode (default)
139+
if (isEdge || (!isDev && !isRelease)) {
140+
grunt.config.set('buildVersion', pkg.version + '-edge');
141+
grunt.task.run('concat', 'uglify:min', 'cssmin');
142+
}
143+
});
144+
145+
grunt.registerTask('set_config', 'Set a config property.', function(name, val) {
146+
grunt.config.set(name, val);
147+
});
148+
};

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 Liam Brummitt
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
matter-tools
2-
============
1+
# Matter Tools
32

4-
tools for creating, testing and debugging matter.js worlds
3+
A set of tools for creating, testing and debugging [Matter.js](https://github.com/liabru/matter-js) worlds.
4+
5+
_TBA_

bower.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "MatterTools",
3+
"version": "0.5.0",
4+
"homepage": "https://github.com/liabru/matter-tools",
5+
"authors": [
6+
"Liam Brummitt <[email protected]> (http://brm.io/)"
7+
],
8+
"description": "tools for creating, testing and debugging matter.js worlds",
9+
"main": "build/matter-tools.min.js",
10+
"keywords": [
11+
"javascript",
12+
"canvas",
13+
"html5",
14+
"physics",
15+
"physics engine",
16+
"game engine",
17+
"rigid body physics"
18+
],
19+
"license": "MIT",
20+
"ignore": [
21+
"**/.*",
22+
"node_modules",
23+
"bower_components",
24+
"test",
25+
"tests"
26+
]
27+
}

build/32px.png

3.05 KB
Loading

build/matter-tools.css

+518
Large diffs are not rendered by default.

build/matter-tools.min.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/css/32px.png

3.05 KB
Loading

demo/css/matter-tools.css

+518
Large diffs are not rendered by default.

demo/css/style.css

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
body {
2+
background: #222;
3+
font-family: Georgia, Times, "Times New Roman", serif;
4+
color: #aaa;
5+
}
6+
7+
body.mobile {
8+
font-size: 0.9em;
9+
}
10+
11+
* {
12+
padding: 0;
13+
margin: 0;
14+
}
15+
16+
h1 {
17+
color: #fff;
18+
display: block;
19+
margin: 0 0 1em 0;
20+
font-weight: normal;
21+
font-size: 30px;
22+
}
23+
24+
.is-mobile h1 {
25+
font-size: 18px;
26+
}
27+
28+
.nav-sep {
29+
padding: 0 5px;
30+
}
31+
32+
.nav a, .nav a:link, .nav a:visited, .nav a:active, .nav a:hover {
33+
color: #aaa;
34+
text-decoration: none;
35+
border-bottom: 1px solid #555;
36+
padding: 0 0 2px 0;
37+
}
38+
39+
.container {
40+
max-width: 800px;
41+
margin: 0 auto;
42+
padding: 64px 280px 0 280px;
43+
}
44+
45+
.ins-auto-hide .container {
46+
padding-left: 32px;
47+
}
48+
49+
.gui-auto-hide .container {
50+
padding-right: 32px;
51+
}
52+
53+
.is-mobile .container {
54+
padding: 6% 6% 0 6%;
55+
}
56+
57+
.is-fullscreen #canvas-container {
58+
width: 100%;
59+
height: 100%;
60+
}
61+
62+
.is-fullscreen #canvas-container canvas {
63+
margin: 0;
64+
max-width: 100%;
65+
max-height: 100%;
66+
}
67+
68+
.mobile .container {
69+
padding: 50px 40px 0 40px;
70+
}
71+
72+
canvas {
73+
margin: 40px 0;
74+
max-width: 100%;
75+
}
76+
77+
.mobile canvas {
78+
margin: 0;
79+
}
80+
81+
canvas:active {
82+
cursor: pointer;
83+
cursor: -webkit-grabbing;
84+
}
85+
86+
.controls-container {
87+
margin: 40px 0 0 0;
88+
width: 100%;
89+
}
90+
91+
#canvas-container {
92+
margin: 20px 0;
93+
}
94+
95+
#demo-select {
96+
padding: 8px 10px;
97+
width: 40%;
98+
color: #000;
99+
}
100+
101+
#demo-reset {
102+
padding: 8px 10px;
103+
color: #000;
104+
}
105+
106+
#demo-start {
107+
display: block;
108+
margin: 50px 0;
109+
padding: 20px 40px;
110+
width: 200px;
111+
color: #000;
112+
}
113+
114+
.dg.a {
115+
margin-right: 0;
116+
}

demo/img/ball.png

14 KB
Loading

demo/img/box.png

13.9 KB
Loading

demo/img/wall-bg.jpg

139 KB
Loading

0 commit comments

Comments
 (0)