entityjs 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/Gemfile +4 -0
- data/README.md +49 -0
- data/Rakefile +1 -0
- data/bin/entityjs +14 -0
- data/build/build_debug.bat +1 -0
- data/build/build_min.bat +1 -0
- data/build/config.php +64 -0
- data/build/debug.php +48 -0
- data/build/files.php +74 -0
- data/build/jsmin.php +376 -0
- data/build/min.php +50 -0
- data/changelog.txt +53 -0
- data/entityjs.gemspec +25 -0
- data/examples/keys/arrow.png +0 -0
- data/examples/keys/keys.html +59 -0
- data/examples/keys/keys.js +148 -0
- data/examples/mouse/mouse.html +58 -0
- data/examples/mouse/mouse.js +60 -0
- data/examples/scenes/home.png +0 -0
- data/examples/scenes/scenes.html +55 -0
- data/examples/scenes/scenes.js +134 -0
- data/examples/scenes/win.png +0 -0
- data/examples/sounds/sound1.mp3 +0 -0
- data/examples/sounds/sound1.ogg +0 -0
- data/examples/sounds/sounds.html +56 -0
- data/examples/sounds/sounds.js +44 -0
- data/examples/style/background.png +0 -0
- data/examples/style/sheet.css +762 -0
- data/examples/tiles/tiles.html +56 -0
- data/examples/tiles/tiles.js +85 -0
- data/examples/tiles/tiles.png +0 -0
- data/lib/blank/config.js +4 -0
- data/lib/blank/config.yml +21 -0
- data/lib/blank/home.js +11 -0
- data/lib/blank/init.js +7 -0
- data/lib/blank/load.js +21 -0
- data/lib/blank/play.html +29 -0
- data/lib/entity.debug.js +52 -0
- data/lib/entity.min.js +184 -0
- data/lib/entityjs/command.rb +37 -0
- data/lib/entityjs/comp.rb +11 -0
- data/lib/entityjs/game.rb +93 -0
- data/lib/entityjs/min.rb +11 -0
- data/lib/entityjs/refresh.rb +14 -0
- data/lib/entityjs/version.rb +3 -0
- data/lib/entityjs.rb +6 -0
- data/license.txt +1 -0
- data/spec/lib/entityjs/game_spec.rb +11 -0
- data/spec/spec_helper.rb +3 -0
- data/src/entityjs/core/component.js +306 -0
- data/src/entityjs/core/entity.js +516 -0
- data/src/entityjs/core/load.js +224 -0
- data/src/entityjs/core/query.js +410 -0
- data/src/entityjs/core/re.js +70 -0
- data/src/entityjs/core/system.js +125 -0
- data/src/entityjs/cycle/draw.js +185 -0
- data/src/entityjs/cycle/ticker.js +27 -0
- data/src/entityjs/cycle/tween.js +61 -0
- data/src/entityjs/cycle/update.js +86 -0
- data/src/entityjs/cycle/wait.js +22 -0
- data/src/entityjs/cycle/worker.js +9 -0
- data/src/entityjs/display/anchor.js +53 -0
- data/src/entityjs/display/bitfont.js +93 -0
- data/src/entityjs/display/bitmap.js +37 -0
- data/src/entityjs/display/circle.js +30 -0
- data/src/entityjs/display/font.js +41 -0
- data/src/entityjs/display/group.js +63 -0
- data/src/entityjs/display/rect.js +19 -0
- data/src/entityjs/display/screen.js +46 -0
- data/src/entityjs/display/sprite.js +37 -0
- data/src/entityjs/input/keyboard.js +150 -0
- data/src/entityjs/input/mouse.js +123 -0
- data/src/entityjs/input/pressed.js +81 -0
- data/src/entityjs/input/touch.js +28 -0
- data/src/entityjs/math/bind.js +76 -0
- data/src/entityjs/math/bisect.js +69 -0
- data/src/entityjs/math/body.js +39 -0
- data/src/entityjs/math/drag.js +39 -0
- data/src/entityjs/math/hitmap.js +165 -0
- data/src/entityjs/math/hittest.js +26 -0
- data/src/entityjs/math/physics.js +142 -0
- data/src/entityjs/math/point.js +57 -0
- data/src/entityjs/math/tile.js +91 -0
- data/src/entityjs/media/channel.js +93 -0
- data/src/entityjs/media/playlist.js +5 -0
- data/src/entityjs/media/sound.js +110 -0
- data/src/entityjs/net/socket.js +52 -0
- data/src/entityjs/pattern/arraymap.js +89 -0
- data/src/entityjs/pattern/flicker.js +214 -0
- data/src/entityjs/pattern/timestep.js +34 -0
- data/src/entityjs/save/database.js +7 -0
- data/src/entityjs/save/storage.js +57 -0
- data/src/entityjs/util/log.js +25 -0
- data/src/entityjs/util/polyfill.js +25 -0
- data/src/entityjs/util/random.js +38 -0
- data/src/entityjs/util/scene.js +101 -0
- data/src/entityjs/util/sheet.js +51 -0
- data/src/entityjs/util/support.js +132 -0
- metadata +156 -0
@@ -0,0 +1,132 @@
|
|
1
|
+
/*
|
2
|
+
The support component contains information about supported
|
3
|
+
functionality of the browser.
|
4
|
+
|
5
|
+
v0.1 currently only checks for support of canvas and canvas text.
|
6
|
+
|
7
|
+
FUTURE
|
8
|
+
-check audio support
|
9
|
+
|
10
|
+
//returns true if canvas AND text is supported
|
11
|
+
if(re.support('canvas text')){
|
12
|
+
//supports
|
13
|
+
}
|
14
|
+
|
15
|
+
//checks all arguments and returns first thing thats supported
|
16
|
+
re.support('ogg', 'aac', 'mp3', 'wav');
|
17
|
+
|
18
|
+
//find first supported storage storage
|
19
|
+
re.support('database', 'localstorage');
|
20
|
+
|
21
|
+
this is helpful to find a supported codec or a storage component
|
22
|
+
|
23
|
+
or add to entity
|
24
|
+
|
25
|
+
re.e('support').support('canvas');
|
26
|
+
|
27
|
+
---- possible support checks
|
28
|
+
canvas
|
29
|
+
text
|
30
|
+
audio
|
31
|
+
ogg
|
32
|
+
mp3
|
33
|
+
wav
|
34
|
+
aac
|
35
|
+
localstorage
|
36
|
+
worker
|
37
|
+
webgl
|
38
|
+
|
39
|
+
*/
|
40
|
+
re.c('support')
|
41
|
+
.global({
|
42
|
+
|
43
|
+
support:function(s){
|
44
|
+
var that = re.c('support');
|
45
|
+
|
46
|
+
if(arguments.length > 1){
|
47
|
+
//find first supported arg and return
|
48
|
+
|
49
|
+
var d;
|
50
|
+
for(var i=0; i<arguments.length; i++){
|
51
|
+
d = arguments[i];
|
52
|
+
if(that.support(d)){
|
53
|
+
return d;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
return false;
|
58
|
+
}
|
59
|
+
|
60
|
+
//find if supported
|
61
|
+
var k = s.split(' ');
|
62
|
+
|
63
|
+
var stat = true;
|
64
|
+
|
65
|
+
//check multiple supports
|
66
|
+
for(var j in k){
|
67
|
+
stat = stat && !!that[k[j]];
|
68
|
+
}
|
69
|
+
|
70
|
+
return stat;
|
71
|
+
}
|
72
|
+
|
73
|
+
})
|
74
|
+
.extend({
|
75
|
+
support:function(s){
|
76
|
+
return re.c('support').call(this, s);
|
77
|
+
}
|
78
|
+
|
79
|
+
})
|
80
|
+
.run(function(){
|
81
|
+
|
82
|
+
//add supports to component
|
83
|
+
var c = re.c('support');
|
84
|
+
|
85
|
+
//quick checking function
|
86
|
+
re.support = c.support;
|
87
|
+
|
88
|
+
//check canvas support
|
89
|
+
c.canvas = !!document.createElement('canvas').getContext;
|
90
|
+
|
91
|
+
//check for text support
|
92
|
+
c.text = !!(c.canvas && typeof document.createElement('canvas').getContext('2d').fillText == 'function');
|
93
|
+
|
94
|
+
//check audio support
|
95
|
+
var ele = document.createElement('audio');
|
96
|
+
|
97
|
+
try {
|
98
|
+
|
99
|
+
if(c.audio = !!ele.canPlayType){
|
100
|
+
|
101
|
+
c.ogg = ele.canPlayType('audio/ogg; codecs="vorbis"');
|
102
|
+
c.mp3 = ele.canPlayType('audio/mpeg;');
|
103
|
+
c.wav = ele.canPlayType('audio/wav; codecs="1"');
|
104
|
+
c.aac = ele.canPlayType('audio/x-m4a;') || ele.canPlayType('audio/aac;');
|
105
|
+
|
106
|
+
//switch unsupported codecs to false
|
107
|
+
for(var i in c){
|
108
|
+
if(c[i] == 'no' || c[i] == ''){
|
109
|
+
c[i] = false;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
}
|
114
|
+
|
115
|
+
} catch(e){}
|
116
|
+
|
117
|
+
//check local storage
|
118
|
+
try {
|
119
|
+
c.localstorage = !!localStorage.getItem;
|
120
|
+
} catch(e){
|
121
|
+
c.localstorage = false;
|
122
|
+
}
|
123
|
+
|
124
|
+
//check web worker
|
125
|
+
c.worker = !!window.Worker;
|
126
|
+
|
127
|
+
//check webgl
|
128
|
+
c.webgl = !!window.WebGLRenderingContext;
|
129
|
+
|
130
|
+
c.touch = 'ontouchstart' in window;
|
131
|
+
|
132
|
+
});
|
metadata
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: entityjs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ben D'Angelo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-27 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: uglifier
|
16
|
+
requirement: &28483692 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *28483692
|
25
|
+
description: A HTML5 Javascript game engine.
|
26
|
+
email:
|
27
|
+
- ben.dangelo2@gmail.com
|
28
|
+
executables:
|
29
|
+
- entityjs
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- Gemfile
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- bin/entityjs
|
38
|
+
- build/build_debug.bat
|
39
|
+
- build/build_min.bat
|
40
|
+
- build/config.php
|
41
|
+
- build/debug.php
|
42
|
+
- build/files.php
|
43
|
+
- build/jsmin.php
|
44
|
+
- build/min.php
|
45
|
+
- changelog.txt
|
46
|
+
- entityjs.gemspec
|
47
|
+
- examples/keys/arrow.png
|
48
|
+
- examples/keys/keys.html
|
49
|
+
- examples/keys/keys.js
|
50
|
+
- examples/mouse/mouse.html
|
51
|
+
- examples/mouse/mouse.js
|
52
|
+
- examples/scenes/home.png
|
53
|
+
- examples/scenes/scenes.html
|
54
|
+
- examples/scenes/scenes.js
|
55
|
+
- examples/scenes/win.png
|
56
|
+
- examples/sounds/sound1.mp3
|
57
|
+
- examples/sounds/sound1.ogg
|
58
|
+
- examples/sounds/sounds.html
|
59
|
+
- examples/sounds/sounds.js
|
60
|
+
- examples/style/background.png
|
61
|
+
- examples/style/sheet.css
|
62
|
+
- examples/tiles/tiles.html
|
63
|
+
- examples/tiles/tiles.js
|
64
|
+
- examples/tiles/tiles.png
|
65
|
+
- lib/blank/config.js
|
66
|
+
- lib/blank/config.yml
|
67
|
+
- lib/blank/home.js
|
68
|
+
- lib/blank/init.js
|
69
|
+
- lib/blank/load.js
|
70
|
+
- lib/blank/play.html
|
71
|
+
- lib/entity.debug.js
|
72
|
+
- lib/entity.min.js
|
73
|
+
- lib/entityjs.rb
|
74
|
+
- lib/entityjs/command.rb
|
75
|
+
- lib/entityjs/comp.rb
|
76
|
+
- lib/entityjs/game.rb
|
77
|
+
- lib/entityjs/min.rb
|
78
|
+
- lib/entityjs/refresh.rb
|
79
|
+
- lib/entityjs/version.rb
|
80
|
+
- license.txt
|
81
|
+
- spec/lib/entityjs/game_spec.rb
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
- src/entityjs/core/component.js
|
84
|
+
- src/entityjs/core/entity.js
|
85
|
+
- src/entityjs/core/load.js
|
86
|
+
- src/entityjs/core/query.js
|
87
|
+
- src/entityjs/core/re.js
|
88
|
+
- src/entityjs/core/system.js
|
89
|
+
- src/entityjs/cycle/draw.js
|
90
|
+
- src/entityjs/cycle/ticker.js
|
91
|
+
- src/entityjs/cycle/tween.js
|
92
|
+
- src/entityjs/cycle/update.js
|
93
|
+
- src/entityjs/cycle/wait.js
|
94
|
+
- src/entityjs/cycle/worker.js
|
95
|
+
- src/entityjs/display/anchor.js
|
96
|
+
- src/entityjs/display/bitfont.js
|
97
|
+
- src/entityjs/display/bitmap.js
|
98
|
+
- src/entityjs/display/circle.js
|
99
|
+
- src/entityjs/display/font.js
|
100
|
+
- src/entityjs/display/group.js
|
101
|
+
- src/entityjs/display/rect.js
|
102
|
+
- src/entityjs/display/screen.js
|
103
|
+
- src/entityjs/display/sprite.js
|
104
|
+
- src/entityjs/input/keyboard.js
|
105
|
+
- src/entityjs/input/mouse.js
|
106
|
+
- src/entityjs/input/pressed.js
|
107
|
+
- src/entityjs/input/touch.js
|
108
|
+
- src/entityjs/math/bind.js
|
109
|
+
- src/entityjs/math/bisect.js
|
110
|
+
- src/entityjs/math/body.js
|
111
|
+
- src/entityjs/math/drag.js
|
112
|
+
- src/entityjs/math/hitmap.js
|
113
|
+
- src/entityjs/math/hittest.js
|
114
|
+
- src/entityjs/math/physics.js
|
115
|
+
- src/entityjs/math/point.js
|
116
|
+
- src/entityjs/math/tile.js
|
117
|
+
- src/entityjs/media/channel.js
|
118
|
+
- src/entityjs/media/playlist.js
|
119
|
+
- src/entityjs/media/sound.js
|
120
|
+
- src/entityjs/net/socket.js
|
121
|
+
- src/entityjs/pattern/arraymap.js
|
122
|
+
- src/entityjs/pattern/flicker.js
|
123
|
+
- src/entityjs/pattern/timestep.js
|
124
|
+
- src/entityjs/save/database.js
|
125
|
+
- src/entityjs/save/storage.js
|
126
|
+
- src/entityjs/util/log.js
|
127
|
+
- src/entityjs/util/polyfill.js
|
128
|
+
- src/entityjs/util/random.js
|
129
|
+
- src/entityjs/util/scene.js
|
130
|
+
- src/entityjs/util/sheet.js
|
131
|
+
- src/entityjs/util/support.js
|
132
|
+
homepage: http://entityjs.com
|
133
|
+
licenses: []
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
requirements: []
|
151
|
+
rubyforge_project: entityjs
|
152
|
+
rubygems_version: 1.8.11
|
153
|
+
signing_key:
|
154
|
+
specification_version: 3
|
155
|
+
summary: A HTML5 Javascript game engine.
|
156
|
+
test_files: []
|