Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
480c1819d6 | ||
|
|
4cac6408d8 | ||
|
|
f22af81653 | ||
|
|
1c68ff9042 | ||
|
|
a51ae03246 | ||
|
|
3b2573de9a | ||
|
|
a6b05f4d02 | ||
|
|
7db8e5bc5e | ||
|
|
d75f6e163f | ||
|
|
081c083176 | ||
|
|
83091b7647 | ||
|
|
512b542e50 | ||
|
|
6815c5909a | ||
|
|
e97a207816 | ||
|
|
3e93f24583 | ||
|
|
2bab4fd2fb | ||
|
|
12a2a2ec16 | ||
|
|
22b1ce9b9d | ||
|
|
cc82336952 | ||
|
|
5a6ae5f696 | ||
|
|
b5df53b4f6 | ||
|
|
f9cad58082 | ||
|
|
a30c2c87a9 | ||
|
|
8c2502d37d | ||
|
|
700d8d5258 | ||
|
|
67ad898294 | ||
|
|
7183322259 | ||
|
|
6cc09fce67 | ||
|
|
833960b3c8 | ||
|
|
4a370c82cf | ||
|
|
960e8cace6 | ||
|
|
502d74ee39 | ||
|
|
d8f5832fa2 | ||
|
|
6f513042c1 | ||
|
|
76040d303e | ||
|
|
61376093fd | ||
|
|
c4a68e3e87 | ||
|
|
418a161b46 | ||
|
|
442e6bb776 | ||
|
|
3794a846d4 | ||
|
|
a7dbd6e626 | ||
|
|
0eb23d4b11 | ||
|
|
52118be088 | ||
|
|
66bdf56349 | ||
|
|
33da238e97 | ||
|
|
7ff4e51ab1 | ||
|
|
a1bb3ea23b | ||
|
|
664d5b3e2c | ||
|
|
8dcfef8db0 | ||
|
|
27cea5e6f0 | ||
|
|
f17cdd9c32 | ||
|
|
bbc0f4a18a | ||
|
|
8662cd2fd4 | ||
|
|
4562939e4e | ||
|
|
e45a929b00 | ||
|
|
8dc28f4800 | ||
|
|
e3d53ad6a3 | ||
|
|
09d4a35b7f | ||
|
|
34ee2b0b20 | ||
|
|
43cd5e4b3f | ||
|
|
3568dc4ff1 | ||
|
|
a8bd5db7ba | ||
|
|
5c30fd019f | ||
|
|
10b3dbf74a | ||
|
|
7e12075be1 | ||
|
|
53c10ca31f | ||
|
|
4d284029c7 | ||
|
|
86374d4437 | ||
|
|
db090601b8 | ||
|
|
493c12c807 | ||
|
|
419076ed62 | ||
|
|
d0fa50f014 | ||
|
|
4a97861ff8 | ||
|
|
5ab104ad4b | ||
|
|
1aea08d0f7 | ||
|
|
29fcfc515d | ||
|
|
994eaff92b | ||
|
|
d958b34f43 | ||
|
|
db2e3733c2 | ||
|
|
741249043c | ||
|
|
be27442139 | ||
|
|
1646157c0c | ||
|
|
13c99f3491 | ||
|
|
fdde4cb7e6 | ||
|
|
b4dbaf9950 | ||
|
|
c53a06849e | ||
|
|
a24d252430 | ||
|
|
a1b502fc06 | ||
|
|
b255fea85f | ||
|
|
8fafb3de56 | ||
|
|
8fb2f20482 | ||
|
|
cc06a62b90 | ||
|
|
415342d986 | ||
|
|
beaac18b8f | ||
|
|
36df5516dd | ||
|
|
d9cadc70ac | ||
|
|
9d9fd06392 | ||
|
|
46e85c8394 | ||
|
|
e088d5c67f | ||
|
|
e37188d168 | ||
|
|
276ef9c268 | ||
|
|
a6d77d00a0 | ||
|
|
94133e4c11 | ||
|
|
b2da49eefa | ||
|
|
bd24dab2f6 | ||
|
|
e266ecfe00 | ||
|
|
be4d42a1c2 | ||
|
|
ea4873e286 | ||
|
|
57796a60be | ||
|
|
ee1a1cd1c9 | ||
|
|
1448562abd | ||
|
|
b03c6231e1 | ||
|
|
2669f81391 | ||
|
|
2eab5d4815 | ||
|
|
7342ce603a | ||
|
|
fb5920feec | ||
|
|
5a00a0ad97 | ||
|
|
3ac8fba9e8 | ||
|
|
5c4dd26d25 | ||
|
|
3ead8aee7b | ||
|
|
e9e5bf9436 | ||
|
|
7ee0c20bb3 | ||
|
|
d7ababa398 | ||
|
|
07af06fc4e | ||
|
|
eb38ae35f8 | ||
|
|
a61d030256 | ||
|
|
dd8a393bc9 | ||
|
|
066a625d17 | ||
|
|
5f6fc9db05 | ||
|
|
efd760479d | ||
|
|
cf3796d60c | ||
|
|
251b819bdb | ||
|
|
008badcf79 | ||
|
|
b2303c64a3 | ||
|
|
26b24b491d | ||
|
|
34fa6ffaeb | ||
|
|
c48e685802 | ||
|
|
91c0299d4c | ||
|
|
9fcab5ef26 | ||
|
|
4ad7b304c6 | ||
|
|
f07c10e38e | ||
|
|
1762983bc0 | ||
|
|
95b3872508 | ||
|
|
aac31bdaa4 | ||
|
|
1d3616f52c | ||
|
|
812de7d994 | ||
|
|
5f79bb4330 | ||
|
|
7394403bb6 | ||
|
|
d9080052c3 | ||
|
|
f6807e23c6 | ||
|
|
7373db6e8c | ||
|
|
08e5f18257 | ||
|
|
d057a9fe11 | ||
|
|
14646e811c | ||
|
|
5968dd053b | ||
|
|
7a8c96db37 | ||
|
|
1e29e28333 | ||
|
|
15be3f86f3 | ||
|
|
3d0b5bde75 | ||
|
|
335684ac57 | ||
|
|
63145d7735 | ||
|
|
5d5c64d22f | ||
|
|
375e9e379a | ||
|
|
cad14848e8 | ||
|
|
78bf874888 | ||
|
|
d026f968de | ||
|
|
cfa2c96637 | ||
|
|
06273211ad | ||
|
|
c74016189e | ||
|
|
3a59c13a71 | ||
|
|
85eaaef688 | ||
|
|
9837984a4d | ||
|
|
e5812710cc | ||
|
|
e922bbdfd3 | ||
|
|
e5e643b103 | ||
|
|
e5a4620b87 | ||
|
|
b94c78cf61 | ||
|
|
8fcf5ee415 | ||
|
|
1cb40b6df1 | ||
|
|
1097a699c3 | ||
|
|
291f8ef14c | ||
|
|
1b5837d71d | ||
|
|
bcd31499c4 | ||
|
|
539a0f2256 | ||
|
|
ef95fbaa00 | ||
|
|
c3f306c795 | ||
|
|
7d2a818d0d | ||
|
|
15b83e1c88 | ||
|
|
b38b00c2c1 | ||
|
|
24f2e2a46d | ||
|
|
58e44f75e3 | ||
|
|
3e99391cbf | ||
|
|
f9a4beb608 | ||
|
|
87fce63a23 | ||
|
|
ec4eab07a7 | ||
|
|
35e4c03bad | ||
|
|
19c5b7c22c | ||
|
|
5bbb7e390b | ||
|
|
90e9edbf05 | ||
|
|
30fbbec675 | ||
|
|
9d6d3127ad | ||
|
|
e9fb8f6389 | ||
|
|
0786e86ee5 | ||
|
|
175584469a | ||
|
|
bdb8908fee | ||
|
|
312ec462bc | ||
|
|
b85f40df12 | ||
|
|
f6113ac6c4 | ||
|
|
424d1126bc | ||
|
|
62aa0fc570 | ||
|
|
c6cc2c9d71 | ||
|
|
2c100754bb | ||
|
|
ab5c07dfe8 | ||
|
|
da878b2181 | ||
|
|
43d9fc4f52 | ||
|
|
5b64b01068 | ||
|
|
58102168aa | ||
|
|
1184d8bd76 | ||
|
|
2de934756c | ||
|
|
47e23096bd | ||
|
|
6f835d7696 | ||
|
|
d26bda2736 | ||
|
|
d2366d5fa5 | ||
|
|
ae74cb02dd | ||
|
|
0294a4735d | ||
|
|
d44775c095 | ||
|
|
f9f2f2a9ae | ||
|
|
e15bebd269 | ||
|
|
9ee5cdaded | ||
|
|
62da24a7fc | ||
|
|
e9ab2d30b6 | ||
|
|
27bca6a8c2 | ||
|
|
bca64c2adb | ||
|
|
4aa945f991 | ||
|
|
e8b432f518 | ||
|
|
325f63b45d | ||
|
|
243820c973 | ||
|
|
ee3f6d8e7f | ||
|
|
67bd653eb4 | ||
|
|
c429787877 | ||
|
|
bf13c7b569 | ||
|
|
dd43d59cce | ||
|
|
bc3a3fd43d | ||
|
|
890e52008a | ||
|
|
9b9baa83a9 | ||
|
|
d583b364bd | ||
|
|
773b4d5ed1 | ||
|
|
6958ac73d3 | ||
|
|
e11cae5373 | ||
|
|
ddc255382d | ||
|
|
3cae06d1ad | ||
|
|
6cabb03a82 | ||
|
|
4b7fc8d506 | ||
|
|
7ba1196c0d | ||
|
|
0b18625811 | ||
|
|
c0032e7a58 | ||
|
|
9e5e30bb12 | ||
|
|
3748811d11 | ||
|
|
8ef403cfe7 | ||
|
|
4ed20e0f77 | ||
|
|
e88b10323a | ||
|
|
df2a048594 | ||
|
|
8eae8feecc | ||
|
|
4cfce8b4d2 | ||
|
|
9737710200 | ||
|
|
68d5c73fea | ||
|
|
eddce653e9 | ||
|
|
16fa37081f | ||
|
|
fd68a2fe3a | ||
|
|
e7a9b96d27 | ||
|
|
02b75b9e23 | ||
|
|
0896c2fac7 | ||
|
|
8e77e8cedb | ||
|
|
846e9c5061 | ||
|
|
1af86771ba | ||
|
|
84f0f00f49 | ||
|
|
4502ca1bf6 | ||
|
|
70ad43e71b | ||
|
|
a1ccddcd7e | ||
|
|
82c39d0866 | ||
|
|
45f9db515a | ||
|
|
09d4b2bb8b | ||
|
|
8315973c5d | ||
|
|
28f71ed86d | ||
|
|
3488880956 | ||
|
|
33d47cf9e9 | ||
|
|
cdb1891420 | ||
|
|
30af712d6a | ||
|
|
5e182d317b | ||
|
|
26f2b2a931 | ||
|
|
e5dc16b68d | ||
|
|
27fc447928 | ||
|
|
45b6d5a741 | ||
|
|
13a86765cb | ||
|
|
68b7d22e0d | ||
|
|
6e4e99f436 | ||
|
|
651858372c | ||
|
|
d51a37211c | ||
|
|
5b85c910cb | ||
|
|
e5f52e8ae8 | ||
|
|
82cb66f47b | ||
|
|
9deb5514a2 | ||
|
|
90c09374af | ||
|
|
fbe508ab1b | ||
|
|
dbdb2a2026 | ||
|
|
4432d37e6e | ||
|
|
511858e3f5 | ||
|
|
d37ec40d72 | ||
|
|
f575967840 | ||
|
|
912551a45d | ||
|
|
4505aa50f6 | ||
|
|
45518b3ecd | ||
|
|
3fb2eb23cd | ||
|
|
8b06f9cd86 | ||
|
|
e3aaec8ac0 | ||
|
|
ea9e22f472 | ||
|
|
110ab4e253 | ||
|
|
31b68ac94f | ||
|
|
20108e47f3 | ||
|
|
1370ba52b5 | ||
|
|
b2c49ef853 | ||
|
|
f6af6fe0a3 | ||
|
|
7a0e9a478c | ||
|
|
15a002e720 | ||
|
|
c9d07c7346 | ||
|
|
a81d22a309 | ||
|
|
128c7143d5 | ||
|
|
971e17fabe | ||
|
|
2532df8793 | ||
|
|
c5840f4f6f | ||
|
|
4e7dabb47e | ||
|
|
47ee5a2c88 | ||
|
|
ca1f24868a | ||
|
|
1f9df6e3f4 | ||
|
|
ac310ab881 | ||
|
|
abdaaa0010 | ||
|
|
58fb248575 | ||
|
|
283e38aaae | ||
|
|
be6489fbc9 | ||
|
|
651737fdd0 | ||
|
|
88ef644d47 | ||
|
|
7c66a6b6cc | ||
|
|
d8bf13eaaa | ||
|
|
bd66be1804 | ||
|
|
01a314018d | ||
|
|
ff7cad102c | ||
|
|
8479e456dd | ||
|
|
b4e767161b | ||
|
|
6cde583e82 | ||
|
|
ab02040bea | ||
|
|
32f5a2fa36 | ||
|
|
011d2d8e05 | ||
|
|
17af96d46a | ||
|
|
bd9898db7e | ||
|
|
befcf74f44 | ||
|
|
e7c2b6ae9c | ||
|
|
71f82477ea | ||
|
|
c6fa2cb7b6 | ||
|
|
35cef4e529 | ||
|
|
0a0e775ea5 | ||
|
|
10d105d5ce | ||
|
|
754219a978 | ||
|
|
5f9acdca4b | ||
|
|
c6c579e6b3 | ||
|
|
c21365703d | ||
|
|
35e61172e1 | ||
|
|
67e2caafbc | ||
|
|
038bca11b2 | ||
|
|
bd9b964710 | ||
|
|
1aabb6b93d | ||
|
|
77a8dc321f | ||
|
|
428e331a11 | ||
|
|
aa3a86df6e | ||
|
|
92033fde7c | ||
|
|
7aa45b5872 | ||
|
|
c3183dcea9 | ||
|
|
f7329e0661 | ||
|
|
5526a7322b | ||
|
|
902ffee808 | ||
|
|
d1cd1df9a5 | ||
|
|
86f6ddcbc8 | ||
|
|
3b87ce9fc9 | ||
|
|
29d7cc36a0 | ||
|
|
ba74bea4b4 | ||
|
|
ce4cf531d4 | ||
|
|
fdbdd81b7b | ||
|
|
2c8077835c | ||
|
|
10f4bc7507 | ||
|
|
923a10ee81 | ||
|
|
167a498a5e | ||
|
|
7acf79338c | ||
|
|
e103d6ae83 | ||
|
|
9a968bc5bb | ||
|
|
0acef49a7c | ||
|
|
5a5d465034 | ||
|
|
6be31e0f69 | ||
|
|
bf72b4d3b0 | ||
|
|
63d90a0176 | ||
|
|
3cbb820349 | ||
|
|
352749e803 | ||
|
|
4c7a4ebf62 | ||
|
|
5cf7ed4fdb | ||
|
|
f991f9cee8 | ||
|
|
b2c680811b | ||
|
|
4ada28ba81 | ||
|
|
55d69e16b6 | ||
|
|
50eee95c99 | ||
|
|
dd7ae12271 | ||
|
|
a0961f27df | ||
|
|
896e9af9f5 | ||
|
|
b8dbb5d125 | ||
|
|
388e42c80a | ||
|
|
7917eac255 | ||
|
|
39cae4cc09 | ||
|
|
03ae324d26 | ||
|
|
a361a18616 | ||
|
|
dd9f533528 | ||
|
|
1b954066a6 | ||
|
|
da5d8c9272 | ||
|
|
215632c0a7 | ||
|
|
9988a2ffbe | ||
|
|
56389fcaf4 | ||
|
|
c74bac3a9c | ||
|
|
9f6cfca9cd | ||
|
|
6805e7264d | ||
|
|
f7202a3ff1 | ||
|
|
fc6ae6a60b | ||
|
|
636b1af25c | ||
|
|
19759699df | ||
|
|
669570c701 | ||
|
|
af5847e8e4 | ||
|
|
2071fc22fc | ||
|
|
55b2dd379a | ||
|
|
3e1207e1a3 | ||
|
|
8ade29d982 | ||
|
|
74e0cfb13a | ||
|
|
13a03f3620 | ||
|
|
886618c056 | ||
|
|
ca3c71e8f5 | ||
|
|
8e289e6b7c | ||
|
|
1f513a333e | ||
|
|
ea3802a556 | ||
|
|
cd314cd03e | ||
|
|
eb3d8241ca | ||
|
|
fe5fdb164c | ||
|
|
2e11801f9f | ||
|
|
f6712da774 | ||
|
|
b48669dded | ||
|
|
8469a9c51e | ||
|
|
b978a2b73b | ||
|
|
c5c754725a | ||
|
|
8f14483b60 | ||
|
|
539dcdd18a | ||
|
|
666df67453 | ||
|
|
42c0bed502 | ||
|
|
3bfea2101a | ||
|
|
f9ee9bfc0e | ||
|
|
2b99cb4be4 | ||
|
|
0256117307 | ||
|
|
0302e05a83 | ||
|
|
d9ffd6afd4 | ||
|
|
f9b82b66db | ||
|
|
efe839978b | ||
|
|
00a9897ae2 | ||
|
|
378ffc7ade | ||
|
|
b2fc6c422a | ||
|
|
f22159e257 | ||
|
|
8da9b67c18 | ||
|
|
780b8a5d6d | ||
|
|
39025c1c2a | ||
|
|
e91d40b9fc | ||
|
|
a9a46bfbbf | ||
|
|
4926fac578 | ||
|
|
2fc5c89c1e | ||
|
|
e8646def64 | ||
|
|
141337bed9 | ||
|
|
f4688241d2 | ||
|
|
86584a636c | ||
|
|
06a17b4b26 | ||
|
|
299115ca5d | ||
|
|
13a2cc2feb | ||
|
|
373b97648d | ||
|
|
a876fdd2b6 | ||
|
|
cbd9b77327 | ||
|
|
d30e2974c4 | ||
|
|
16ae7f3cb7 | ||
|
|
155c863d69 | ||
|
|
82f019d4d2 | ||
|
|
8015194daa | ||
|
|
7d7aa795e7 | ||
|
|
b286093093 | ||
|
|
496639ff25 | ||
|
|
e32c127a97 | ||
|
|
ca297318f0 | ||
|
|
577e3f8506 | ||
|
|
93fcb7acbf | ||
|
|
e620c99479 | ||
|
|
f115a2dbf8 | ||
|
|
9b6bfa5f37 | ||
|
|
40e1b4b9aa | ||
|
|
6ed6820429 | ||
|
|
7ef5ab8c98 | ||
|
|
e43571980d | ||
|
|
b63bd14172 | ||
|
|
a5f2d65d23 | ||
|
|
7ad4164e3a | ||
|
|
ba6863bdf5 | ||
|
|
38bd00b4ed | ||
|
|
3249aa2673 | ||
|
|
4d80d6c9b2 | ||
|
|
04ebae7a9f | ||
|
|
0dab85c853 | ||
|
|
266b62caff | ||
|
|
83cacb93a0 | ||
|
|
8d48576fe2 | ||
|
|
ebe441666c | ||
|
|
254bf67e16 | ||
|
|
f71b8d4df1 | ||
|
|
6a24d6116b | ||
|
|
e4faa34908 | ||
|
|
71b08cafbd | ||
|
|
9dc7c73135 | ||
|
|
e271f69527 | ||
|
|
46cf024a35 | ||
|
|
1d20c07ed9 | ||
|
|
18a07f7a88 | ||
|
|
13fdca9cf5 | ||
|
|
084c4239e5 | ||
|
|
b35da01cfc | ||
|
|
3f99b691c9 | ||
|
|
42cd8bd812 | ||
|
|
789f0bb0a1 | ||
|
|
dfb22f1044 | ||
|
|
8b793cd8d7 | ||
|
|
94d9fa6e77 | ||
|
|
de34a13545 | ||
|
|
35dd98c72f | ||
|
|
06e33bc8e4 | ||
|
|
1eca16a948 | ||
|
|
32bff9e419 | ||
|
|
00664f9e99 | ||
|
|
fa8533f5d1 | ||
|
|
2e576fa9a7 | ||
|
|
19ddad8095 | ||
|
|
9022a2f9d3 | ||
|
|
0e84b7ccc9 | ||
|
|
a5c8b2509c | ||
|
|
c1d60d7e19 | ||
|
|
8678373754 | ||
|
|
e8bac6c8c7 | ||
|
|
4593a42a5b | ||
|
|
3227918c57 | ||
|
|
a96ced0d82 | ||
|
|
cc42a71c66 | ||
|
|
3e9777e6f4 | ||
|
|
eb95ce231b | ||
|
|
d0889fcc17 | ||
|
|
160a321a36 | ||
|
|
685054eac5 | ||
|
|
19ac33f970 | ||
|
|
56c7f1f275 | ||
|
|
51a42c2f12 | ||
|
|
e3f76ce481 | ||
|
|
bd752785b9 | ||
|
|
787abc1e02 | ||
|
|
581d637663 | ||
|
|
3c164b466c | ||
|
|
01eab3aeb1 | ||
|
|
6f93a2ec94 | ||
|
|
903c2e73fa | ||
|
|
712858cf75 | ||
|
|
ddf15979d0 | ||
|
|
ebf4456e4e | ||
|
|
01f64c6694 | ||
|
|
0a77690f4f | ||
|
|
9030fbf352 | ||
|
|
24c809dd5f | ||
|
|
3de62907a0 | ||
|
|
7ceb11ae49 | ||
|
|
62656783f0 | ||
|
|
2b40d2f507 | ||
|
|
a814cc26cc | ||
|
|
ea651113df | ||
|
|
f00c52598b | ||
|
|
7a9508d01d | ||
|
|
9261160571 | ||
|
|
2787ed188e | ||
|
|
b6efdff286 | ||
|
|
6994e4be5e | ||
|
|
bd5bca14fe | ||
|
|
34736fbde5 | ||
|
|
155c36b0fd | ||
|
|
8dfe5aee1c | ||
|
|
3f9c07d783 | ||
|
|
f63e8d7d06 | ||
|
|
65d2bf557b | ||
|
|
9f9e6a2a57 | ||
|
|
0463bb4333 | ||
|
|
12148b3159 | ||
|
|
ce04ade458 | ||
|
|
a08436abc3 | ||
|
|
35517d94ad | ||
|
|
2659ed7a4a | ||
|
|
ba57f0ae0d | ||
|
|
d8a2b9d2af | ||
|
|
2921a6de2e | ||
|
|
d30f709208 | ||
|
|
1294b3a2b9 | ||
|
|
427819c655 | ||
|
|
1469663ea5 | ||
|
|
1f28d328a7 | ||
|
|
03054c1949 | ||
|
|
708a144c7a | ||
|
|
f6b50c4520 | ||
|
|
f522cda325 | ||
|
|
ab6dbfb49e | ||
|
|
f784a395ce | ||
|
|
9ed930c4cf | ||
|
|
a6fac64248 | ||
|
|
e4621aafdd | ||
|
|
7e5f38d022 | ||
|
|
dfee9f9b2f | ||
|
|
7b052c302f | ||
|
|
94c7c57e1c | ||
|
|
ffd5ddc534 | ||
|
|
4a51ac4671 | ||
|
|
f1f42e4d41 | ||
|
|
cab3b53cf0 | ||
|
|
e5c3ca27c5 | ||
|
|
84b837f56c | ||
|
|
77fd15bf3c | ||
|
|
07724e5001 | ||
|
|
82df8c9f54 | ||
|
|
97423a9d8d | ||
|
|
8ed783802e | ||
|
|
dabda516c2 | ||
|
|
7e8b79adf4 | ||
|
|
275fa4641e | ||
|
|
4b2ac6c6c6 | ||
|
|
9c1fdb371c | ||
|
|
31018b9295 | ||
|
|
a97f271de7 | ||
|
|
fd5eeb9088 | ||
|
|
f3ea68aad3 | ||
|
|
dd695e066f | ||
|
|
6147e07a5f | ||
|
|
969fa46484 | ||
|
|
faf432bdb0 | ||
|
|
44613f7140 | ||
|
|
78dbb1aa59 | ||
|
|
c6bf67c392 | ||
|
|
e98aa205ea | ||
|
|
786aa2900e | ||
|
|
eb98998046 | ||
|
|
3acdad92cb | ||
|
|
574f4f351b | ||
|
|
0201baef11 | ||
|
|
cf414394c3 | ||
|
|
b868c2cb1b | ||
|
|
a7230aa769 | ||
|
|
f10f9324ad | ||
|
|
29acf7fb4b | ||
|
|
ca9321ef42 | ||
|
|
83a00862be | ||
|
|
1c577d3674 | ||
|
|
f5584bdfe5 | ||
|
|
ebc4e5dc3d | ||
|
|
fa692653e3 | ||
|
|
c307f79102 | ||
|
|
1bc6ac25fa | ||
|
|
d4149a8f9a | ||
|
|
9ed2dc8e89 | ||
|
|
1a522ea786 | ||
|
|
77b553ac2a | ||
|
|
664c512a99 | ||
|
|
47e1b1b54b | ||
|
|
455b18b7ec | ||
|
|
c00bf96603 | ||
|
|
e8bed83ac3 | ||
|
|
54f073e5cb | ||
|
|
c8760b4341 | ||
|
|
96da57cac0 | ||
|
|
f832bacfd6 | ||
|
|
e85643abf4 | ||
|
|
868ae81bab | ||
|
|
1a2dc05609 | ||
|
|
852e82d0ca | ||
|
|
2a01fbb0e8 | ||
|
|
6ce6330f50 | ||
|
|
d2bd2e1600 | ||
|
|
82325ecc8a | ||
|
|
e5b1faace6 | ||
|
|
7c7cd8b01d | ||
|
|
ca113b85aa | ||
|
|
a38ad2d1a9 | ||
|
|
9b4b267e7a | ||
|
|
f593afd164 | ||
|
|
0a98bb67d8 | ||
|
|
305b12d76b | ||
|
|
fa15f8015d | ||
|
|
3740ea05ee | ||
|
|
fa8ad51c79 | ||
|
|
480d90b009 | ||
|
|
8668b82ef6 | ||
|
|
fa1ed04aa8 | ||
|
|
83fc38344c | ||
|
|
5afce4bf8e | ||
|
|
933edb203f | ||
|
|
bdc8edea9d | ||
|
|
16b1913de1 | ||
|
|
4b177e0a9b | ||
|
|
8d17e1f963 | ||
|
|
e846f3cbac | ||
|
|
e3384b7ff7 | ||
|
|
c5d90a7722 | ||
|
|
b0a9c646c9 | ||
|
|
31bbf05ace | ||
|
|
62b5aa9bd9 | ||
|
|
ce3e1708e0 | ||
|
|
80e80ddccb | ||
|
|
29dbbcae52 | ||
|
|
40b968028a | ||
|
|
8096dc67f5 | ||
|
|
efa01dcaa3 | ||
|
|
497d15b5bc | ||
|
|
903b11b730 | ||
|
|
18c695e9dd | ||
|
|
6353d8c7ab | ||
|
|
9642d4994a | ||
|
|
3a369d5485 | ||
|
|
e77dba402c | ||
|
|
c29fcfb510 | ||
|
|
9d84429960 | ||
|
|
891369b197 | ||
|
|
51049128f5 | ||
|
|
257cbe3be8 | ||
|
|
bc02a1a05e | ||
|
|
b69b3db486 | ||
|
|
093bf8343d | ||
|
|
02723d4774 | ||
|
|
6b9484aa80 | ||
|
|
f66e6326e3 | ||
|
|
20f63c0af2 | ||
|
|
9479c79d79 | ||
|
|
557160c3c2 | ||
|
|
8132427870 | ||
|
|
15ad941908 | ||
|
|
d1ea96fd83 | ||
|
|
c36543a261 | ||
|
|
e4595d2a41 | ||
|
|
a4bc69c2f7 | ||
|
|
f31d56584d | ||
|
|
45426be0bc | ||
|
|
4b6147d3e3 | ||
|
|
8452fa0fd4 | ||
|
|
68f45709d8 | ||
|
|
8c41b3253c | ||
|
|
a415e779d1 | ||
|
|
61b9e119cb | ||
|
|
ec3fc8f307 | ||
|
|
9e88da5c66 | ||
|
|
e938e41c73 | ||
|
|
1b5c1f18fe | ||
|
|
26a595cd44 | ||
|
|
3f1cafe21f | ||
|
|
7dd63df087 | ||
|
|
78a062dfb6 | ||
|
|
6e4631a849 | ||
|
|
6fde862f61 | ||
|
|
4f969901da | ||
|
|
c5fc5e3394 | ||
|
|
cf26f68693 | ||
|
|
47834ad478 | ||
|
|
91c07ea37d | ||
|
|
d9a49797c4 | ||
|
|
a102859622 | ||
|
|
a899d24d4c | ||
|
|
3c5ea01e09 | ||
|
|
f4734b1143 | ||
|
|
bb9761aaf4 | ||
|
|
fc584cf6bc | ||
|
|
17e208a95e | ||
|
|
e3869ff3ac | ||
|
|
e705509d29 | ||
|
|
8c9a7c8bc7 |
@@ -1,6 +1,17 @@
|
|||||||
|
# System and IDE files
|
||||||
|
Thumbs.db
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.idea
|
.idea
|
||||||
Phaser OSX.sublime-project
|
Phaser OSX.sublime-project
|
||||||
Phaser OSX.sublime-workspace
|
Phaser OSX.sublime-workspace
|
||||||
Phaser.sublime-project
|
Phaser.sublime-project
|
||||||
Phaser.sublime-workspace
|
Phaser.sublime-workspace
|
||||||
|
*.suo
|
||||||
|
*.sublime-project
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Vendors
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Build
|
||||||
|
dist/
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"globals" : { "Phaser": false, "PIXI": false },
|
||||||
|
// Ignore Environment Globals
|
||||||
|
"browser" : true, // Standard browser globals e.g. `window`, `document`.
|
||||||
|
"couch" : false,
|
||||||
|
"dojo" : false,
|
||||||
|
"jquery" : true,
|
||||||
|
"mootools" : false,
|
||||||
|
"node" : false,
|
||||||
|
"nonstandard" : false,
|
||||||
|
"phantom" : false,
|
||||||
|
"prototypejs" : false,
|
||||||
|
"rhino" : false,
|
||||||
|
"worker" : false,
|
||||||
|
"wsh" : true, // Windows Scripting Host.
|
||||||
|
"yui" : false,
|
||||||
|
|
||||||
|
// Development
|
||||||
|
"debug" : true, // Allow debugger statements e.g. browser breakpoints.
|
||||||
|
"devel" : true, // Allow developments statements e.g. `console.log();`.
|
||||||
|
|
||||||
|
// ECMAScript Support
|
||||||
|
"es3" : true, // Support legacy browser and javascript environments.
|
||||||
|
"esnext" : false, // This option tells JSHint that your code uses ECMAScript 6 specific syntax.
|
||||||
|
"strict" : false, // Require `use strict` pragma in every file.
|
||||||
|
"globalstrict" : false, // Allow global "use strict" (also enables 'strict').
|
||||||
|
|
||||||
|
// Functionality
|
||||||
|
"asi" : true, // Tolerate Automatic Semicolon Insertion (no semicolons).
|
||||||
|
"bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
|
||||||
|
"boss" : true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
|
||||||
|
"camelcase" : true, // Force all variable names to use either camelCase style or UPPER_CASE with underscores.
|
||||||
|
"curly" : true, // Require {} for every new block or scope.
|
||||||
|
"eqeqeq" : false, // Require triple equals i.e. `===`.
|
||||||
|
"eqnull" : true, // Tolerate use of `== null`.
|
||||||
|
"evil" : false, // Tolerate use of `eval`.
|
||||||
|
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
|
||||||
|
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
|
||||||
|
"freeze" : true, // Prohibits overwriting prototypes of native objects such as Array and Date.
|
||||||
|
"funcscope" : true, // This option suppresses warnings about declaring variables inside of control structures while accessing them later from the outside.
|
||||||
|
"immed" : false, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
|
||||||
|
"iterator" : true, // This option suppresses warnings about the __iterator__ property.
|
||||||
|
"lastsemic" : true, // This option suppresses warnings about missing semicolons, but only when the semicolon is omitted for the last statement in a one-line block.
|
||||||
|
"latedef" : false, // Prohipit variable use before definition.
|
||||||
|
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
|
||||||
|
"laxcomma" : false, // This option suppresses warnings about comma-first coding style.
|
||||||
|
"loopfunc" : true, // Allow functions to be defined within loops.
|
||||||
|
// "maxcomplexity" : 10, // This option lets you control cyclomatic complexity throughout your code.
|
||||||
|
// "maxdepth" : 2, // This option lets you control how nested do you want your blocks to be.
|
||||||
|
// "maxlen" : 80, // This option lets you set the maximum length of a line.
|
||||||
|
// "maxparams" : 5, // This option lets you set the max number of formal parameters allowed per function.
|
||||||
|
// "maxstatements" : 25, // This option lets you set the max number of statements allowed per function.This option lets you set the max number of formal parameters allowed per function.
|
||||||
|
"moz" : false, // This options tells JSHint that your code uses Mozilla JavaScript extensions.
|
||||||
|
"multistr" : true, // This option suppresses warnings about multi-line strings.
|
||||||
|
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
|
||||||
|
"notypeof" : false, // This option suppresses warnings about invalid typeof operator values.
|
||||||
|
"proto" : true, // This option suppresses warnings about the __proto__ property.
|
||||||
|
"scripturl" : true, // Tolerate script-targeted URLs.
|
||||||
|
"shadow" : true, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
|
||||||
|
"smarttabs" : false, // This option suppresses warnings about mixed tabs and spaces when the latter are used for alignmnent only.
|
||||||
|
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
|
||||||
|
"undef" : true, // Require all non-global variables be declared before they are used.
|
||||||
|
"unused" : true, // This option warns when you define and never use your variables.
|
||||||
|
"validthis" : true, // This option suppresses warnings about possible strict violations when the code is running in strict mode and you use this in a non-constructor function.
|
||||||
|
|
||||||
|
// Styling
|
||||||
|
"indent" : 4, // Specify indentation spacing
|
||||||
|
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
|
||||||
|
"noempty" : true, // Prohibit use of empty blocks.
|
||||||
|
"nonew" : true, // Prohibit use of constructors for side-effects.
|
||||||
|
"plusplus" : false, // Prohibit use of `++` & `--`.
|
||||||
|
"quotmark" : false, // This option enforces the consistency of quotation marks used throughout your code.
|
||||||
|
"sub" : true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
|
||||||
|
"trailing" : true // Prohibit trailing whitespaces.
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
#How to contribute
|
||||||
|
|
||||||
|
It's important to us that you feel you can contribute towards the evolution of Phaser. This can take many forms: from helping to fix bugs or improve the docs, to adding in new features to the source. This guide should help you in making that process as smooth as possible.
|
||||||
|
|
||||||
|
|
||||||
|
##Reporting issues
|
||||||
|
|
||||||
|
[GitHub Issues][0] is the place to report bugs you may have found in either the core library or any of the examples that are part of the repository. When submitting a bug please do the following:
|
||||||
|
|
||||||
|
1. **Search for existing issues.** Your bug may have already been fixed or addressed in a development branch version of Phaser, so be sure to search the issues first before putting in a duplicate issue.
|
||||||
|
|
||||||
|
2. **Create an isolated and reproducible test case.** If you are reporting a bug, make sure you also have a minimal, runnable, code example that reproduces the problem you have.
|
||||||
|
|
||||||
|
3. **Include a live example.** After narrowing your code down to only the problem areas, make use of [jsFiddle][1], [jsBin][2], or a link to your live site so that we can view a live example of the problem.
|
||||||
|
|
||||||
|
4. **Share as much information as possible.** Include browser version affected, your OS, version of the library, steps to reproduce, etc. "X isn't working!!!1!" will probably just be closed.
|
||||||
|
|
||||||
|
|
||||||
|
##Pixi and Phaser
|
||||||
|
|
||||||
|
It's important to understand that internally Phaser uses [Pixi.js](https://github.com/GoodBoyDigital/pixi.js/) for all rendering. It's possible you may find a bug that is generated on the Pixi level rather than Phaser. You're welcome to still report the issue of course, but if you get a reply saying we think it might be a Pixi issue this is what we're talking about :)
|
||||||
|
|
||||||
|
|
||||||
|
##Support Forum
|
||||||
|
|
||||||
|
We have a very active [Phaser Support Forum](http://www.html5gamedevs.com/forum/14-phaser/). If you need general support, or are struggling to understand how to do something or need your code checked over, then we would urge you to post it to our forum. There are a lot of friendly devs in there who can help, as well as the core Phaser and Pixi teams, so it's a great place to get support from. You're welcome to report bugs directly on GitHub, but for general support we'd always recommend using the forum first.
|
||||||
|
|
||||||
|
|
||||||
|
##Dev vs. Master
|
||||||
|
|
||||||
|
The dev branch of Phaser is our 'current working' version. It is always ahead of the master branch in terms of features and fixes. However it's also bleeding-edge and experimental and we cannot and do not guarantee it will compile or work for you. Very often we have to break things for a few days while we rebuild and patch. So by all means please export the dev branch and contribute towards it, indeed that is where all Pull Requests should be sent, but do so understanding the API may change beneath you.
|
||||||
|
|
||||||
|
|
||||||
|
##Making Changes
|
||||||
|
|
||||||
|
To take advantage of our grunt build script and jshint config it will be easiest for you if you have node.js and grunt installed locally.
|
||||||
|
|
||||||
|
You can download node.js from [nodejs.org][3]. After it has been installed open a console and run `npm i - g grunt - cli` to install the global `grunt` executable.
|
||||||
|
|
||||||
|
After that you can clone the repository and run `npm i` inside the cloned folder. This will install dependencies necessary for building the project. Once that is ready,
|
||||||
|
make your changes and submit a Pull Request:
|
||||||
|
|
||||||
|
- **Send Pull Requests to the `dev` branch.** All Pull Requests must be sent to the `dev` branch, `master` is the latest release and PRs to that branch will be closed.
|
||||||
|
|
||||||
|
- **Ensure changes are jshint validated.** Our JSHint configuration file is provided in the repository and you should check against it before submitting.
|
||||||
|
|
||||||
|
- **Never commit new builds.** When making a code change you should always run `grunt` which will rebuild the project so you can test, *however* please do not commit these new builds or your PR will be closed. Builds by default are placed in the `dist` folder, to keep them separate from the `build` folder releases.
|
||||||
|
|
||||||
|
- **Only commit relevant changes.** Don't include changes that are not directly relevant to the fix you are making. The more focused a PR is, the faster it will get attention and be merged. Extra files changing only whitespace or trash files will likely get your PR closed.
|
||||||
|
|
||||||
|
|
||||||
|
##I don't really like git / node.js, but I can fix this bug
|
||||||
|
|
||||||
|
That is fine too. While Pull Requests are the best thing in the world for us, they are not the only way to help. You're welcome to post fixes to our forum or even just email them to us. All we ask is that you still adhere to the guidelines presented here re: JSHint, etc.
|
||||||
|
|
||||||
|
|
||||||
|
##Code Style Guide
|
||||||
|
|
||||||
|
- Use 4 spaces for tabs, never tab characters.
|
||||||
|
|
||||||
|
- No trailing whitespace, blank lines should have no whitespace.
|
||||||
|
|
||||||
|
- Always favor strict equals` === `unless you * need * to use type coercion.
|
||||||
|
|
||||||
|
- Follow conventions already in the code, and listen to jshint. Our config is set-up for a reason.
|
||||||
|
|
||||||
|
Thanks to Chad for creating the original Pixi.js Contributing file which we adapted for Phaser.
|
||||||
|
|
||||||
|
[0]: https://github.com/photonstorm/phaser/issues
|
||||||
|
[1]: http://jsfiddle.net
|
||||||
|
[2]: http://jsbin.com/
|
||||||
|
[3]: http://nodejs.org
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
YUI.add("yuidoc-meta", function(Y) {
|
|
||||||
Y.YUIDoc = { meta: {
|
|
||||||
"classes": [
|
|
||||||
"TimeManager"
|
|
||||||
],
|
|
||||||
"modules": [
|
|
||||||
"Phaser"
|
|
||||||
],
|
|
||||||
"allModules": [
|
|
||||||
{
|
|
||||||
"displayName": "Phaser",
|
|
||||||
"name": "Phaser"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
} };
|
|
||||||
});
|
|
||||||
|
Before Width: | Height: | Size: 491 B |
|
Before Width: | Height: | Size: 6.2 KiB |
@@ -1,783 +0,0 @@
|
|||||||
/*
|
|
||||||
Font sizes for all selectors other than the body are given in percentages,
|
|
||||||
with 100% equal to 13px. To calculate a font size percentage, multiply the
|
|
||||||
desired size in pixels by 7.6923076923.
|
|
||||||
|
|
||||||
Here's a quick lookup table:
|
|
||||||
|
|
||||||
10px - 76.923%
|
|
||||||
11px - 84.615%
|
|
||||||
12px - 92.308%
|
|
||||||
13px - 100%
|
|
||||||
14px - 107.692%
|
|
||||||
15px - 115.385%
|
|
||||||
16px - 123.077%
|
|
||||||
17px - 130.769%
|
|
||||||
18px - 138.462%
|
|
||||||
19px - 146.154%
|
|
||||||
20px - 153.846%
|
|
||||||
*/
|
|
||||||
|
|
||||||
html {
|
|
||||||
background: #fff;
|
|
||||||
color: #333;
|
|
||||||
overflow-y: scroll;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
/*font: 13px/1.4 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', 'Bitstream Vera Sans', 'Helvetica', 'Arial', sans-serif;*/
|
|
||||||
font: 13px/1.4 'Helvetica', 'Arial', sans-serif;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- Links ----------------------------------------------------------------- */
|
|
||||||
a {
|
|
||||||
color: #356de4;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover { text-decoration: underline; }
|
|
||||||
|
|
||||||
/* "Jump to Table of Contents" link is shown to assistive tools, but hidden from
|
|
||||||
sight until it's focused. */
|
|
||||||
.jump {
|
|
||||||
position: absolute;
|
|
||||||
padding: 3px 6px;
|
|
||||||
left: -99999px;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jump:focus { left: 40%; }
|
|
||||||
|
|
||||||
/* -- Paragraphs ------------------------------------------------------------ */
|
|
||||||
p { margin: 1.3em 0; }
|
|
||||||
dd p, td p { margin-bottom: 0; }
|
|
||||||
dd p:first-child, td p:first-child { margin-top: 0; }
|
|
||||||
|
|
||||||
/* -- Headings -------------------------------------------------------------- */
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
|
||||||
color: #D98527;/*was #f80*/
|
|
||||||
font-family: 'Trebuchet MS', sans-serif;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 1.1;
|
|
||||||
margin: 1.1em 0 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 184.6%;
|
|
||||||
color: #30418C;
|
|
||||||
margin: 0.75em 0 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 153.846%;
|
|
||||||
color: #E48A2B;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 { font-size: 138.462%; }
|
|
||||||
|
|
||||||
h4 {
|
|
||||||
border-bottom: 1px solid #DBDFEA;
|
|
||||||
color: #E48A2B;
|
|
||||||
font-size: 115.385%;
|
|
||||||
font-weight: normal;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h5, h6 { font-size: 107.692%; }
|
|
||||||
|
|
||||||
/* -- Code and examples ----------------------------------------------------- */
|
|
||||||
code, kbd, pre, samp {
|
|
||||||
font-family: Menlo, Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;
|
|
||||||
font-size: 92.308%;
|
|
||||||
line-height: 1.35;
|
|
||||||
}
|
|
||||||
|
|
||||||
p code, p kbd, p samp {
|
|
||||||
background: #FCFBFA;
|
|
||||||
border: 1px solid #EFEEED;
|
|
||||||
padding: 0 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a code, a kbd, a samp,
|
|
||||||
pre code, pre kbd, pre samp,
|
|
||||||
table code, table kbd, table samp,
|
|
||||||
.intro code, .intro kbd, .intro samp,
|
|
||||||
.toc code, .toc kbd, .toc samp {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pre.code, pre.terminal, pre.cmd {
|
|
||||||
overflow-x: auto;
|
|
||||||
*overflow-x: scroll;
|
|
||||||
padding: 0.3em 0.6em;
|
|
||||||
}
|
|
||||||
|
|
||||||
pre.code {
|
|
||||||
background: #FCFBFA;
|
|
||||||
border: 1px solid #EFEEED;
|
|
||||||
border-left-width: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
pre.terminal, pre.cmd {
|
|
||||||
background: #F0EFFC;
|
|
||||||
border: 1px solid #D0CBFB;
|
|
||||||
border-left: 5px solid #D0CBFB;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't reduce the font size of <code>/<kbd>/<samp> elements inside <pre>
|
|
||||||
blocks. */
|
|
||||||
pre code, pre kbd, pre samp { font-size: 100%; }
|
|
||||||
|
|
||||||
/* Used to denote text that shouldn't be selectable, such as line numbers or
|
|
||||||
shell prompts. Guess which browser this doesn't work in. */
|
|
||||||
.noselect {
|
|
||||||
-moz-user-select: -moz-none;
|
|
||||||
-khtml-user-select: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-o-user-select: none;
|
|
||||||
user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- Lists ----------------------------------------------------------------- */
|
|
||||||
dd { margin: 0.2em 0 0.7em 1em; }
|
|
||||||
dl { margin: 1em 0; }
|
|
||||||
dt { font-weight: bold; }
|
|
||||||
|
|
||||||
/* -- Tables ---------------------------------------------------------------- */
|
|
||||||
caption, th { text-align: left; }
|
|
||||||
|
|
||||||
table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
td, th {
|
|
||||||
border: 1px solid #fff;
|
|
||||||
padding: 5px 12px;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
td { background: #E6E9F5; }
|
|
||||||
td dl { margin: 0; }
|
|
||||||
td dl dl { margin: 1em 0; }
|
|
||||||
td pre:first-child { margin-top: 0; }
|
|
||||||
|
|
||||||
th {
|
|
||||||
background: #D2D7E6;/*#97A0BF*/
|
|
||||||
border-bottom: none;
|
|
||||||
border-top: none;
|
|
||||||
color: #000;/*#FFF1D5*/
|
|
||||||
font-family: 'Trebuchet MS', sans-serif;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 1.3;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* -- Layout and Content ---------------------------------------------------- */
|
|
||||||
#doc {
|
|
||||||
margin: auto;
|
|
||||||
min-width: 1024px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content { padding: 0 20px 0 25px; }
|
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
padding: 0 15px 0 10px;
|
|
||||||
}
|
|
||||||
#bd {
|
|
||||||
padding: 7px 0 130px;
|
|
||||||
position: relative;
|
|
||||||
width: 99%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- Table of Contents ----------------------------------------------------- */
|
|
||||||
|
|
||||||
/* The #toc id refers to the single global table of contents, while the .toc
|
|
||||||
class refers to generic TOC lists that could be used throughout the page. */
|
|
||||||
|
|
||||||
.toc code, .toc kbd, .toc samp { font-size: 100%; }
|
|
||||||
.toc li { font-weight: bold; }
|
|
||||||
.toc li li { font-weight: normal; }
|
|
||||||
|
|
||||||
/* -- Intro and Example Boxes ----------------------------------------------- */
|
|
||||||
/*
|
|
||||||
.intro, .example { margin-bottom: 2em; }
|
|
||||||
.example {
|
|
||||||
-moz-border-radius: 4px;
|
|
||||||
-webkit-border-radius: 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
-moz-box-shadow: 0 0 5px #bfbfbf;
|
|
||||||
-webkit-box-shadow: 0 0 5px #bfbfbf;
|
|
||||||
box-shadow: 0 0 5px #bfbfbf;
|
|
||||||
padding: 1em;
|
|
||||||
}
|
|
||||||
.intro {
|
|
||||||
background: none repeat scroll 0 0 #F0F1F8; border: 1px solid #D4D8EB; padding: 0 1em;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* -- Other Styles ---------------------------------------------------------- */
|
|
||||||
|
|
||||||
/* These are probably YUI-specific, and should be moved out of Selleck's default
|
|
||||||
theme. */
|
|
||||||
|
|
||||||
.button {
|
|
||||||
border: 1px solid #dadada;
|
|
||||||
-moz-border-radius: 3px;
|
|
||||||
-webkit-border-radius: 3px;
|
|
||||||
border-radius: 3px;
|
|
||||||
color: #444;
|
|
||||||
display: inline-block;
|
|
||||||
font-family: Helvetica, Arial, sans-serif;
|
|
||||||
font-size: 92.308%;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 4px 13px 3px;
|
|
||||||
-moz-text-shadow: 1px 1px 0 #fff;
|
|
||||||
-webkit-text-shadow: 1px 1px 0 #fff;
|
|
||||||
text-shadow: 1px 1px 0 #fff;
|
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
background: #EFEFEF; /* old browsers */
|
|
||||||
background: -moz-linear-gradient(top, #f5f5f5 0%, #efefef 50%, #e5e5e5 51%, #dfdfdf 100%); /* firefox */
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(50%,#efefef), color-stop(51%,#e5e5e5), color-stop(100%,#dfdfdf)); /* webkit */
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#dfdfdf',GradientType=0 ); /* ie */
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:hover {
|
|
||||||
border-color: #466899;
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
-moz-text-shadow: 1px 1px 0 #222;
|
|
||||||
-webkit-text-shadow: 1px 1px 0 #222;
|
|
||||||
text-shadow: 1px 1px 0 #222;
|
|
||||||
|
|
||||||
background: #6396D8; /* old browsers */
|
|
||||||
background: -moz-linear-gradient(top, #6396D8 0%, #5A83BC 50%, #547AB7 51%, #466899 100%); /* firefox */
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6396D8), color-stop(50%,#5A83BC), color-stop(51%,#547AB7), color-stop(100%,#466899)); /* webkit */
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6396D8', endColorstr='#466899',GradientType=0 ); /* ie */
|
|
||||||
}
|
|
||||||
|
|
||||||
.newwindow { text-align: center; }
|
|
||||||
|
|
||||||
.header .version em {
|
|
||||||
display: block;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#classdocs .item {
|
|
||||||
border-bottom: 1px solid #466899;
|
|
||||||
margin: 1em 0;
|
|
||||||
padding: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#classdocs .item .params p,
|
|
||||||
#classdocs .item .returns p,{
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
#classdocs .item em code, #classdocs .item em.comment {
|
|
||||||
color: green;
|
|
||||||
}
|
|
||||||
|
|
||||||
#classdocs .item em.comment a {
|
|
||||||
color: green;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
#classdocs .foundat {
|
|
||||||
font-size: 11px;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attrs .emits {
|
|
||||||
margin-left: 2em;
|
|
||||||
padding: .5em;
|
|
||||||
border-left: 1px dashed #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
abbr {
|
|
||||||
border-bottom: 1px dashed #ccc;
|
|
||||||
font-size: 80%;
|
|
||||||
cursor: help;
|
|
||||||
}
|
|
||||||
|
|
||||||
.prettyprint li.L0,
|
|
||||||
.prettyprint li.L1,
|
|
||||||
.prettyprint li.L2,
|
|
||||||
.prettyprint li.L3,
|
|
||||||
.prettyprint li.L5,
|
|
||||||
.prettyprint li.L6,
|
|
||||||
.prettyprint li.L7,
|
|
||||||
.prettyprint li.L8 {
|
|
||||||
list-style: decimal;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul li p {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.method .name {
|
|
||||||
font-size: 110%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .methods .extends .method,
|
|
||||||
.apidocs .properties .extends .property,
|
|
||||||
.apidocs .attrs .extends .attr,
|
|
||||||
.apidocs .events .extends .event {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .methods .extends .inherited,
|
|
||||||
.apidocs .properties .extends .inherited,
|
|
||||||
.apidocs .attrs .extends .inherited,
|
|
||||||
.apidocs .events .extends .inherited {
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
#hd {
|
|
||||||
background: whiteSmoke;
|
|
||||||
background: -moz-linear-gradient(top,#DCDBD9 0,#F6F5F3 100%);
|
|
||||||
background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#DCDBD9),color-stop(100%,#F6F5F3));
|
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dcdbd9',endColorstr='#F6F5F3',GradientType=0);
|
|
||||||
border-bottom: 1px solid #DFDFDF;
|
|
||||||
padding: 0 15px 1px 20px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#hd img {
|
|
||||||
margin-right: 10px;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* -- API Docs CSS ---------------------------------------------------------- */
|
|
||||||
|
|
||||||
/*
|
|
||||||
This file is organized so that more generic styles are nearer the top, and more
|
|
||||||
specific styles are nearer the bottom of the file. This allows us to take full
|
|
||||||
advantage of the cascade to avoid redundant style rules. Please respect this
|
|
||||||
convention when making changes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* -- Generic TabView styles ------------------------------------------------ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
These styles apply to all API doc tabviews. To change styles only for a
|
|
||||||
specific tabview, see the other sections below.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.yui3-js-enabled .apidocs .tabview {
|
|
||||||
visibility: hidden; /* Hide until the TabView finishes rendering. */
|
|
||||||
_visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .tabview.yui3-tabview-content { visibility: visible; }
|
|
||||||
.apidocs .tabview .yui3-tabview-panel { background: #fff; }
|
|
||||||
|
|
||||||
/* -- Generic Content Styles ------------------------------------------------ */
|
|
||||||
|
|
||||||
/* Headings */
|
|
||||||
h2, h3, h4, h5, h6 {
|
|
||||||
border: none;
|
|
||||||
color: #30418C;
|
|
||||||
font-weight: bold;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.link-docs {
|
|
||||||
float: right;
|
|
||||||
font-size: 15px;
|
|
||||||
margin: 4px 4px 6px;
|
|
||||||
padding: 6px 30px 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs { zoom: 1; }
|
|
||||||
|
|
||||||
/* Generic box styles. */
|
|
||||||
.apidocs .box {
|
|
||||||
border: 1px solid;
|
|
||||||
border-radius: 3px;
|
|
||||||
margin: 1em 0;
|
|
||||||
padding: 0 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A flag is a compact, capsule-like indicator of some kind. It's used to
|
|
||||||
indicate private and protected items, item return types, etc. in an
|
|
||||||
attractive and unobtrusive way. */
|
|
||||||
.apidocs .flag {
|
|
||||||
background: #bababa;
|
|
||||||
border-radius: 3px;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 11px;
|
|
||||||
margin: 0 0.5em;
|
|
||||||
padding: 2px 4px 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Class/module metadata such as "Uses", "Extends", "Defined in", etc. */
|
|
||||||
.apidocs .meta {
|
|
||||||
background: #f9f9f9;
|
|
||||||
border-color: #efefef;
|
|
||||||
color: #555;
|
|
||||||
font-size: 11px;
|
|
||||||
padding: 3px 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .meta p { margin: 0; }
|
|
||||||
|
|
||||||
/* Deprecation warning. */
|
|
||||||
.apidocs .box.deprecated,
|
|
||||||
.apidocs .flag.deprecated {
|
|
||||||
background: #fdac9f;
|
|
||||||
border: 1px solid #fd7775;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .box.deprecated p { margin: 0.5em 0; }
|
|
||||||
.apidocs .flag.deprecated { color: #333; }
|
|
||||||
|
|
||||||
/* Module/Class intro description. */
|
|
||||||
.apidocs .intro {
|
|
||||||
background: #f0f1f8;
|
|
||||||
border-color: #d4d8eb;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Loading spinners. */
|
|
||||||
#bd.loading .apidocs,
|
|
||||||
#api-list.loading .yui3-tabview-panel {
|
|
||||||
background: #fff url(../img/spinner.gif) no-repeat center 70px;
|
|
||||||
min-height: 150px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#bd.loading .apidocs .content,
|
|
||||||
#api-list.loading .yui3-tabview-panel .apis {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .no-visible-items { color: #666; }
|
|
||||||
|
|
||||||
/* Generic inline list. */
|
|
||||||
.apidocs ul.inline {
|
|
||||||
display: inline;
|
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs ul.inline li { display: inline; }
|
|
||||||
|
|
||||||
/* Comma-separated list. */
|
|
||||||
.apidocs ul.commas li:after { content: ','; }
|
|
||||||
.apidocs ul.commas li:last-child:after { content: ''; }
|
|
||||||
|
|
||||||
/* Keyboard shortcuts. */
|
|
||||||
kbd .cmd { font-family: Monaco, Helvetica; }
|
|
||||||
|
|
||||||
/* -- Generic Access Level styles ------------------------------------------- */
|
|
||||||
.apidocs .item.protected,
|
|
||||||
.apidocs .item.private,
|
|
||||||
.apidocs .index-item.protected,
|
|
||||||
.apidocs .index-item.deprecated,
|
|
||||||
.apidocs .index-item.private {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.show-deprecated .item.deprecated,
|
|
||||||
.show-deprecated .index-item.deprecated,
|
|
||||||
.show-protected .item.protected,
|
|
||||||
.show-protected .index-item.protected,
|
|
||||||
.show-private .item.private,
|
|
||||||
.show-private .index-item.private {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hide-inherited .item.inherited,
|
|
||||||
.hide-inherited .index-item.inherited {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- Generic Item Index styles --------------------------------------------- */
|
|
||||||
.apidocs .index { margin: 1.5em 0 3em; }
|
|
||||||
|
|
||||||
.apidocs .index h3 {
|
|
||||||
border-bottom: 1px solid #efefef;
|
|
||||||
color: #333;
|
|
||||||
font-size: 13px;
|
|
||||||
margin: 2em 0 0.6em;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .index .no-visible-items { margin-top: 2em; }
|
|
||||||
|
|
||||||
.apidocs .index-list {
|
|
||||||
border-color: #efefef;
|
|
||||||
font-size: 12px;
|
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
-moz-column-count: 4;
|
|
||||||
-moz-column-gap: 10px;
|
|
||||||
-moz-column-width: 170px;
|
|
||||||
-ms-column-count: 4;
|
|
||||||
-ms-column-gap: 10px;
|
|
||||||
-ms-column-width: 170px;
|
|
||||||
-o-column-count: 4;
|
|
||||||
-o-column-gap: 10px;
|
|
||||||
-o-column-width: 170px;
|
|
||||||
-webkit-column-count: 4;
|
|
||||||
-webkit-column-gap: 10px;
|
|
||||||
-webkit-column-width: 170px;
|
|
||||||
column-count: 4;
|
|
||||||
column-gap: 10px;
|
|
||||||
column-width: 170px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .no-columns .index-list {
|
|
||||||
-moz-column-count: 1;
|
|
||||||
-ms-column-count: 1;
|
|
||||||
-o-column-count: 1;
|
|
||||||
-webkit-column-count: 1;
|
|
||||||
column-count: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .index-item { white-space: nowrap; }
|
|
||||||
|
|
||||||
.apidocs .index-item .flag {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
color: #afafaf;
|
|
||||||
display: inline;
|
|
||||||
margin: 0 0 0 0.2em;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- Generic API item styles ----------------------------------------------- */
|
|
||||||
.apidocs .args {
|
|
||||||
display: inline;
|
|
||||||
margin: 0 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .flag.chainable { background: #46ca3b; }
|
|
||||||
.apidocs .flag.protected { background: #9b86fc; }
|
|
||||||
.apidocs .flag.private { background: #fd6b1b; }
|
|
||||||
.apidocs .flag.async { background: #356de4; }
|
|
||||||
.apidocs .flag.required { background: #e60923; }
|
|
||||||
|
|
||||||
.apidocs .item {
|
|
||||||
border-bottom: 1px solid #efefef;
|
|
||||||
margin: 1.5em 0 2em;
|
|
||||||
padding-bottom: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .item h4,
|
|
||||||
.apidocs .item h5,
|
|
||||||
.apidocs .item h6 {
|
|
||||||
color: #333;
|
|
||||||
font-family: inherit;
|
|
||||||
font-size: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .item .description p,
|
|
||||||
.apidocs .item pre.code {
|
|
||||||
margin: 1em 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .item .meta {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .item .name {
|
|
||||||
display: inline;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .item .type,
|
|
||||||
.apidocs .item .type a,
|
|
||||||
.apidocs .returns-inline {
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .item .type,
|
|
||||||
.apidocs .returns-inline {
|
|
||||||
font-size: 11px;
|
|
||||||
margin: 0 0 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .item .type a { border-bottom: 1px dotted #afafaf; }
|
|
||||||
.apidocs .item .type a:hover { border: none; }
|
|
||||||
|
|
||||||
/* -- Item Parameter List --------------------------------------------------- */
|
|
||||||
.apidocs .params-list {
|
|
||||||
list-style: square;
|
|
||||||
margin: 1em 0 0 2em;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .param { margin-bottom: 1em; }
|
|
||||||
|
|
||||||
.apidocs .param .type,
|
|
||||||
.apidocs .param .type a {
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .param .type {
|
|
||||||
margin: 0 0 0 0.5em;
|
|
||||||
*margin-left: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .param-name { font-weight: bold; }
|
|
||||||
|
|
||||||
/* -- Item "Emits" block ---------------------------------------------------- */
|
|
||||||
.apidocs .item .emits {
|
|
||||||
background: #f9f9f9;
|
|
||||||
border-color: #eaeaea;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- Item "Returns" block -------------------------------------------------- */
|
|
||||||
.apidocs .item .returns .type,
|
|
||||||
.apidocs .item .returns .type a {
|
|
||||||
font-size: 100%;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- Class Constructor block ----------------------------------------------- */
|
|
||||||
.apidocs .constructor .item {
|
|
||||||
border: none;
|
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- File Source View ------------------------------------------------------ */
|
|
||||||
.apidocs .file pre.code,
|
|
||||||
#doc .apidocs .file pre.prettyprint {
|
|
||||||
background: inherit;
|
|
||||||
border: none;
|
|
||||||
overflow: visible;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .L0,
|
|
||||||
.apidocs .L1,
|
|
||||||
.apidocs .L2,
|
|
||||||
.apidocs .L3,
|
|
||||||
.apidocs .L4,
|
|
||||||
.apidocs .L5,
|
|
||||||
.apidocs .L6,
|
|
||||||
.apidocs .L7,
|
|
||||||
.apidocs .L8,
|
|
||||||
.apidocs .L9 {
|
|
||||||
background: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- Submodule List -------------------------------------------------------- */
|
|
||||||
.apidocs .module-submodule-description {
|
|
||||||
font-size: 12px;
|
|
||||||
margin: 0.3em 0 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apidocs .module-submodule-description p:first-child { margin-top: 0; }
|
|
||||||
|
|
||||||
/* -- Sidebar TabView ------------------------------------------------------- */
|
|
||||||
#api-tabview { margin-top: 0.6em; }
|
|
||||||
|
|
||||||
#api-tabview-filter,
|
|
||||||
#api-tabview-panel {
|
|
||||||
border: 1px solid #dfdfdf;
|
|
||||||
}
|
|
||||||
|
|
||||||
#api-tabview-filter {
|
|
||||||
border-bottom: none;
|
|
||||||
border-top: none;
|
|
||||||
padding: 0.6em 10px 0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#api-tabview-panel { border-top: none; }
|
|
||||||
#api-filter { width: 97%; }
|
|
||||||
|
|
||||||
/* -- Content TabView ------------------------------------------------------- */
|
|
||||||
#classdocs .yui3-tabview-panel { border: none; }
|
|
||||||
|
|
||||||
/* -- Source File Contents -------------------------------------------------- */
|
|
||||||
.prettyprint li.L0,
|
|
||||||
.prettyprint li.L1,
|
|
||||||
.prettyprint li.L2,
|
|
||||||
.prettyprint li.L3,
|
|
||||||
.prettyprint li.L5,
|
|
||||||
.prettyprint li.L6,
|
|
||||||
.prettyprint li.L7,
|
|
||||||
.prettyprint li.L8 {
|
|
||||||
list-style: decimal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- API options ----------------------------------------------------------- */
|
|
||||||
#api-options {
|
|
||||||
font-size: 11px;
|
|
||||||
margin-top: 2.2em;
|
|
||||||
position: absolute;
|
|
||||||
right: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*#api-options label { margin-right: 0.6em; }*/
|
|
||||||
|
|
||||||
/* -- API list -------------------------------------------------------------- */
|
|
||||||
#api-list {
|
|
||||||
margin-top: 1.5em;
|
|
||||||
*zoom: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apis {
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 1.4;
|
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0.5em 0 0.5em 0.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apis a {
|
|
||||||
border: 1px solid transparent;
|
|
||||||
display: block;
|
|
||||||
margin: 0 0 0 -4px;
|
|
||||||
padding: 1px 4px 0;
|
|
||||||
text-decoration: none;
|
|
||||||
_border: none;
|
|
||||||
_display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apis a:hover,
|
|
||||||
.apis a:focus {
|
|
||||||
background: #E8EDFC;
|
|
||||||
background: -moz-linear-gradient(top, #e8edfc 0%, #becef7 100%);
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#E8EDFC), color-stop(100%,#BECEF7));
|
|
||||||
border-color: #AAC0FA;
|
|
||||||
border-radius: 3px;
|
|
||||||
color: #333;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.api-list-item a:hover,
|
|
||||||
.api-list-item a:focus {
|
|
||||||
font-weight: bold;
|
|
||||||
text-shadow: 1px 1px 1px #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apis .message { color: #888; }
|
|
||||||
.apis .result a { padding: 3px 5px 2px; }
|
|
||||||
|
|
||||||
.apis .result .type {
|
|
||||||
right: 4px;
|
|
||||||
top: 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.api-list-item .yui3-highlight {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 740 B |
|
Before Width: | Height: | Size: 2.6 KiB |
@@ -1,10 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Redirector</title>
|
|
||||||
<meta http-equiv="refresh" content="0;url=../">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<a href="../">Click here to redirect</a>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
YUI.add('api-filter', function (Y) {
|
|
||||||
|
|
||||||
Y.APIFilter = Y.Base.create('apiFilter', Y.Base, [Y.AutoCompleteBase], {
|
|
||||||
// -- Initializer ----------------------------------------------------------
|
|
||||||
initializer: function () {
|
|
||||||
this._bindUIACBase();
|
|
||||||
this._syncUIACBase();
|
|
||||||
},
|
|
||||||
getDisplayName: function(name) {
|
|
||||||
|
|
||||||
Y.each(Y.YUIDoc.meta.allModules, function(i) {
|
|
||||||
if (i.name === name && i.displayName) {
|
|
||||||
name = i.displayName;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}, {
|
|
||||||
// -- Attributes -----------------------------------------------------------
|
|
||||||
ATTRS: {
|
|
||||||
resultHighlighter: {
|
|
||||||
value: 'phraseMatch'
|
|
||||||
},
|
|
||||||
|
|
||||||
// May be set to "classes" or "modules".
|
|
||||||
queryType: {
|
|
||||||
value: 'classes'
|
|
||||||
},
|
|
||||||
|
|
||||||
source: {
|
|
||||||
valueFn: function() {
|
|
||||||
var self = this;
|
|
||||||
return function(q) {
|
|
||||||
var data = Y.YUIDoc.meta[self.get('queryType')],
|
|
||||||
out = [];
|
|
||||||
Y.each(data, function(v) {
|
|
||||||
if (v.toLowerCase().indexOf(q.toLowerCase()) > -1) {
|
|
||||||
out.push(v);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return out;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}, '3.4.0', {requires: [
|
|
||||||
'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources'
|
|
||||||
]});
|
|
||||||
@@ -1,251 +0,0 @@
|
|||||||
YUI.add('api-list', function (Y) {
|
|
||||||
|
|
||||||
var Lang = Y.Lang,
|
|
||||||
YArray = Y.Array,
|
|
||||||
|
|
||||||
APIList = Y.namespace('APIList'),
|
|
||||||
|
|
||||||
classesNode = Y.one('#api-classes'),
|
|
||||||
inputNode = Y.one('#api-filter'),
|
|
||||||
modulesNode = Y.one('#api-modules'),
|
|
||||||
tabviewNode = Y.one('#api-tabview'),
|
|
||||||
|
|
||||||
tabs = APIList.tabs = {},
|
|
||||||
|
|
||||||
filter = APIList.filter = new Y.APIFilter({
|
|
||||||
inputNode : inputNode,
|
|
||||||
maxResults: 1000,
|
|
||||||
|
|
||||||
on: {
|
|
||||||
results: onFilterResults
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
search = APIList.search = new Y.APISearch({
|
|
||||||
inputNode : inputNode,
|
|
||||||
maxResults: 100,
|
|
||||||
|
|
||||||
on: {
|
|
||||||
clear : onSearchClear,
|
|
||||||
results: onSearchResults
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
tabview = APIList.tabview = new Y.TabView({
|
|
||||||
srcNode : tabviewNode,
|
|
||||||
panelNode: '#api-tabview-panel',
|
|
||||||
render : true,
|
|
||||||
|
|
||||||
on: {
|
|
||||||
selectionChange: onTabSelectionChange
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
focusManager = APIList.focusManager = tabviewNode.plug(Y.Plugin.NodeFocusManager, {
|
|
||||||
circular : true,
|
|
||||||
descendants: '#api-filter, .yui3-tab-panel-selected .api-list-item a, .yui3-tab-panel-selected .result a',
|
|
||||||
keys : {next: 'down:40', previous: 'down:38'}
|
|
||||||
}).focusManager,
|
|
||||||
|
|
||||||
LIST_ITEM_TEMPLATE =
|
|
||||||
'<li class="api-list-item {typeSingular}">' +
|
|
||||||
'<a href="{rootPath}{typePlural}/{name}.html">{displayName}</a>' +
|
|
||||||
'</li>';
|
|
||||||
|
|
||||||
// -- Init ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Duckpunch FocusManager's key event handling to prevent it from handling key
|
|
||||||
// events when a modifier is pressed.
|
|
||||||
Y.before(function (e, activeDescendant) {
|
|
||||||
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
||||||
return new Y.Do.Prevent();
|
|
||||||
}
|
|
||||||
}, focusManager, '_focusPrevious', focusManager);
|
|
||||||
|
|
||||||
Y.before(function (e, activeDescendant) {
|
|
||||||
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
||||||
return new Y.Do.Prevent();
|
|
||||||
}
|
|
||||||
}, focusManager, '_focusNext', focusManager);
|
|
||||||
|
|
||||||
// Create a mapping of tabs in the tabview so we can refer to them easily later.
|
|
||||||
tabview.each(function (tab, index) {
|
|
||||||
var name = tab.get('label').toLowerCase();
|
|
||||||
|
|
||||||
tabs[name] = {
|
|
||||||
index: index,
|
|
||||||
name : name,
|
|
||||||
tab : tab
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// Switch tabs on Ctrl/Cmd-Left/Right arrows.
|
|
||||||
tabviewNode.on('key', onTabSwitchKey, 'down:37,39');
|
|
||||||
|
|
||||||
// Focus the filter input when the `/` key is pressed.
|
|
||||||
Y.one(Y.config.doc).on('key', onSearchKey, 'down:83');
|
|
||||||
|
|
||||||
// Keep the Focus Manager up to date.
|
|
||||||
inputNode.on('focus', function () {
|
|
||||||
focusManager.set('activeDescendant', inputNode);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update all tabview links to resolved URLs.
|
|
||||||
tabview.get('panelNode').all('a').each(function (link) {
|
|
||||||
link.setAttribute('href', link.get('href'));
|
|
||||||
});
|
|
||||||
|
|
||||||
// -- Private Functions --------------------------------------------------------
|
|
||||||
function getFilterResultNode() {
|
|
||||||
return filter.get('queryType') === 'classes' ? classesNode : modulesNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -- Event Handlers -----------------------------------------------------------
|
|
||||||
function onFilterResults(e) {
|
|
||||||
var frag = Y.one(Y.config.doc.createDocumentFragment()),
|
|
||||||
resultNode = getFilterResultNode(),
|
|
||||||
typePlural = filter.get('queryType'),
|
|
||||||
typeSingular = typePlural === 'classes' ? 'class' : 'module';
|
|
||||||
|
|
||||||
if (e.results.length) {
|
|
||||||
YArray.each(e.results, function (result) {
|
|
||||||
frag.append(Lang.sub(LIST_ITEM_TEMPLATE, {
|
|
||||||
rootPath : APIList.rootPath,
|
|
||||||
displayName : filter.getDisplayName(result.highlighted),
|
|
||||||
name : result.text,
|
|
||||||
typePlural : typePlural,
|
|
||||||
typeSingular: typeSingular
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
frag.append(
|
|
||||||
'<li class="message">' +
|
|
||||||
'No ' + typePlural + ' found.' +
|
|
||||||
'</li>'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
resultNode.empty(true);
|
|
||||||
resultNode.append(frag);
|
|
||||||
|
|
||||||
focusManager.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSearchClear(e) {
|
|
||||||
|
|
||||||
focusManager.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSearchKey(e) {
|
|
||||||
var target = e.target;
|
|
||||||
|
|
||||||
if (target.test('input,select,textarea')
|
|
||||||
|| target.get('isContentEditable')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
inputNode.focus();
|
|
||||||
focusManager.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSearchResults(e) {
|
|
||||||
var frag = Y.one(Y.config.doc.createDocumentFragment());
|
|
||||||
|
|
||||||
if (e.results.length) {
|
|
||||||
YArray.each(e.results, function (result) {
|
|
||||||
frag.append(result.display);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
frag.append(
|
|
||||||
'<li class="message">' +
|
|
||||||
'No results found. Maybe you\'ll have better luck with a ' +
|
|
||||||
'different query?' +
|
|
||||||
'</li>'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
focusManager.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onTabSelectionChange(e) {
|
|
||||||
var tab = e.newVal,
|
|
||||||
name = tab.get('label').toLowerCase();
|
|
||||||
|
|
||||||
tabs.selected = {
|
|
||||||
index: tab.get('index'),
|
|
||||||
name : name,
|
|
||||||
tab : tab
|
|
||||||
};
|
|
||||||
|
|
||||||
switch (name) {
|
|
||||||
case 'classes': // fallthru
|
|
||||||
case 'modules':
|
|
||||||
filter.setAttrs({
|
|
||||||
minQueryLength: 0,
|
|
||||||
queryType : name
|
|
||||||
});
|
|
||||||
|
|
||||||
search.set('minQueryLength', -1);
|
|
||||||
|
|
||||||
// Only send a request if this isn't the initially-selected tab.
|
|
||||||
if (e.prevVal) {
|
|
||||||
filter.sendRequest(filter.get('value'));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'everything':
|
|
||||||
filter.set('minQueryLength', -1);
|
|
||||||
search.set('minQueryLength', 1);
|
|
||||||
|
|
||||||
if (search.get('value')) {
|
|
||||||
search.sendRequest(search.get('value'));
|
|
||||||
} else {
|
|
||||||
inputNode.focus();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// WTF? We shouldn't be here!
|
|
||||||
filter.set('minQueryLength', -1);
|
|
||||||
search.set('minQueryLength', -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (focusManager) {
|
|
||||||
setTimeout(function () {
|
|
||||||
focusManager.refresh();
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onTabSwitchKey(e) {
|
|
||||||
var currentTabIndex = tabs.selected.index;
|
|
||||||
|
|
||||||
if (!(e.ctrlKey || e.metaKey)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
switch (e.keyCode) {
|
|
||||||
case 37: // left arrow
|
|
||||||
if (currentTabIndex > 0) {
|
|
||||||
tabview.selectChild(currentTabIndex - 1);
|
|
||||||
inputNode.focus();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 39: // right arrow
|
|
||||||
if (currentTabIndex < (Y.Object.size(tabs) - 2)) {
|
|
||||||
tabview.selectChild(currentTabIndex + 1);
|
|
||||||
inputNode.focus();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}, '3.4.0', {requires: [
|
|
||||||
'api-filter', 'api-search', 'event-key', 'node-focusmanager', 'tabview'
|
|
||||||
]});
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
YUI.add('api-search', function (Y) {
|
|
||||||
|
|
||||||
var Lang = Y.Lang,
|
|
||||||
Node = Y.Node,
|
|
||||||
YArray = Y.Array;
|
|
||||||
|
|
||||||
Y.APISearch = Y.Base.create('apiSearch', Y.Base, [Y.AutoCompleteBase], {
|
|
||||||
// -- Public Properties ----------------------------------------------------
|
|
||||||
RESULT_TEMPLATE:
|
|
||||||
'<li class="result {resultType}">' +
|
|
||||||
'<a href="{url}">' +
|
|
||||||
'<h3 class="title">{name}</h3>' +
|
|
||||||
'<span class="type">{resultType}</span>' +
|
|
||||||
'<div class="description">{description}</div>' +
|
|
||||||
'<span class="className">{class}</span>' +
|
|
||||||
'</a>' +
|
|
||||||
'</li>',
|
|
||||||
|
|
||||||
// -- Initializer ----------------------------------------------------------
|
|
||||||
initializer: function () {
|
|
||||||
this._bindUIACBase();
|
|
||||||
this._syncUIACBase();
|
|
||||||
},
|
|
||||||
|
|
||||||
// -- Protected Methods ----------------------------------------------------
|
|
||||||
_apiResultFilter: function (query, results) {
|
|
||||||
// Filter components out of the results.
|
|
||||||
return YArray.filter(results, function (result) {
|
|
||||||
return result.raw.resultType === 'component' ? false : result;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
_apiResultFormatter: function (query, results) {
|
|
||||||
return YArray.map(results, function (result) {
|
|
||||||
var raw = Y.merge(result.raw), // create a copy
|
|
||||||
desc = raw.description || '';
|
|
||||||
|
|
||||||
// Convert description to text and truncate it if necessary.
|
|
||||||
desc = Node.create('<div>' + desc + '</div>').get('text');
|
|
||||||
|
|
||||||
if (desc.length > 65) {
|
|
||||||
desc = Y.Escape.html(desc.substr(0, 65)) + ' …';
|
|
||||||
} else {
|
|
||||||
desc = Y.Escape.html(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
raw['class'] || (raw['class'] = '');
|
|
||||||
raw.description = desc;
|
|
||||||
|
|
||||||
// Use the highlighted result name.
|
|
||||||
raw.name = result.highlighted;
|
|
||||||
|
|
||||||
return Lang.sub(this.RESULT_TEMPLATE, raw);
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
|
|
||||||
_apiTextLocator: function (result) {
|
|
||||||
return result.displayName || result.name;
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
// -- Attributes -----------------------------------------------------------
|
|
||||||
ATTRS: {
|
|
||||||
resultFormatter: {
|
|
||||||
valueFn: function () {
|
|
||||||
return this._apiResultFormatter;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
resultFilters: {
|
|
||||||
valueFn: function () {
|
|
||||||
return this._apiResultFilter;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
resultHighlighter: {
|
|
||||||
value: 'phraseMatch'
|
|
||||||
},
|
|
||||||
|
|
||||||
resultListLocator: {
|
|
||||||
value: 'data.results'
|
|
||||||
},
|
|
||||||
|
|
||||||
resultTextLocator: {
|
|
||||||
valueFn: function () {
|
|
||||||
return this._apiTextLocator;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
source: {
|
|
||||||
value: '/api/v1/search?q={query}&count={maxResults}'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}, '3.4.0', {requires: [
|
|
||||||
'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources',
|
|
||||||
'escape'
|
|
||||||
]});
|
|
||||||
@@ -1,370 +0,0 @@
|
|||||||
YUI().use(
|
|
||||||
'yuidoc-meta',
|
|
||||||
'api-list', 'history-hash', 'node-screen', 'node-style', 'pjax',
|
|
||||||
function (Y) {
|
|
||||||
|
|
||||||
var win = Y.config.win,
|
|
||||||
localStorage = win.localStorage,
|
|
||||||
|
|
||||||
bdNode = Y.one('#bd'),
|
|
||||||
|
|
||||||
pjax,
|
|
||||||
defaultRoute,
|
|
||||||
|
|
||||||
classTabView,
|
|
||||||
selectedTab;
|
|
||||||
|
|
||||||
// Kill pjax functionality unless serving over HTTP.
|
|
||||||
if (!Y.getLocation().protocol.match(/^https?\:/)) {
|
|
||||||
Y.Router.html5 = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the default route with middleware which enables syntax highlighting
|
|
||||||
// on the loaded content.
|
|
||||||
defaultRoute = Y.Pjax.defaultRoute.concat(function (req, res, next) {
|
|
||||||
prettyPrint();
|
|
||||||
bdNode.removeClass('loading');
|
|
||||||
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
pjax = new Y.Pjax({
|
|
||||||
container : '#docs-main',
|
|
||||||
contentSelector: '#docs-main > .content',
|
|
||||||
linkSelector : '#bd a',
|
|
||||||
titleSelector : '#xhr-title',
|
|
||||||
|
|
||||||
navigateOnHash: true,
|
|
||||||
root : '/',
|
|
||||||
routes : [
|
|
||||||
// -- / ----------------------------------------------------------------
|
|
||||||
{
|
|
||||||
path : '/(index.html)?',
|
|
||||||
callbacks: defaultRoute
|
|
||||||
},
|
|
||||||
|
|
||||||
// -- /classes/* -------------------------------------------------------
|
|
||||||
{
|
|
||||||
path : '/classes/:class.html*',
|
|
||||||
callbacks: [defaultRoute, 'handleClasses']
|
|
||||||
},
|
|
||||||
|
|
||||||
// -- /files/* ---------------------------------------------------------
|
|
||||||
{
|
|
||||||
path : '/files/*file',
|
|
||||||
callbacks: [defaultRoute, 'handleFiles']
|
|
||||||
},
|
|
||||||
|
|
||||||
// -- /modules/* -------------------------------------------------------
|
|
||||||
{
|
|
||||||
path : '/modules/:module.html*',
|
|
||||||
callbacks: defaultRoute
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// -- Utility Functions --------------------------------------------------------
|
|
||||||
|
|
||||||
pjax.checkVisibility = function (tab) {
|
|
||||||
tab || (tab = selectedTab);
|
|
||||||
|
|
||||||
if (!tab) { return; }
|
|
||||||
|
|
||||||
var panelNode = tab.get('panelNode'),
|
|
||||||
visibleItems;
|
|
||||||
|
|
||||||
// If no items are visible in the tab panel due to the current visibility
|
|
||||||
// settings, display a message to that effect.
|
|
||||||
visibleItems = panelNode.all('.item,.index-item').some(function (itemNode) {
|
|
||||||
if (itemNode.getComputedStyle('display') !== 'none') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
panelNode.all('.no-visible-items').remove();
|
|
||||||
|
|
||||||
if (!visibleItems) {
|
|
||||||
if (Y.one('#index .index-item')) {
|
|
||||||
panelNode.append(
|
|
||||||
'<div class="no-visible-items">' +
|
|
||||||
'<p>' +
|
|
||||||
'Some items are not shown due to the current visibility ' +
|
|
||||||
'settings. Use the checkboxes at the upper right of this ' +
|
|
||||||
'page to change the visibility settings.' +
|
|
||||||
'</p>' +
|
|
||||||
'</div>'
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
panelNode.append(
|
|
||||||
'<div class="no-visible-items">' +
|
|
||||||
'<p>' +
|
|
||||||
'This class doesn\'t provide any methods, properties, ' +
|
|
||||||
'attributes, or events.' +
|
|
||||||
'</p>' +
|
|
||||||
'</div>'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide index sections without any visible items.
|
|
||||||
Y.all('.index-section').each(function (section) {
|
|
||||||
var items = 0,
|
|
||||||
visibleItems = 0;
|
|
||||||
|
|
||||||
section.all('.index-item').each(function (itemNode) {
|
|
||||||
items += 1;
|
|
||||||
|
|
||||||
if (itemNode.getComputedStyle('display') !== 'none') {
|
|
||||||
visibleItems += 1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
section.toggleClass('hidden', !visibleItems);
|
|
||||||
section.toggleClass('no-columns', visibleItems < 4);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
pjax.initClassTabView = function () {
|
|
||||||
if (!Y.all('#classdocs .api-class-tab').size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (classTabView) {
|
|
||||||
classTabView.destroy();
|
|
||||||
selectedTab = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
classTabView = new Y.TabView({
|
|
||||||
srcNode: '#classdocs',
|
|
||||||
|
|
||||||
on: {
|
|
||||||
selectionChange: pjax.onTabSelectionChange
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
pjax.updateTabState();
|
|
||||||
classTabView.render();
|
|
||||||
};
|
|
||||||
|
|
||||||
pjax.initLineNumbers = function () {
|
|
||||||
var hash = win.location.hash.substring(1),
|
|
||||||
container = pjax.get('container'),
|
|
||||||
hasLines, node;
|
|
||||||
|
|
||||||
// Add ids for each line number in the file source view.
|
|
||||||
container.all('.linenums>li').each(function (lineNode, index) {
|
|
||||||
lineNode.set('id', 'l' + (index + 1));
|
|
||||||
lineNode.addClass('file-line');
|
|
||||||
hasLines = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Scroll to the desired line.
|
|
||||||
if (hasLines && /^l\d+$/.test(hash)) {
|
|
||||||
if ((node = container.getById(hash))) {
|
|
||||||
win.scroll(0, node.getY());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
pjax.initRoot = function () {
|
|
||||||
var terminators = /^(?:classes|files|modules)$/,
|
|
||||||
parts = pjax._getPathRoot().split('/'),
|
|
||||||
root = [],
|
|
||||||
i, len, part;
|
|
||||||
|
|
||||||
for (i = 0, len = parts.length; i < len; i += 1) {
|
|
||||||
part = parts[i];
|
|
||||||
|
|
||||||
if (part.match(terminators)) {
|
|
||||||
// Makes sure the path will end with a "/".
|
|
||||||
root.push('');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
root.push(part);
|
|
||||||
}
|
|
||||||
|
|
||||||
pjax.set('root', root.join('/'));
|
|
||||||
};
|
|
||||||
|
|
||||||
pjax.updateTabState = function (src) {
|
|
||||||
var hash = win.location.hash.substring(1),
|
|
||||||
defaultTab, node, tab, tabPanel;
|
|
||||||
|
|
||||||
function scrollToNode() {
|
|
||||||
if (node.hasClass('protected')) {
|
|
||||||
Y.one('#api-show-protected').set('checked', true);
|
|
||||||
pjax.updateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.hasClass('private')) {
|
|
||||||
Y.one('#api-show-private').set('checked', true);
|
|
||||||
pjax.updateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
// For some reason, unless we re-get the node instance here,
|
|
||||||
// getY() always returns 0.
|
|
||||||
var node = Y.one('#classdocs').getById(hash);
|
|
||||||
win.scrollTo(0, node.getY() - 70);
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!classTabView) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (src === 'hashchange' && !hash) {
|
|
||||||
defaultTab = 'index';
|
|
||||||
} else {
|
|
||||||
if (localStorage) {
|
|
||||||
defaultTab = localStorage.getItem('tab_' + pjax.getPath()) ||
|
|
||||||
'index';
|
|
||||||
} else {
|
|
||||||
defaultTab = 'index';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hash && (node = Y.one('#classdocs').getById(hash))) {
|
|
||||||
if ((tabPanel = node.ancestor('.api-class-tabpanel', true))) {
|
|
||||||
if ((tab = Y.one('#classdocs .api-class-tab.' + tabPanel.get('id')))) {
|
|
||||||
if (classTabView.get('rendered')) {
|
|
||||||
Y.Widget.getByNode(tab).set('selected', 1);
|
|
||||||
} else {
|
|
||||||
tab.addClass('yui3-tab-selected');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scroll to the desired element if this is a hash URL.
|
|
||||||
if (node) {
|
|
||||||
if (classTabView.get('rendered')) {
|
|
||||||
scrollToNode();
|
|
||||||
} else {
|
|
||||||
classTabView.once('renderedChange', scrollToNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tab = Y.one('#classdocs .api-class-tab.' + defaultTab);
|
|
||||||
|
|
||||||
// When the `defaultTab` node isn't found, `localStorage` is stale.
|
|
||||||
if (!tab && defaultTab !== 'index') {
|
|
||||||
tab = Y.one('#classdocs .api-class-tab.index');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (classTabView.get('rendered')) {
|
|
||||||
Y.Widget.getByNode(tab).set('selected', 1);
|
|
||||||
} else {
|
|
||||||
tab.addClass('yui3-tab-selected');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
pjax.updateVisibility = function () {
|
|
||||||
var container = pjax.get('container');
|
|
||||||
|
|
||||||
container.toggleClass('hide-inherited',
|
|
||||||
!Y.one('#api-show-inherited').get('checked'));
|
|
||||||
|
|
||||||
container.toggleClass('show-deprecated',
|
|
||||||
Y.one('#api-show-deprecated').get('checked'));
|
|
||||||
|
|
||||||
container.toggleClass('show-protected',
|
|
||||||
Y.one('#api-show-protected').get('checked'));
|
|
||||||
|
|
||||||
container.toggleClass('show-private',
|
|
||||||
Y.one('#api-show-private').get('checked'));
|
|
||||||
|
|
||||||
pjax.checkVisibility();
|
|
||||||
};
|
|
||||||
|
|
||||||
// -- Route Handlers -----------------------------------------------------------
|
|
||||||
|
|
||||||
pjax.handleClasses = function (req, res, next) {
|
|
||||||
var status = res.ioResponse.status;
|
|
||||||
|
|
||||||
// Handles success and local filesystem XHRs.
|
|
||||||
if (!status || (status >= 200 && status < 300)) {
|
|
||||||
pjax.initClassTabView();
|
|
||||||
}
|
|
||||||
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
|
|
||||||
pjax.handleFiles = function (req, res, next) {
|
|
||||||
var status = res.ioResponse.status;
|
|
||||||
|
|
||||||
// Handles success and local filesystem XHRs.
|
|
||||||
if (!status || (status >= 200 && status < 300)) {
|
|
||||||
pjax.initLineNumbers();
|
|
||||||
}
|
|
||||||
|
|
||||||
next();
|
|
||||||
};
|
|
||||||
|
|
||||||
// -- Event Handlers -----------------------------------------------------------
|
|
||||||
|
|
||||||
pjax.onNavigate = function (e) {
|
|
||||||
var hash = e.hash,
|
|
||||||
originTarget = e.originEvent && e.originEvent.target,
|
|
||||||
tab;
|
|
||||||
|
|
||||||
if (hash) {
|
|
||||||
tab = originTarget && originTarget.ancestor('.yui3-tab', true);
|
|
||||||
|
|
||||||
if (hash === win.location.hash) {
|
|
||||||
pjax.updateTabState('hashchange');
|
|
||||||
} else if (!tab) {
|
|
||||||
win.location.hash = hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only scroll to the top of the page when the URL doesn't have a hash.
|
|
||||||
this.set('scrollToTop', !e.url.match(/#.+$/));
|
|
||||||
|
|
||||||
bdNode.addClass('loading');
|
|
||||||
};
|
|
||||||
|
|
||||||
pjax.onOptionClick = function (e) {
|
|
||||||
pjax.updateVisibility();
|
|
||||||
};
|
|
||||||
|
|
||||||
pjax.onTabSelectionChange = function (e) {
|
|
||||||
var tab = e.newVal,
|
|
||||||
tabId = tab.get('contentBox').getAttribute('href').substring(1);
|
|
||||||
|
|
||||||
selectedTab = tab;
|
|
||||||
|
|
||||||
// If switching from a previous tab (i.e., this is not the default tab),
|
|
||||||
// replace the history entry with a hash URL that will cause this tab to
|
|
||||||
// be selected if the user navigates away and then returns using the back
|
|
||||||
// or forward buttons.
|
|
||||||
if (e.prevVal && localStorage) {
|
|
||||||
localStorage.setItem('tab_' + pjax.getPath(), tabId);
|
|
||||||
}
|
|
||||||
|
|
||||||
pjax.checkVisibility(tab);
|
|
||||||
};
|
|
||||||
|
|
||||||
// -- Init ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
pjax.on('navigate', pjax.onNavigate);
|
|
||||||
|
|
||||||
pjax.initRoot();
|
|
||||||
pjax.upgrade();
|
|
||||||
pjax.initClassTabView();
|
|
||||||
pjax.initLineNumbers();
|
|
||||||
pjax.updateVisibility();
|
|
||||||
|
|
||||||
Y.APIList.rootPath = pjax.get('root');
|
|
||||||
|
|
||||||
Y.one('#api-options').delegate('click', pjax.onOptionClick, 'input');
|
|
||||||
|
|
||||||
Y.on('hashchange', function (e) {
|
|
||||||
pjax.updateTabState('hashchange');
|
|
||||||
}, win);
|
|
||||||
|
|
||||||
});
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
YUI().use('node', function(Y) {
|
|
||||||
var code = Y.all('.prettyprint.linenums');
|
|
||||||
if (code.size()) {
|
|
||||||
code.each(function(c) {
|
|
||||||
var lis = c.all('ol li'),
|
|
||||||
l = 1;
|
|
||||||
lis.each(function(n) {
|
|
||||||
n.prepend('<a name="LINENUM_' + l + '"></a>');
|
|
||||||
l++;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
var h = location.hash;
|
|
||||||
location.hash = '';
|
|
||||||
h = h.replace('LINE_', 'LINENUM_');
|
|
||||||
location.hash = h;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
||||||
<title>Change Log</title>
|
|
||||||
</head>
|
|
||||||
<body bgcolor="white">
|
|
||||||
<a style="float:right" href="README.html">README</a>
|
|
||||||
|
|
||||||
<h1>Known Issues</h1>
|
|
||||||
<ul>
|
|
||||||
<li>Perl formatting is really crappy. Partly because the author is lazy and
|
|
||||||
partly because Perl is
|
|
||||||
<a href="http://www.perlmonks.org/?node_id=663393">hard</a> to parse.
|
|
||||||
<li>On some browsers, <code><code></code> elements with newlines in the text
|
|
||||||
which use CSS to specify <code>white-space:pre</code> will have the newlines
|
|
||||||
improperly stripped if the element is not attached to the document at the time
|
|
||||||
the stripping is done. Also, on IE 6, all newlines will be stripped from
|
|
||||||
<code><code></code> elements because of the way IE6 produces
|
|
||||||
<code>innerHTML</code>. Workaround: use <code><pre></code> for code with
|
|
||||||
newlines.
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h1>Change Log</h1>
|
|
||||||
<h2>29 March 2007</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Added <a href="tests/prettify_test.html#PHP">tests</a> for PHP support
|
|
||||||
to address
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=3"
|
|
||||||
>issue 3</a>.
|
|
||||||
<li>Fixed
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=6"
|
|
||||||
>bug</a>: <code>prettyPrintOne</code> was not halting. This was not
|
|
||||||
reachable through the normal entry point.
|
|
||||||
<li>Fixed
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=4"
|
|
||||||
>bug</a>: recursing into a script block or PHP tag that was not properly
|
|
||||||
closed would not silently drop the content.
|
|
||||||
(<a href="tests/prettify_test.html#issue4">test</a>)
|
|
||||||
<li>Fixed
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=8"
|
|
||||||
>bug</a>: was eating tabs
|
|
||||||
(<a href="tests/prettify_test.html#issue8">test</a>)
|
|
||||||
<li>Fixed entity handling so that the caveat
|
|
||||||
<blockquote>
|
|
||||||
<p>Caveats: please properly escape less-thans. <tt>x&lt;y</tt>
|
|
||||||
instead of <tt>x<y</tt>, and use <tt>"</tt> instead of
|
|
||||||
<tt>&quot;</tt> for string delimiters.</p>
|
|
||||||
</blockquote>
|
|
||||||
is no longer applicable.
|
|
||||||
<li>Added noisefree's C#
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=4"
|
|
||||||
>patch</a>
|
|
||||||
<li>Added a <a href="http://google-code-prettify.googlecode.com/files/prettify-small.zip">distribution</a> that has comments and
|
|
||||||
whitespace removed to reduce download size from 45.5kB to 12.8kB.
|
|
||||||
</ul>
|
|
||||||
<h2>4 Jul 2008</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Added <a href="http://code.google.com/p/google-code-prettify/issues/detail?id=17">language specific formatters</a> that are triggered by the presence
|
|
||||||
of a <code>lang-<language-file-extension></code></li>
|
|
||||||
<li>Fixed <a href="http://code.google.com/p/google-code-prettify/issues/detail?id=29">bug</a>: python handling of <code>'''string'''</code>
|
|
||||||
<li>Fixed bug: <code>/</code> in regex <code>[charsets] should not end regex</code>
|
|
||||||
</ul>
|
|
||||||
<h2>5 Jul 2008</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Defined language extensions for Lisp and Lua</code>
|
|
||||||
</ul>
|
|
||||||
<h2>14 Jul 2008</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Language handlers for F#, OCAML, SQL</code>
|
|
||||||
<li>Support for <code>nocode</code> spans to allow embedding of line
|
|
||||||
numbers and code annotations which should not be styled or otherwise
|
|
||||||
affect the tokenization of prettified code.
|
|
||||||
See the issue 22
|
|
||||||
<a href="tests/prettify_test.html#issue22">testcase</a>.</code>
|
|
||||||
</ul>
|
|
||||||
<h2>6 Jan 2009</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Language handlers for Visual Basic, Haskell, CSS, and WikiText</li>
|
|
||||||
<li>Added <tt>.mxml</tt> extension to the markup style handler for
|
|
||||||
Flex <a href="http://en.wikipedia.org/wiki/MXML">MXML files</a>. See
|
|
||||||
<a
|
|
||||||
href="http://code.google.com/p/google-code-prettify/issues/detail?id=37"
|
|
||||||
>issue 37</a>.
|
|
||||||
<li>Added <tt>.m</tt> extension to the C style handler so that Objective
|
|
||||||
C source files properly highlight. See
|
|
||||||
<a
|
|
||||||
href="http://code.google.com/p/google-code-prettify/issues/detail?id=58"
|
|
||||||
>issue 58</a>.
|
|
||||||
<li>Changed HTML lexer to use the same embedded source mechanism as the
|
|
||||||
wiki language handler, and changed to use the registered
|
|
||||||
CSS handler for STYLE element content.
|
|
||||||
</ul>
|
|
||||||
<h2>21 May 2009</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Rewrote to improve performance on large files.
|
|
||||||
See <a href="http://mikesamuel.blogspot.com/2009/05/efficient-parsing-in-javascript.html">benchmarks</a>.</li>
|
|
||||||
<li>Fixed bugs with highlighting of Haskell line comments, Lisp
|
|
||||||
number literals, Lua strings, C preprocessor directives,
|
|
||||||
newlines in Wiki code on Windows, and newlines in IE6.</li>
|
|
||||||
</ul>
|
|
||||||
<h2>14 August 2009</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Fixed prettifying of <code><code></code> blocks with embedded newlines.
|
|
||||||
</ul>
|
|
||||||
<h2>3 October 2009</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Fixed prettifying of XML/HTML tags that contain uppercase letters.
|
|
||||||
</ul>
|
|
||||||
<h2>19 July 2010</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Added support for line numbers. Bug
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=22"
|
|
||||||
>22</a></li>
|
|
||||||
<li>Added YAML support. Bug
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=123"
|
|
||||||
>123</a></li>
|
|
||||||
<li>Added VHDL support courtesy Le Poussin.</li>
|
|
||||||
<li>IE performance improvements. Bug
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=102"
|
|
||||||
>102</a> courtesy jacobly.</li>
|
|
||||||
<li>A variety of markup formatting fixes courtesy smain and thezbyg.</li>
|
|
||||||
<li>Fixed copy and paste in IE[678].
|
|
||||||
<li>Changed output to use <code>&#160;</code> instead of
|
|
||||||
<code>&nbsp;</code> so that the output works when embedded in XML.
|
|
||||||
Bug
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=108"
|
|
||||||
>108</a>.</li>
|
|
||||||
</ul>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,203 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Javascript code prettifier</title>
|
|
||||||
|
|
||||||
<link href="src/prettify.css" type="text/css" rel="stylesheet" />
|
|
||||||
|
|
||||||
<script src="src/prettify.js" type="text/javascript"></script>
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
body { margin-left: .5in }
|
|
||||||
h1, h2, h3, h4, .footer { margin-left: -.4in; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body onload="prettyPrint()" bgcolor="white">
|
|
||||||
<small style="float: right">Languages : <a href="README-zh-Hans.html">CH</a></small>
|
|
||||||
<h1>Javascript code prettifier</h1>
|
|
||||||
|
|
||||||
<h2>Setup</h2>
|
|
||||||
<ol>
|
|
||||||
<li><a href="http://code.google.com/p/google-code-prettify/downloads/list">Download</a> a distribution
|
|
||||||
<li>Include the script and stylesheets in your document
|
|
||||||
(you will need to make sure the css and js file are on your server, and
|
|
||||||
adjust the paths in the <tt>script</tt> and <tt>link</tt> tag)
|
|
||||||
<pre class="prettyprint">
|
|
||||||
<link href="prettify.css" type="text/css" rel="stylesheet" />
|
|
||||||
<script type="text/javascript" src="prettify.js"></script></pre>
|
|
||||||
<li>Add <code class="prettyprint lang-html">onload="prettyPrint()"</code> to your
|
|
||||||
document's body tag.
|
|
||||||
<li>Modify the stylesheet to get the coloring you prefer</li>
|
|
||||||
</ol>
|
|
||||||
|
|
||||||
<h2>Usage</h2>
|
|
||||||
<p>Put code snippets in
|
|
||||||
<tt><pre class="prettyprint">...</pre></tt>
|
|
||||||
or <tt><code class="prettyprint">...</code></tt>
|
|
||||||
and it will automatically be pretty printed.
|
|
||||||
|
|
||||||
<table summary="code examples">
|
|
||||||
<tr>
|
|
||||||
<th>The original
|
|
||||||
<th>Prettier
|
|
||||||
<tr>
|
|
||||||
<td><pre style="border: 1px solid #888;padding: 2px"
|
|
||||||
><a name="voila1"></a>class Voila {
|
|
||||||
public:
|
|
||||||
// Voila
|
|
||||||
static const string VOILA = "Voila";
|
|
||||||
|
|
||||||
// will not interfere with embedded <a href="#voila1">tags</a>.
|
|
||||||
}</pre>
|
|
||||||
|
|
||||||
<td><pre class="prettyprint"><a name="voila2"></a>class Voila {
|
|
||||||
public:
|
|
||||||
// Voila
|
|
||||||
static const string VOILA = "Voila";
|
|
||||||
|
|
||||||
// will not interfere with embedded <a href="#voila2">tags</a>.
|
|
||||||
}</pre>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2>FAQ</h2>
|
|
||||||
<h3 id="langs">Which languages does it work for?</h3>
|
|
||||||
<p>The comments in <tt>prettify.js</tt> are authoritative but the lexer
|
|
||||||
should work on a number of languages including C and friends,
|
|
||||||
Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles.
|
|
||||||
It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl
|
|
||||||
and Ruby, but, because of commenting conventions, doesn't work on
|
|
||||||
Smalltalk, or CAML-like languages.</p>
|
|
||||||
|
|
||||||
<p>LISPy languages are supported via an extension:
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lisp.js"
|
|
||||||
><code>lang-lisp.js</code></a>.</p>
|
|
||||||
<p>And similarly for
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-css.js"
|
|
||||||
><code>CSS</code></a>,
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-hs.js"
|
|
||||||
><code>Haskell</code></a>,
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lua.js"
|
|
||||||
><code>Lua</code></a>,
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-ml.js"
|
|
||||||
><code>OCAML, SML, F#</code></a>,
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-vb.js"
|
|
||||||
><code>Visual Basic</code></a>,
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-sql.js"
|
|
||||||
><code>SQL</code></a>,
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-proto.js"
|
|
||||||
><code>Protocol Buffers</code></a>, and
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-wiki.js"
|
|
||||||
><code>WikiText</code></a>..
|
|
||||||
|
|
||||||
<p>If you'd like to add an extension for your favorite language, please
|
|
||||||
look at <tt>src/lang-lisp.js</tt> and file an
|
|
||||||
<a href="http://code.google.com/p/google-code-prettify/issues/list"
|
|
||||||
>issue</a> including your language extension, and a testcase.</p>
|
|
||||||
|
|
||||||
<h3>How do I specify which language my code is in?</h3>
|
|
||||||
<p>You don't need to specify the language since <code>prettyprint()</code>
|
|
||||||
will guess. You can specify a language by specifying the language extension
|
|
||||||
along with the <code>prettyprint</code> class like so:</p>
|
|
||||||
<pre class="prettyprint lang-html"
|
|
||||||
><pre class="prettyprint <b>lang-html</b>">
|
|
||||||
The lang-* class specifies the language file extensions.
|
|
||||||
File extensions supported by default include
|
|
||||||
"bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
|
|
||||||
"java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
|
|
||||||
"xhtml", "xml", "xsl".
|
|
||||||
</pre></pre>
|
|
||||||
|
|
||||||
<h3>It doesn't work on <tt><obfuscated code sample></tt>?</h3>
|
|
||||||
<p>Yes. Prettifying obfuscated code is like putting lipstick on a pig
|
|
||||||
— i.e. outside the scope of this tool.</p>
|
|
||||||
|
|
||||||
<h3>Which browsers does it work with?</h3>
|
|
||||||
<p>It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4.
|
|
||||||
Look at <a href="tests/prettify_test.html">the test page</a> to see if it
|
|
||||||
works in your browser.</p>
|
|
||||||
|
|
||||||
<h3>What's changed?</h3>
|
|
||||||
<p>See the <a href="CHANGES.html">change log</a></p>
|
|
||||||
|
|
||||||
<h3>Why doesn't Prettyprinting of strings work on WordPress?</h3>
|
|
||||||
<p>Apparently wordpress does "smart quoting" which changes close quotes.
|
|
||||||
This causes end quotes to not match up with open quotes.
|
|
||||||
<p>This breaks prettifying as well as copying and pasting of code samples.
|
|
||||||
See
|
|
||||||
<a href="http://wordpress.org/support/topic/125038"
|
|
||||||
>WordPress's help center</a> for info on how to stop smart quoting of code
|
|
||||||
snippets.</p>
|
|
||||||
|
|
||||||
<h3 id="linenums">How do I put line numbers in my code?</h3>
|
|
||||||
<p>You can use the <code>linenums</code> class to turn on line
|
|
||||||
numbering. If your code doesn't start at line number 1, you can
|
|
||||||
add a colon and a line number to the end of that class as in
|
|
||||||
<code>linenums:52</code>.
|
|
||||||
|
|
||||||
<p>For example
|
|
||||||
<pre class="prettyprint"><pre class="prettyprint linenums:<b>4</b>"
|
|
||||||
>// This is line 4.
|
|
||||||
foo();
|
|
||||||
bar();
|
|
||||||
baz();
|
|
||||||
boo();
|
|
||||||
far();
|
|
||||||
faz();
|
|
||||||
<pre></pre>
|
|
||||||
produces
|
|
||||||
<pre class="prettyprint linenums:4"
|
|
||||||
>// This is line 4.
|
|
||||||
foo();
|
|
||||||
bar();
|
|
||||||
baz();
|
|
||||||
boo();
|
|
||||||
far();
|
|
||||||
faz();
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h3>How do I prevent a portion of markup from being marked as code?</h3>
|
|
||||||
<p>You can use the <code>nocode</code> class to identify a span of markup
|
|
||||||
that is not code.
|
|
||||||
<pre class="prettyprint"><pre class=prettyprint>
|
|
||||||
int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
|
|
||||||
Continuation of comment */
|
|
||||||
int y = bar();
|
|
||||||
</pre></pre>
|
|
||||||
produces
|
|
||||||
<pre class="prettyprint">
|
|
||||||
int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
|
|
||||||
Continuation of comment */
|
|
||||||
int y = bar();
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<p>For a more complete example see the issue22
|
|
||||||
<a href="tests/prettify_test.html#issue22">testcase</a>.</p>
|
|
||||||
|
|
||||||
<h3>I get an error message "a is not a function" or "opt_whenDone is not a function"</h3>
|
|
||||||
<p>If you are calling <code>prettyPrint</code> via an event handler, wrap it in a function.
|
|
||||||
Instead of doing
|
|
||||||
<blockquote>
|
|
||||||
<code class="prettyprint lang-js"
|
|
||||||
>addEventListener('load', prettyPrint, false);</code>
|
|
||||||
</blockquote>
|
|
||||||
wrap it in a closure like
|
|
||||||
<blockquote>
|
|
||||||
<code class="prettyprint lang-js"
|
|
||||||
>addEventListener('load', function (event) { prettyPrint() }, false);</code>
|
|
||||||
</blockquote>
|
|
||||||
so that the browser does not pass an event object to <code>prettyPrint</code> which
|
|
||||||
will confuse it.
|
|
||||||
|
|
||||||
<br><br><br>
|
|
||||||
|
|
||||||
<div class="footer">
|
|
||||||
<!-- Created: Tue Oct 3 17:51:56 PDT 2006 -->
|
|
||||||
<!-- hhmts start -->
|
|
||||||
Last modified: Wed Jul 19 13:56:00 PST 2010
|
|
||||||
<!-- hhmts end -->
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,364 +0,0 @@
|
|||||||
{
|
|
||||||
"project": {
|
|
||||||
"name": "Phaser",
|
|
||||||
"description": "HTML5 Game Framework",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"url": "http://www.phaser.io/"
|
|
||||||
},
|
|
||||||
"files": {
|
|
||||||
"..\\Phaser\\time\\TimeManager.ts": {
|
|
||||||
"name": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"modules": {
|
|
||||||
"Phaser": 1
|
|
||||||
},
|
|
||||||
"classes": {
|
|
||||||
"TimeManager": 1
|
|
||||||
},
|
|
||||||
"fors": {},
|
|
||||||
"namespaces": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"modules": {
|
|
||||||
"Phaser": {
|
|
||||||
"name": "Phaser",
|
|
||||||
"submodules": {},
|
|
||||||
"classes": {
|
|
||||||
"TimeManager": 1
|
|
||||||
},
|
|
||||||
"fors": {},
|
|
||||||
"namespaces": {},
|
|
||||||
"tag": "module",
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 13,
|
|
||||||
"author": "Richard Davey <rich@photonstorm.com>",
|
|
||||||
"copyright": "2013 Photon Storm Ltd.",
|
|
||||||
"license": "https://github.com/photonstorm/phaser/blob/master/license.txt MIT License"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"classes": {
|
|
||||||
"TimeManager": {
|
|
||||||
"name": "TimeManager",
|
|
||||||
"shortname": "TimeManager",
|
|
||||||
"classitems": [],
|
|
||||||
"plugins": [],
|
|
||||||
"extensions": [],
|
|
||||||
"plugin_for": [],
|
|
||||||
"extension_for": [],
|
|
||||||
"module": "Phaser",
|
|
||||||
"namespace": "",
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 13,
|
|
||||||
"description": "This is the core internal game clock. It manages the elapsed time and calculation of delta values,\nused for game object motion and tweens.",
|
|
||||||
"is_constructor": 1,
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"name": "game",
|
|
||||||
"description": "A reference to the currently running game.",
|
|
||||||
"type": "Phaser.Game"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"classitems": [
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 34,
|
|
||||||
"description": "A reference to the currently running Game.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "game",
|
|
||||||
"type": "{Phaser.Game}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 41,
|
|
||||||
"description": "The time at which the Game instance started.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "_started",
|
|
||||||
"access": "private",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 49,
|
|
||||||
"description": "Number of milliseconds elapsed since the last frame update.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "elapsed",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 57,
|
|
||||||
"description": "Game time counter.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "time",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 65,
|
|
||||||
"description": "Records how long the game has been paused for. Is reset each time the game pauses.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "pausedTime",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 73,
|
|
||||||
"description": "The time right now.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "now",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 81,
|
|
||||||
"description": "Elapsed time since the last frame.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "delta",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 89,
|
|
||||||
"description": "The number of seconds that have elapsed since the game was started.",
|
|
||||||
"itemtype": "method",
|
|
||||||
"name": "totalElapsedSeconds",
|
|
||||||
"return": {
|
|
||||||
"description": "",
|
|
||||||
"type": "Number"
|
|
||||||
},
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 100,
|
|
||||||
"description": "Frames per second.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "fps",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 108,
|
|
||||||
"description": "The lowest rate the fps has dropped to.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "fpsMin",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 116,
|
|
||||||
"description": "The highest rate the fps has reached (usually no higher than 60fps).",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "fpsMax",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 124,
|
|
||||||
"description": "The minimum amount of time the game has taken between two frames.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "msMin",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 132,
|
|
||||||
"description": "The maximum amount of time the game has taken between two frames.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "msMax",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 140,
|
|
||||||
"description": "The number of frames record in the last second.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "frames",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 148,
|
|
||||||
"description": "The time (in ms) that the last second counter ticked over.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "_timeLastSecond",
|
|
||||||
"access": "private",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 156,
|
|
||||||
"description": "Update clock and calculate the fps.\nThis is called automatically by Game._raf",
|
|
||||||
"itemtype": "method",
|
|
||||||
"name": "update",
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"name": "raf",
|
|
||||||
"description": "The current timestamp, either performance.now or Date.now",
|
|
||||||
"type": "Number"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 192,
|
|
||||||
"description": "Called when the game enters a paused state.",
|
|
||||||
"itemtype": "method",
|
|
||||||
"name": "gamePaused",
|
|
||||||
"access": "private",
|
|
||||||
"tagname": "",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 201,
|
|
||||||
"description": "Called when the game resumes from a paused state.",
|
|
||||||
"itemtype": "method",
|
|
||||||
"name": "gameResumed",
|
|
||||||
"access": "private",
|
|
||||||
"tagname": "",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 211,
|
|
||||||
"description": "Records how long the game was paused for in miliseconds.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "pauseDuration",
|
|
||||||
"access": "public",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 219,
|
|
||||||
"description": "The time the game started being paused.",
|
|
||||||
"itemtype": "property",
|
|
||||||
"name": "_pauseStarted",
|
|
||||||
"access": "private",
|
|
||||||
"tagname": "",
|
|
||||||
"type": "{Number}",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 227,
|
|
||||||
"description": "How long has passed since the given time.",
|
|
||||||
"itemtype": "method",
|
|
||||||
"name": "elapsedSince",
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"name": "since",
|
|
||||||
"description": "The time you want to measure against.",
|
|
||||||
"type": "Number"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"return": {
|
|
||||||
"description": "The difference between the given time and now.",
|
|
||||||
"type": "Number"
|
|
||||||
},
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 239,
|
|
||||||
"description": "How long has passed since the given time (in seconds).",
|
|
||||||
"itemtype": "method",
|
|
||||||
"name": "elapsedSecondsSince",
|
|
||||||
"params": [
|
|
||||||
{
|
|
||||||
"name": "since",
|
|
||||||
"description": "The time you want to measure (in seconds).",
|
|
||||||
"type": "Number"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"return": {
|
|
||||||
"description": "Duration between given time and now (in seconds).",
|
|
||||||
"type": "Number"
|
|
||||||
},
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "..\\Phaser\\time\\TimeManager.ts",
|
|
||||||
"line": 251,
|
|
||||||
"description": "Resets the private _started value to now.",
|
|
||||||
"itemtype": "method",
|
|
||||||
"name": "reset",
|
|
||||||
"class": "TimeManager",
|
|
||||||
"module": "Phaser"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"warnings": [
|
|
||||||
{
|
|
||||||
"message": "unknown tag: copyright",
|
|
||||||
"line": " ..\\Phaser\\time\\TimeManager.ts:3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"message": "unknown tag: license",
|
|
||||||
"line": " ..\\Phaser\\time\\TimeManager.ts:3"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,372 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>..\Phaser\time\TimeManager.ts - Phaser</title>
|
|
||||||
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
|
|
||||||
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
|
|
||||||
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
|
|
||||||
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
|
|
||||||
</head>
|
|
||||||
<body class="yui3-skin-sam">
|
|
||||||
|
|
||||||
<div id="doc">
|
|
||||||
<div id="hd" class="yui3-g header">
|
|
||||||
<div class="yui3-u-3-4">
|
|
||||||
|
|
||||||
<h1><img src="../assets/css/logo.png" title="Phaser"></h1>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="yui3-u-1-4 version">
|
|
||||||
<em>API Docs for: 1.0.0</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="bd" class="yui3-g">
|
|
||||||
|
|
||||||
<div class="yui3-u-1-4">
|
|
||||||
<div id="docs-sidebar" class="sidebar apidocs">
|
|
||||||
<div id="api-list">
|
|
||||||
<h2 class="off-left">APIs</h2>
|
|
||||||
<div id="api-tabview" class="tabview">
|
|
||||||
<ul class="tabs">
|
|
||||||
<li><a href="#api-classes">Classes</a></li>
|
|
||||||
<li><a href="#api-modules">Modules</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div id="api-tabview-filter">
|
|
||||||
<input type="search" id="api-filter" placeholder="Type to filter APIs">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="api-tabview-panel">
|
|
||||||
<ul id="api-classes" class="apis classes">
|
|
||||||
|
|
||||||
<li><a href="../classes/TimeManager.html">TimeManager</a></li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<ul id="api-modules" class="apis modules">
|
|
||||||
|
|
||||||
<li><a href="../modules/Phaser.html">Phaser</a></li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="yui3-u-3-4">
|
|
||||||
<div id="api-options">
|
|
||||||
Show:
|
|
||||||
<label for="api-show-inherited">
|
|
||||||
<input type="checkbox" id="api-show-inherited" checked>
|
|
||||||
Inherited
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label for="api-show-protected">
|
|
||||||
<input type="checkbox" id="api-show-protected">
|
|
||||||
Protected
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label for="api-show-private">
|
|
||||||
<input type="checkbox" id="api-show-private">
|
|
||||||
Private
|
|
||||||
</label>
|
|
||||||
<label for="api-show-deprecated">
|
|
||||||
<input type="checkbox" id="api-show-deprecated">
|
|
||||||
Deprecated
|
|
||||||
</label>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="apidocs">
|
|
||||||
<div id="docs-main">
|
|
||||||
<div class="content">
|
|
||||||
<h1 class="file-heading">File: ..\Phaser\time\TimeManager.ts</h1>
|
|
||||||
|
|
||||||
<div class="file">
|
|
||||||
<pre class="code prettyprint linenums">
|
|
||||||
/// <reference path="../_definitions.ts" />
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Richard Davey <rich@photonstorm.com>
|
|
||||||
* @copyright 2013 Photon Storm Ltd.
|
|
||||||
* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
|
|
||||||
* @module Phaser
|
|
||||||
*/
|
|
||||||
module Phaser {
|
|
||||||
|
|
||||||
export class TimeManager {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the core internal game clock. It manages the elapsed time and calculation of delta values,
|
|
||||||
* used for game object motion and tweens.
|
|
||||||
*
|
|
||||||
* @class TimeManager
|
|
||||||
* @constructor
|
|
||||||
* @param {Phaser.Game} game A reference to the currently running game.
|
|
||||||
*/
|
|
||||||
constructor(game: Phaser.Game) {
|
|
||||||
|
|
||||||
this.game = game;
|
|
||||||
|
|
||||||
this._started = 0;
|
|
||||||
this._timeLastSecond = this._started;
|
|
||||||
this.time = this._started;
|
|
||||||
|
|
||||||
this.game.onPause.add(this.gamePaused, this);
|
|
||||||
this.game.onResume.add(this.gameResumed, this);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A reference to the currently running Game.
|
|
||||||
* @property game
|
|
||||||
* @type {Phaser.Game}
|
|
||||||
*/
|
|
||||||
public game: Phaser.Game;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The time at which the Game instance started.
|
|
||||||
* @property _started
|
|
||||||
* @private
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
private _started: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Number of milliseconds elapsed since the last frame update.
|
|
||||||
* @property elapsed
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public elapsed: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Game time counter.
|
|
||||||
* @property time
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public time: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Records how long the game has been paused for. Is reset each time the game pauses.
|
|
||||||
* @property pausedTime
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public pausedTime: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The time right now.
|
|
||||||
* @property now
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public now: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Elapsed time since the last frame.
|
|
||||||
* @property delta
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public delta: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of seconds that have elapsed since the game was started.
|
|
||||||
* @method totalElapsedSeconds
|
|
||||||
* @return {Number}
|
|
||||||
*/
|
|
||||||
public get totalElapsedSeconds(): number {
|
|
||||||
|
|
||||||
return (this.now - this._started) * 0.001;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Frames per second.
|
|
||||||
* @property fps
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public fps: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The lowest rate the fps has dropped to.
|
|
||||||
* @property fpsMin
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public fpsMin: number = 1000;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The highest rate the fps has reached (usually no higher than 60fps).
|
|
||||||
* @property fpsMax
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public fpsMax: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The minimum amount of time the game has taken between two frames.
|
|
||||||
* @property msMin
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public msMin: number = 1000;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The maximum amount of time the game has taken between two frames.
|
|
||||||
* @property msMax
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public msMax: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of frames record in the last second.
|
|
||||||
* @property frames
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public frames: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The time (in ms) that the last second counter ticked over.
|
|
||||||
* @property _timeLastSecond
|
|
||||||
* @private
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
private _timeLastSecond: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update clock and calculate the fps.
|
|
||||||
* This is called automatically by Game._raf
|
|
||||||
* @method update
|
|
||||||
* @param {Number} raf The current timestamp, either performance.now or Date.now
|
|
||||||
*/
|
|
||||||
public update(raf: number) {
|
|
||||||
|
|
||||||
this.now = raf; // mark
|
|
||||||
this.delta = this.now - this.time; // elapsedMS
|
|
||||||
|
|
||||||
this.msMin = Math.min(this.msMin, this.delta);
|
|
||||||
this.msMax = Math.max(this.msMax, this.delta);
|
|
||||||
|
|
||||||
this.frames++;
|
|
||||||
|
|
||||||
if (this.now > this._timeLastSecond + 1000)
|
|
||||||
{
|
|
||||||
this.fps = Math.round((this.frames * 1000) / (this.now - this._timeLastSecond));
|
|
||||||
this.fpsMin = Math.min(this.fpsMin, this.fps);
|
|
||||||
this.fpsMax = Math.max(this.fpsMax, this.fps);
|
|
||||||
|
|
||||||
this._timeLastSecond = this.now;
|
|
||||||
this.frames = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.time = this.now; // _total
|
|
||||||
|
|
||||||
// Paused?
|
|
||||||
if (this.game.paused)
|
|
||||||
{
|
|
||||||
this.pausedTime = this.now - this._pauseStarted;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the game enters a paused state.
|
|
||||||
* @method gamePaused
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
private gamePaused() {
|
|
||||||
this._pauseStarted = this.now;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the game resumes from a paused state.
|
|
||||||
* @method gameResumed
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
private gameResumed() {
|
|
||||||
// Level out the delta timer to avoid spikes
|
|
||||||
this.pauseDuration = this.pausedTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Records how long the game was paused for in miliseconds.
|
|
||||||
* @property pauseDuration
|
|
||||||
* @public
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
public pauseDuration: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The time the game started being paused.
|
|
||||||
* @property _pauseStarted
|
|
||||||
* @private
|
|
||||||
* @type {Number}
|
|
||||||
*/
|
|
||||||
private _pauseStarted: number = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How long has passed since the given time.
|
|
||||||
* @method elapsedSince
|
|
||||||
* @param {Number} since The time you want to measure against.
|
|
||||||
* @return {Number} The difference between the given time and now.
|
|
||||||
*/
|
|
||||||
public elapsedSince(since: number): number {
|
|
||||||
|
|
||||||
return this.now - since;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How long has passed since the given time (in seconds).
|
|
||||||
* @method elapsedSecondsSince
|
|
||||||
* @param {Number} since The time you want to measure (in seconds).
|
|
||||||
* @return {Number} Duration between given time and now (in seconds).
|
|
||||||
*/
|
|
||||||
public elapsedSecondsSince(since: number): number {
|
|
||||||
|
|
||||||
return (this.now - since) * 0.001;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets the private _started value to now.
|
|
||||||
* @method reset
|
|
||||||
*/
|
|
||||||
public reset() {
|
|
||||||
|
|
||||||
this._started = this.now;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="../assets/vendor/prettify/prettify-min.js"></script>
|
|
||||||
<script>prettyPrint();</script>
|
|
||||||
<script src="../assets/js/yui-prettify.js"></script>
|
|
||||||
<script src="../assets/../api.js"></script>
|
|
||||||
<script src="../assets/js/api-filter.js"></script>
|
|
||||||
<script src="../assets/js/api-list.js"></script>
|
|
||||||
<script src="../assets/js/api-search.js"></script>
|
|
||||||
<script src="../assets/js/apidocs.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Phaser</title>
|
|
||||||
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
|
|
||||||
<link rel="stylesheet" href="./assets/vendor/prettify/prettify-min.css">
|
|
||||||
<link rel="stylesheet" href="./assets/css/main.css" id="site_styles">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="./assets/favicon.png">
|
|
||||||
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
|
|
||||||
</head>
|
|
||||||
<body class="yui3-skin-sam">
|
|
||||||
|
|
||||||
<div id="doc">
|
|
||||||
<div id="hd" class="yui3-g header">
|
|
||||||
<div class="yui3-u-3-4">
|
|
||||||
|
|
||||||
<h1><img src="./assets/css/logo.png" title="Phaser"></h1>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="yui3-u-1-4 version">
|
|
||||||
<em>API Docs for: 1.0.0</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="bd" class="yui3-g">
|
|
||||||
|
|
||||||
<div class="yui3-u-1-4">
|
|
||||||
<div id="docs-sidebar" class="sidebar apidocs">
|
|
||||||
<div id="api-list">
|
|
||||||
<h2 class="off-left">APIs</h2>
|
|
||||||
<div id="api-tabview" class="tabview">
|
|
||||||
<ul class="tabs">
|
|
||||||
<li><a href="#api-classes">Classes</a></li>
|
|
||||||
<li><a href="#api-modules">Modules</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div id="api-tabview-filter">
|
|
||||||
<input type="search" id="api-filter" placeholder="Type to filter APIs">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="api-tabview-panel">
|
|
||||||
<ul id="api-classes" class="apis classes">
|
|
||||||
|
|
||||||
<li><a href="./classes/TimeManager.html">TimeManager</a></li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<ul id="api-modules" class="apis modules">
|
|
||||||
|
|
||||||
<li><a href="./modules/Phaser.html">Phaser</a></li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="yui3-u-3-4">
|
|
||||||
<div id="api-options">
|
|
||||||
Show:
|
|
||||||
<label for="api-show-inherited">
|
|
||||||
<input type="checkbox" id="api-show-inherited" checked>
|
|
||||||
Inherited
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label for="api-show-protected">
|
|
||||||
<input type="checkbox" id="api-show-protected">
|
|
||||||
Protected
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label for="api-show-private">
|
|
||||||
<input type="checkbox" id="api-show-private">
|
|
||||||
Private
|
|
||||||
</label>
|
|
||||||
<label for="api-show-deprecated">
|
|
||||||
<input type="checkbox" id="api-show-deprecated">
|
|
||||||
Deprecated
|
|
||||||
</label>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="apidocs">
|
|
||||||
<div id="docs-main">
|
|
||||||
<div class="content">
|
|
||||||
<div class="apidocs">
|
|
||||||
<div id="docs-main" class="content">
|
|
||||||
<p>
|
|
||||||
Browse to a module or class using the sidebar to view its API documentation.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h2>Keyboard Shortcuts</h2>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><p>Press <kbd>s</kbd> to focus the API search box.</p></li>
|
|
||||||
|
|
||||||
<li><p>Use <kbd>Up</kbd> and <kbd>Down</kbd> to select classes, modules, and search results.</p></li>
|
|
||||||
|
|
||||||
<li class="mac-only"><p>With the API search box or sidebar focused, use <kbd><span class="cmd">⌘</span>-Left</kbd> or <kbd><span class="cmd">⌘</span>-Right</kbd> to switch sidebar tabs.</p></li>
|
|
||||||
|
|
||||||
<li class="pc-only"><p>With the API search box or sidebar focused, use <kbd>Ctrl+Left</kbd> and <kbd>Ctrl+Right</kbd> to switch sidebar tabs.</p></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="./assets/vendor/prettify/prettify-min.js"></script>
|
|
||||||
<script>prettyPrint();</script>
|
|
||||||
<script src="./assets/js/yui-prettify.js"></script>
|
|
||||||
<script src="./assets/../api.js"></script>
|
|
||||||
<script src="./assets/js/api-filter.js"></script>
|
|
||||||
<script src="./assets/js/api-list.js"></script>
|
|
||||||
<script src="./assets/js/api-search.js"></script>
|
|
||||||
<script src="./assets/js/apidocs.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,147 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Phaser - Phaser</title>
|
|
||||||
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
|
|
||||||
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
|
|
||||||
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
|
|
||||||
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
|
|
||||||
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
|
|
||||||
</head>
|
|
||||||
<body class="yui3-skin-sam">
|
|
||||||
|
|
||||||
<div id="doc">
|
|
||||||
<div id="hd" class="yui3-g header">
|
|
||||||
<div class="yui3-u-3-4">
|
|
||||||
|
|
||||||
<h1><img src="../assets/css/logo.png" title="Phaser"></h1>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="yui3-u-1-4 version">
|
|
||||||
<em>API Docs for: 1.0.0</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="bd" class="yui3-g">
|
|
||||||
|
|
||||||
<div class="yui3-u-1-4">
|
|
||||||
<div id="docs-sidebar" class="sidebar apidocs">
|
|
||||||
<div id="api-list">
|
|
||||||
<h2 class="off-left">APIs</h2>
|
|
||||||
<div id="api-tabview" class="tabview">
|
|
||||||
<ul class="tabs">
|
|
||||||
<li><a href="#api-classes">Classes</a></li>
|
|
||||||
<li><a href="#api-modules">Modules</a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div id="api-tabview-filter">
|
|
||||||
<input type="search" id="api-filter" placeholder="Type to filter APIs">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="api-tabview-panel">
|
|
||||||
<ul id="api-classes" class="apis classes">
|
|
||||||
|
|
||||||
<li><a href="../classes/TimeManager.html">TimeManager</a></li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<ul id="api-modules" class="apis modules">
|
|
||||||
|
|
||||||
<li><a href="../modules/Phaser.html">Phaser</a></li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="yui3-u-3-4">
|
|
||||||
<div id="api-options">
|
|
||||||
Show:
|
|
||||||
<label for="api-show-inherited">
|
|
||||||
<input type="checkbox" id="api-show-inherited" checked>
|
|
||||||
Inherited
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label for="api-show-protected">
|
|
||||||
<input type="checkbox" id="api-show-protected">
|
|
||||||
Protected
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label for="api-show-private">
|
|
||||||
<input type="checkbox" id="api-show-private">
|
|
||||||
Private
|
|
||||||
</label>
|
|
||||||
<label for="api-show-deprecated">
|
|
||||||
<input type="checkbox" id="api-show-deprecated">
|
|
||||||
Deprecated
|
|
||||||
</label>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="apidocs">
|
|
||||||
<div id="docs-main">
|
|
||||||
<div class="content">
|
|
||||||
<h1>Phaser Module</h1>
|
|
||||||
<div class="box clearfix meta">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="foundat">
|
|
||||||
Defined in: <a href="../files/.._Phaser_time_TimeManager.ts.html#l13"><code>..\Phaser\time\TimeManager.ts:13</code></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="box intro">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="yui3-g">
|
|
||||||
<div class="yui3-u-1-2">
|
|
||||||
|
|
||||||
<p>This module provides the following classes:</p>
|
|
||||||
|
|
||||||
<ul class="module-classes">
|
|
||||||
|
|
||||||
<li class="module-class">
|
|
||||||
<a href="../classes/TimeManager.html">
|
|
||||||
TimeManager
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="yui3-u-1-2">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="../assets/vendor/prettify/prettify-min.js"></script>
|
|
||||||
<script>prettyPrint();</script>
|
|
||||||
<script src="../assets/js/yui-prettify.js"></script>
|
|
||||||
<script src="../assets/../api.js"></script>
|
|
||||||
<script src="../assets/js/api-filter.js"></script>
|
|
||||||
<script src="../assets/js/api-list.js"></script>
|
|
||||||
<script src="../assets/js/api-search.js"></script>
|
|
||||||
<script src="../assets/js/apidocs.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>phaser - hello world</title>
|
|
||||||
<script src="phaser-min.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
|
|
||||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
|
|
||||||
|
|
||||||
function preload() {
|
|
||||||
|
|
||||||
game.load.image('logo', 'logo.png');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var logo;
|
|
||||||
|
|
||||||
function create() {
|
|
||||||
|
|
||||||
logo = game.add.sprite(0, 0, 'logo');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function update() {
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 243 KiB |
|
Before Width: | Height: | Size: 210 KiB |
|
Before Width: | Height: | Size: 1021 KiB |
|
Before Width: | Height: | Size: 1010 KiB |
|
Before Width: | Height: | Size: 1022 KiB |
@@ -1 +0,0 @@
|
|||||||
yuidoc -c ../Phaser/yuidoc.json -o API/ -t yuidoc-theme-dana -e .ts ../Phaser/time
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
yuidoc -n -e .ts --server 3000 ../Phaser/time
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Richard Davey <rich@photonstorm.com>
|
|
||||||
* @copyright 2013 Photon Storm Ltd.
|
|
||||||
* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
|
|
||||||
* @module Phaser
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The class constructor
|
|
||||||
*
|
|
||||||
* @class Name
|
|
||||||
* @constructor
|
|
||||||
* @param {Phaser.Game} game A reference to the currently running game.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A reference to the currently running Game.
|
|
||||||
* @property game
|
|
||||||
* @type {Phaser.Game}
|
|
||||||
*/
|
|
||||||
public game: Phaser.Game;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* My method description. Like other pieces of your comment blocks,
|
|
||||||
* this can span multiple lines.
|
|
||||||
*
|
|
||||||
* @method methodName
|
|
||||||
* @param {String} foo Argument 1
|
|
||||||
* @param {Object} config A config object
|
|
||||||
* @param {String} config.name The name on the config object
|
|
||||||
* @param {Function} config.callback A callback function on the config object
|
|
||||||
* @param {Boolean} [extra=false] Do extra, optional work
|
|
||||||
* @return {Boolean} Returns true on success
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* My property description. Like other pieces of your comment blocks,
|
|
||||||
* this can span multiple lines.
|
|
||||||
*
|
|
||||||
* @property propertyName
|
|
||||||
* @public
|
|
||||||
* @type {Object}
|
|
||||||
* @default "foo"
|
|
||||||
*/
|
|
||||||
|
|
||||||
@param {Type} Name Description
|
|
||||||
Object, Array, String, Boolean, Number, Mixed, MyType
|
|
||||||
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
module.exports = function (grunt) {
|
|
||||||
grunt.loadNpmTasks('grunt-typescript');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
||||||
|
|
||||||
var wrapPhaserInUmd = function(content, isAddon) {
|
|
||||||
var replacement = [
|
|
||||||
'(function (root, factory) {',
|
|
||||||
' if (typeof exports === \'object\') {',
|
|
||||||
' module.exports = factory();',
|
|
||||||
' } else if (typeof define === \'function\' && define.amd) {',
|
|
||||||
' define(factory);',
|
|
||||||
' } else {',
|
|
||||||
' root.Phaser = factory();',
|
|
||||||
' }',
|
|
||||||
'}(this, function () {',
|
|
||||||
content,
|
|
||||||
'return Phaser;',
|
|
||||||
'}));'
|
|
||||||
];
|
|
||||||
return replacement.join('\n');
|
|
||||||
};
|
|
||||||
|
|
||||||
var wrapAddonInUmd = function(content) {
|
|
||||||
var replacement = [
|
|
||||||
'(function (root, factory) {',
|
|
||||||
' if (typeof exports === \'object\') {',
|
|
||||||
' module.exports = factory(require(\'phaser\'));',
|
|
||||||
' } else if (typeof define === \'function\' && define.amd) {',
|
|
||||||
' define([\'phaser\'], factory);',
|
|
||||||
' } else {',
|
|
||||||
' factory(root.Phaser);',
|
|
||||||
' }',
|
|
||||||
'}(this, function (Phaser) {',
|
|
||||||
content,
|
|
||||||
'return Phaser;',
|
|
||||||
'}));'
|
|
||||||
];
|
|
||||||
return replacement.join('\n');
|
|
||||||
};
|
|
||||||
|
|
||||||
grunt.initConfig({
|
|
||||||
pkg: grunt.file.readJSON('package.json'),
|
|
||||||
typescript: {
|
|
||||||
base: {
|
|
||||||
src: ['Phaser/**/*.ts'],
|
|
||||||
dest: 'build/phaser.js',
|
|
||||||
options: {
|
|
||||||
target: 'ES5',
|
|
||||||
declaration: true,
|
|
||||||
comments: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
copy: {
|
|
||||||
main: {
|
|
||||||
files: [{
|
|
||||||
src: 'build/phaser.js',
|
|
||||||
dest: 'Tests/phaser.js'
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
mainAmd: {
|
|
||||||
files: [{
|
|
||||||
src: 'build/phaser.js',
|
|
||||||
dest: 'build/phaser.amd.js'
|
|
||||||
}],
|
|
||||||
options: {
|
|
||||||
processContent: wrapPhaserInUmd
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
files: '**/*.ts',
|
|
||||||
tasks: ['typescript', 'copy']
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.registerTask('default', ['typescript', 'copy', 'watch']);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,334 @@
|
|||||||
|
module.exports = function (grunt) {
|
||||||
|
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||||
|
grunt.loadTasks('./tasks');
|
||||||
|
|
||||||
|
grunt.initConfig({
|
||||||
|
|
||||||
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
|
|
||||||
|
banner: '/**\n' +
|
||||||
|
'* @author Richard Davey <rich@photonstorm.com>\n' +
|
||||||
|
'* @copyright 2014 Photon Storm Ltd.\n' +
|
||||||
|
'* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}\n' +
|
||||||
|
'*\n' +
|
||||||
|
'* @overview\n' +
|
||||||
|
'*\n' +
|
||||||
|
'* Phaser - http://www.phaser.io\n' +
|
||||||
|
'*\n' +
|
||||||
|
'* v<%= pkg.version %> "<%= pkg.release %>" - Built: <%= grunt.template.today() %>\n' +
|
||||||
|
'*\n' +
|
||||||
|
'* By Richard Davey http://www.photonstorm.com @photonstorm\n' +
|
||||||
|
'*\n' +
|
||||||
|
'* Phaser is a fun, free and fast 2D game framework for making HTML5 games \n' +
|
||||||
|
'* for desktop and mobile web browsers, supporting Canvas and WebGL rendering.\n' +
|
||||||
|
'*\n' +
|
||||||
|
'* Phaser uses Pixi.js for rendering, created by Mat Groves http://matgroves.com @Doormat23\n' +
|
||||||
|
'* Phaser uses p2.js for physics, created by Stefan Hedman https://github.com/schteppe/p2.js @schteppe\n' +
|
||||||
|
'*\n' +
|
||||||
|
'* Many thanks to Adam Saltsman (@ADAMATOMIC) for releasing Flixel, from which both Phaser\n' +
|
||||||
|
'* and my love of framework development originate.\n' +
|
||||||
|
'*\n' +
|
||||||
|
'* Follow Phaser development progress at http://phaser.io\n' +
|
||||||
|
'*\n' +
|
||||||
|
'* "If you want your children to be intelligent, read them fairy tales."\n' +
|
||||||
|
'* "If you want them to be more intelligent, read them more fairy tales."\n' +
|
||||||
|
'* -- Albert Einstein\n' +
|
||||||
|
'*/\n',
|
||||||
|
|
||||||
|
release_dir: 'build',
|
||||||
|
compile_dir: 'dist',
|
||||||
|
|
||||||
|
p2: [
|
||||||
|
'src/p2.js'
|
||||||
|
],
|
||||||
|
|
||||||
|
pixi: [
|
||||||
|
'src/pixi/Intro.js',
|
||||||
|
'src/pixi/Pixi.js',
|
||||||
|
'src/pixi/core/Point.js',
|
||||||
|
'src/pixi/core/Rectangle.js',
|
||||||
|
'src/pixi/core/Polygon.js',
|
||||||
|
'src/pixi/core/Circle.js',
|
||||||
|
'src/pixi/core/Ellipse.js',
|
||||||
|
'src/pixi/core/Matrix.js',
|
||||||
|
'src/pixi/display/DisplayObject.js',
|
||||||
|
'src/pixi/display/DisplayObjectContainer.js',
|
||||||
|
'src/pixi/display/Sprite.js',
|
||||||
|
'src/pixi/display/SpriteBatch.js',
|
||||||
|
'src/pixi/filters/FilterBlock.js',
|
||||||
|
'src/pixi/text/Text.js',
|
||||||
|
'src/pixi/text/BitmapText.js',
|
||||||
|
'src/pixi/display/Stage.js',
|
||||||
|
'src/pixi/utils/Utils.js',
|
||||||
|
'src/pixi/utils/EventTarget.js',
|
||||||
|
'src/pixi/utils/Polyk.js',
|
||||||
|
'src/pixi/renderers/webgl/utils/WebGLShaderUtils.js',
|
||||||
|
'src/pixi/renderers/webgl/shaders/PixiShader.js',
|
||||||
|
'src/pixi/renderers/webgl/shaders/PixiFastShader.js',
|
||||||
|
'src/pixi/renderers/webgl/shaders/StripShader.js',
|
||||||
|
'src/pixi/renderers/webgl/shaders/PrimitiveShader.js',
|
||||||
|
'src/pixi/renderers/webgl/utils/WebGLGraphics.js',
|
||||||
|
'src/pixi/renderers/webgl/WebGLRenderer.js',
|
||||||
|
'src/pixi/renderers/webgl/utils/WebGLMaskManager.js',
|
||||||
|
'src/pixi/renderers/webgl/utils/WebGLShaderManager.js',
|
||||||
|
'src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js',
|
||||||
|
'src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js',
|
||||||
|
'src/pixi/renderers/webgl/utils/WebGLFilterManager.js',
|
||||||
|
'src/pixi/renderers/webgl/utils/FilterTexture.js',
|
||||||
|
'src/pixi/renderers/canvas/utils/CanvasMaskManager.js',
|
||||||
|
'src/pixi/renderers/canvas/utils/CanvasTinter.js',
|
||||||
|
'src/pixi/renderers/canvas/CanvasRenderer.js',
|
||||||
|
'src/pixi/renderers/canvas/CanvasGraphics.js',
|
||||||
|
'src/pixi/primitives/Graphics.js',
|
||||||
|
'src/pixi/extras/TilingSprite.js',
|
||||||
|
'src/pixi/textures/BaseTexture.js',
|
||||||
|
'src/pixi/textures/Texture.js',
|
||||||
|
'src/pixi/textures/RenderTexture.js',
|
||||||
|
'src/pixi/Outro.js',
|
||||||
|
],
|
||||||
|
|
||||||
|
phaser: [
|
||||||
|
'src/Intro.js',
|
||||||
|
'src/Phaser.js',
|
||||||
|
'src/utils/Utils.js',
|
||||||
|
|
||||||
|
'src/geom/Circle.js',
|
||||||
|
'src/geom/Point.js',
|
||||||
|
'src/geom/Rectangle.js',
|
||||||
|
'src/geom/Line.js',
|
||||||
|
'src/geom/Ellipse.js',
|
||||||
|
'src/geom/Polygon.js',
|
||||||
|
|
||||||
|
'src/core/Camera.js',
|
||||||
|
'src/core/State.js',
|
||||||
|
'src/core/StateManager.js',
|
||||||
|
'src/core/LinkedList.js',
|
||||||
|
'src/core/Signal.js',
|
||||||
|
'src/core/SignalBinding.js',
|
||||||
|
'src/core/Filter.js',
|
||||||
|
'src/core/Plugin.js',
|
||||||
|
'src/core/PluginManager.js',
|
||||||
|
'src/core/Stage.js',
|
||||||
|
'src/core/Group.js',
|
||||||
|
'src/core/World.js',
|
||||||
|
'src/core/ScaleManager.js',
|
||||||
|
'src/core/Game.js',
|
||||||
|
|
||||||
|
'src/input/Input.js',
|
||||||
|
'src/input/Key.js',
|
||||||
|
'src/input/Keyboard.js',
|
||||||
|
'src/input/Mouse.js',
|
||||||
|
'src/input/MSPointer.js',
|
||||||
|
'src/input/Pointer.js',
|
||||||
|
'src/input/Touch.js',
|
||||||
|
'src/input/Gamepad.js',
|
||||||
|
'src/input/SinglePad.js',
|
||||||
|
'src/input/GamepadButton.js',
|
||||||
|
'src/input/InputHandler.js',
|
||||||
|
'src/input/Gestures.js',
|
||||||
|
|
||||||
|
'src/gameobjects/Events.js',
|
||||||
|
'src/gameobjects/GameObjectFactory.js',
|
||||||
|
'src/gameobjects/GameObjectCreator.js',
|
||||||
|
'src/gameobjects/BitmapData.js',
|
||||||
|
'src/gameobjects/Sprite.js',
|
||||||
|
'src/gameobjects/Image.js',
|
||||||
|
'src/gameobjects/TileSprite.js',
|
||||||
|
'src/gameobjects/Text.js',
|
||||||
|
'src/gameobjects/BitmapText.js',
|
||||||
|
'src/gameobjects/Button.js',
|
||||||
|
'src/gameobjects/Graphics.js',
|
||||||
|
'src/gameobjects/RenderTexture.js',
|
||||||
|
'src/gameobjects/SpriteBatch.js',
|
||||||
|
'src/gameobjects/RetroFont.js',
|
||||||
|
|
||||||
|
'src/system/Canvas.js',
|
||||||
|
'src/system/Device.js',
|
||||||
|
'src/system/RequestAnimationFrame.js',
|
||||||
|
|
||||||
|
'src/math/Math.js',
|
||||||
|
'src/math/RandomDataGenerator.js',
|
||||||
|
|
||||||
|
'src/net/Net.js',
|
||||||
|
|
||||||
|
'src/tween/TweenManager.js',
|
||||||
|
'src/tween/Tween.js',
|
||||||
|
'src/tween/Easing.js',
|
||||||
|
|
||||||
|
'src/time/Time.js',
|
||||||
|
'src/time/Timer.js',
|
||||||
|
'src/time/TimerEvent.js',
|
||||||
|
|
||||||
|
'src/animation/AnimationManager.js',
|
||||||
|
'src/animation/Animation.js',
|
||||||
|
'src/animation/Frame.js',
|
||||||
|
'src/animation/FrameData.js',
|
||||||
|
'src/animation/AnimationParser.js',
|
||||||
|
|
||||||
|
'src/loader/Cache.js',
|
||||||
|
'src/loader/Loader.js',
|
||||||
|
'src/loader/LoaderParser.js',
|
||||||
|
|
||||||
|
'src/sound/Sound.js',
|
||||||
|
'src/sound/SoundManager.js',
|
||||||
|
|
||||||
|
'src/utils/Debug.js',
|
||||||
|
'src/utils/Color.js',
|
||||||
|
|
||||||
|
'src/physics/Physics.js',
|
||||||
|
|
||||||
|
'src/physics/arcade/World.js',
|
||||||
|
'src/physics/arcade/Body.js',
|
||||||
|
'src/physics/arcade/QuadTree.js',
|
||||||
|
|
||||||
|
'src/physics/ninja/World.js',
|
||||||
|
'src/physics/ninja/Body.js',
|
||||||
|
'src/physics/ninja/AABB.js',
|
||||||
|
'src/physics/ninja/Tile.js',
|
||||||
|
'src/physics/ninja/Circle.js',
|
||||||
|
|
||||||
|
'src/physics/p2/World.js',
|
||||||
|
'src/physics/p2/PointProxy.js',
|
||||||
|
'src/physics/p2/InversePointProxy.js',
|
||||||
|
'src/physics/p2/Body.js',
|
||||||
|
'src/physics/p2/Spring.js',
|
||||||
|
'src/physics/p2/Material.js',
|
||||||
|
'src/physics/p2/ContactMaterial.js',
|
||||||
|
'src/physics/p2/CollisionGroup.js',
|
||||||
|
|
||||||
|
'src/particles/Particles.js',
|
||||||
|
'src/particles/arcade/ArcadeParticles.js',
|
||||||
|
'src/particles/arcade/Emitter.js',
|
||||||
|
|
||||||
|
'src/tilemap/Tile.js',
|
||||||
|
'src/tilemap/Tilemap.js',
|
||||||
|
'src/tilemap/TilemapLayer.js',
|
||||||
|
'src/tilemap/TilemapParser.js',
|
||||||
|
'src/tilemap/Tileset.js',
|
||||||
|
|
||||||
|
'src/Outro.js'
|
||||||
|
],
|
||||||
|
|
||||||
|
clean: ['<%= compile_dir %>'],
|
||||||
|
|
||||||
|
concat: {
|
||||||
|
|
||||||
|
// Our custom version of p2
|
||||||
|
p2: {
|
||||||
|
src: ['<%= p2 %>'],
|
||||||
|
dest: '<%= compile_dir %>/p2.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Our custom version of Pixi
|
||||||
|
pixi: {
|
||||||
|
src: ['<%= pixi %>'],
|
||||||
|
dest: '<%= compile_dir %>/pixi.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Phaser, stand-alone (no bundled libs)
|
||||||
|
phaser: {
|
||||||
|
options: {
|
||||||
|
banner: '<%= banner %>'
|
||||||
|
},
|
||||||
|
src: ['<%= phaser %>'],
|
||||||
|
dest: '<%= compile_dir %>/phaser-no-libs.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
// One ring to rule them all
|
||||||
|
standalone: {
|
||||||
|
options: {
|
||||||
|
banner: '<%= banner %>'
|
||||||
|
},
|
||||||
|
src: ['<%= compile_dir %>/p2.js', '<%= compile_dir %>/pixi.js', '<%= compile_dir %>/phaser-no-libs.js'],
|
||||||
|
dest: '<%= compile_dir %>/phaser.js'
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
uglify: {
|
||||||
|
|
||||||
|
p2: {
|
||||||
|
options: {
|
||||||
|
banner: '/* p2.js custom build for Phaser v<%= pkg.version %> - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */\n'
|
||||||
|
},
|
||||||
|
src: ['<%= concat.p2.dest %>'],
|
||||||
|
dest: '<%= compile_dir %>/p2.min.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
pixi: {
|
||||||
|
options: {
|
||||||
|
banner: '/* Pixi.js custom build for Phaser v<%= pkg.version %> - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */\n'
|
||||||
|
},
|
||||||
|
src: ['<%= concat.pixi.dest %>'],
|
||||||
|
dest: '<%= compile_dir %>/pixi.min.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
phaser: {
|
||||||
|
options: {
|
||||||
|
banner: '/* Phaser (no libs) v<%= pkg.version %> - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */\n'
|
||||||
|
},
|
||||||
|
src: ['<%= concat.phaser.dest %>'],
|
||||||
|
dest: '<%= compile_dir %>/phaser-no-libs.min.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
standalone: {
|
||||||
|
options: {
|
||||||
|
sourceMap: true,
|
||||||
|
sourceMapName: '<%= compile_dir %>/phaser.map',
|
||||||
|
banner: '/* Phaser v<%= pkg.version %> - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */\n'
|
||||||
|
},
|
||||||
|
src: ['<%= concat.standalone.dest %>'],
|
||||||
|
dest: '<%= compile_dir %>/phaser.min.js'
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
copy: {
|
||||||
|
main: {
|
||||||
|
files: [
|
||||||
|
{ src: ['dist/phaser.js'], dest: 'build/phaser.js' },
|
||||||
|
{ src: ['dist/phaser.min.js'], dest: 'build/phaser.min.js' },
|
||||||
|
{ src: ['dist/phaser.map'], dest: 'build/phaser.map' },
|
||||||
|
|
||||||
|
{ src: ['dist/p2.js'], dest: 'build/custom/p2.js' },
|
||||||
|
{ src: ['dist/p2.min.js'], dest: 'build/custom/p2.min.js' },
|
||||||
|
{ src: ['dist/phaser-no-libs.js'], dest: 'build/custom/phaser-no-libs.js' },
|
||||||
|
{ src: ['dist/phaser-no-libs.min.js'], dest: 'build/custom/phaser-no-libs.min.js' },
|
||||||
|
{ src: ['dist/pixi.js'], dest: 'build/custom/pixi.js' },
|
||||||
|
{ src: ['dist/pixi.min.js'], dest: 'build/custom/pixi.min.js' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
examples: {
|
||||||
|
all: {
|
||||||
|
options: {
|
||||||
|
base: 'examples',
|
||||||
|
excludes: ['_site', 'assets', 'states', 'wip']
|
||||||
|
},
|
||||||
|
src: ['examples/**/*.js'],
|
||||||
|
dest: 'examples/_site/examples.json'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
connect: {
|
||||||
|
root: {
|
||||||
|
options: {
|
||||||
|
keepalive: true,
|
||||||
|
hostname: '*'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.registerTask('default', ['build', 'examples']);
|
||||||
|
grunt.registerTask('build', ['clean', 'concat', 'uglify']);
|
||||||
|
grunt.registerTask('dist', ['clean', 'concat', 'uglify', 'copy']);
|
||||||
|
|
||||||
|
};
|
||||||
@@ -1,62 +1,318 @@
|
|||||||

|

|
||||||
|
|
||||||
Phaser 1.0
|
Phaser 2.0.0-dev
|
||||||
==========
|
================
|
||||||
|
|
||||||
Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It supports Canvas and WebGL rendering.
|
Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It uses [Pixi.js](https://github.com/GoodBoyDigital/pixi.js/) internally for fast 2D Canvas and WebGL rendering.
|
||||||
|
|
||||||
Version: 1.0.1 - Released: September 15th 2013
|
Version: 2.0.0 "Aes Sedai" - Released: -in development-
|
||||||
|
|
||||||
By Richard Davey, [Photon Storm](http://www.photonstorm.com)
|
By Richard Davey, [Photon Storm](http://www.photonstorm.com)
|
||||||
|
|
||||||
View the [Official Website](http://phaser.io)<br />
|
* View the [Official Website](http://phaser.io)
|
||||||
Follow on [Twitter](https://twitter.com/photonstorm)<br />
|
* Follow on [Twitter](https://twitter.com/photonstorm)
|
||||||
Read the [Development Blog](http://www.photonstorm.com)<br />
|
* Join the [Forum](http://www.html5gamedevs.com/forum/14-phaser/)
|
||||||
Join the [Forum](http://www.html5gamedevs.com/forum/14-phaser/)
|
* Try out 220+ [Phaser Examples](http://examples.phaser.io)
|
||||||
Try out the [Phaser Test Suite](http://gametest.mobi/phaser/)
|
* Read the [documentation online](http://docs.phaser.io)
|
||||||
|
* Join our [#phaserio IRC channel](http://www.html5gamedevs.com/topic/4470-official-phaserio-irc-channel-phaserio-on-freenode/) on freenode
|
||||||
|
|
||||||
"Being negative is not how we make progress" - Larry Page, Google
|
[Subscribe to our new Phaser Newsletter](https://confirmsubscription.com/h/r/369DE48E3E86AF1E). We'll email you when new versions are released as well as send you our regular Phaser game making magazine.
|
||||||
|
|
||||||
Latest Update
|
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||||
-------------
|
|
||||||
|
|
||||||
September 13th 2013
|
|
||||||
|
|
||||||
We're very pleased to have finally shipped the 1.0 release of Phaser. This version represents many months of hard work, feedback and refactoring based on the previous 0.5 through to 0.97 releases. You can see the full gory details in our change log.
|
Welcome to Phaser
|
||||||
|
-----------------
|
||||||
|
|
||||||
Sorry but the jsdocs aren't yet finished, but it is now our priority (along with bug fixing). If you run into problems, or just want to chat about how to best use Phaser then please do join our forums. It's an active and inspiring community.
|
Phaser 2.0 "welcome" text to go here.
|
||||||
|
|
||||||
Now 1.0 is released we'll focus on getting the docs and more examples completed. Both of these will be pushed to the master repo on a regular basis. We will tag new releases of Phaser, but changes to the examples or docs won't be release tagged.
|
|
||||||
|
|
||||||
Thank you to everyone who has encouraged us along the way. To those of you who worked with Phaser during its various incarnations, and who released full games with it despite there being zero API documentation available: you are our heroes. It's your kind words and enthusiasm, as well as our commercial need for Phaser that has kept us going. Now we're at 1.0 we will continue releasing rapidly and jumping on patches and bug reports quickly.
|
Getting Started Guides
|
||||||
|
----------------------
|
||||||
|
|
||||||
Phaser is everything we ever wanted from an HTML5 game framework. It will power all our client work going forward and we look forward to you joining us on this journey.
|
We have a new [Getting Started Guide](http://phaser.io/getting-started-js.php) which covers all you need to begin developing games with Phaser. From setting up a web server to picking an IDE. If you're new to HTML5 game development, or are coming from another language like AS3, then we recommend starting there.
|
||||||
|
|
||||||
|
There is a comprehensive [How to Learn Phaser](http://gamedevelopment.tutsplus.com/articles/how-to-learn-the-phaser-html5-game-engine--gamedev-13643) guide on the GameDevTuts+ site which is a great place to learn where to find tutorials, examples and support.
|
||||||
|
|
||||||
|
There is also an [un-official Getting Started Guide](http://www.antonoffplus.com/coding-an-html5-game-for-30-minutes-or-an-introduction-to-the-phaser-framework).
|
||||||
|
|
||||||
|
|
||||||
|
Change Log
|
||||||
|
----------
|
||||||
|
|
||||||
|
Version 2.0.0 - "Aes Sedai" - -in development-
|
||||||
|
|
||||||
|
Significant API changes:
|
||||||
|
|
||||||
|
* Upgraded to Pixi.js 1.5.2
|
||||||
|
* Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting and child iteration.
|
||||||
|
* Removed Sprite.group property. You can use Sprite.parent for all similar needs now.
|
||||||
|
* PIXI.Point is now aliased to Phaser.Point - saves on code duplication and works exactly the same.
|
||||||
|
* PIXI.Rectangle is now aliased to Phaser.Rectangle - saves on code duplication and works exactly the same.
|
||||||
|
* PIXI.Circle is now aliased to Phaser.Circle - saves on code duplication and works exactly the same.
|
||||||
|
* Sprite.deltaX and deltaY swapped to functions: Sprite.deltaX() and Sprite.deltaY()
|
||||||
|
* Sprite.crop() now takes a Phaser.Rectangle instead of explicit parameters.
|
||||||
|
* PixiPatch no longer needed, all features that it patched are now native in Pixi :)
|
||||||
|
* Removed: Sprite.offset, center, topLeft, topRight, bottomRight, bottomLeft and bounds, as no longer needed internally. Use Sprite.getBounds() to derive them.
|
||||||
|
* Button now extends Phaser.Image not Phaser.Sprite, all the same functionality as before remains, just no animations or physics body.
|
||||||
|
* Text.content has been replaced with Text.text. The Text class has a lot of new methods, check the docs!
|
||||||
|
* Loader won't set crossOrigin on Images unless it's set to something. The default is false, it used to be '' and can be any valid string.
|
||||||
|
* Sprite.input.pixelPerfect has been split into two: Sprite.input.pixelPerfectClick and Sprite.input.pixelPerfectOver (see new features)
|
||||||
|
* Phaser.Stage now extends PIXI.Stage, rather than containing a _stage object.
|
||||||
|
* If you set Sprite.exists to false it will also set Sprite.visible to false and remove its body from the physics world (if it has one).
|
||||||
|
* If you set Sprite.exists to true it will also set Sprite.visible to true and add its body back into the physics world (if it has one).
|
||||||
|
* Stage.scale has been moved to Game.scale. The same game scaling properties exist as before, but now accessed via Game.scale instead.
|
||||||
|
* Stage.aspectRatio has been moved to StageScaleMode.sourceAspectRatio (so now game.scale.sourceAspectRatio)
|
||||||
|
* Stage.scaleMode has been moved to StageScaleMode.scaleMode (so now game.scale.scaleMode)
|
||||||
|
* Stage.fullScreenScaleMode has been moved to StageScaleMode.fullScreenScaleMode (so now game.scale.fullScreenScaleMode)
|
||||||
|
* Stage.canvas has been moved to Game.canvas (which used to be a reference to Stage.canvas, but is now the actual object).
|
||||||
|
* BitmapData.addTo removed and enhanced BitmapData.add so it can accept either a single Sprite/Image or an Array of them.
|
||||||
|
* BitmapData has had all of the EaselJS functions removed. It was just taking up space and you can do it all via BitmapData.context directly.
|
||||||
|
* BitmapText has had a bit of an overhaul - the signature for adding a BitmapText has changed to: x, y, font, text, size. See the docs and examples for details.
|
||||||
|
* World preUpdate, update and postUpdate have all been moved to Stage. So all children are updated regardless where on the display list they live.
|
||||||
|
* Cache.getImageKeys and similar has been removed, please use Cache.getKeys(Phaser.Cache.IMAGE) instead, this now supports all 10 Cache data types.
|
||||||
|
* After defining tiles that collide on a Tilemap, you need to call Tilemap.generateCollisionData(layer) to populate the physics world with the data required.
|
||||||
|
* Phaser.QuadTree has been removed from core and moved to a plugin. It's no longer required, nor works with the physics system.
|
||||||
|
* Phaser.Animation.frame now returns the frame of the current animation, rather than the global frame from the sprite sheet / atlas.
|
||||||
|
* When adding a Group if the parent value is `null` the Group won't be added to the World, so you can add it when ready. If parent is `undefined` it's added by default.
|
||||||
|
* The Keyboard class has had a complete overhaul. Phaser.Key objects are created automatically, there are fixes against duration and keys reset properly on visibility loss.
|
||||||
|
* Keyboard.removeKey has been removed. The way the new keyboard manager works means it's no longer required.
|
||||||
|
* When a game un-pauses (from a visibility loss) it resets all Input components.
|
||||||
|
* Time.advancedTiming is a new boolean property. If true Time.fps, fpsMin, fpsMax, frames, msMin and msMax will be calculated, otherwise they remain at their defaults.
|
||||||
|
* Phaser.StageScaleMode has been renamed to ScaleManager and moved from the system folder to the core folder. It's still available under game.scale.
|
||||||
|
* If your game references the old Phaser.StageScaleMode consts like SHOW_ALL you need to update them to Phaser.ScaleManager, i.e. Phaser.ScaleManager.SHOW_ALL.
|
||||||
|
* Time.physicsElapsed is no longer bound or clamped, be wary of this if you use the value anywhere in your code.
|
||||||
|
* In Group.destroy the default for 'destroyChildren' was false. It's now `true` as this is a far more likely requirement when destroying a Group.
|
||||||
|
* Game no longer pauses if you've forced orientation and change it, also doesn't resize a NO_SCALE game.
|
||||||
|
* All the Debug methods have had the word 'render' removed from the start. So where you did `debug.renderSpriteInfo` before, it's now just `debug.spriteInfo`.
|
||||||
|
* Debug methods that rendered geometry (Rectangle, Circle, Line, Point) have been merged into the single method: `Debug.geom`.
|
||||||
|
* Animation.looped has been renamed to Animation.loop. It's a boolean you can toggle at run-time to turn on/off animation looping.
|
||||||
|
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
* Phaser.Image is a brand new display object perfect for logos, backgrounds, etc. You can scale, rotate, tint, blend an get input events from an Image, but it has no animation, physics body.
|
||||||
|
* You can now use the hitArea property on Sprites and Image objects. hitArea can be a geometry object (Rectangle, Circle, Polygon, Ellipse) and is used in pointerOver checks.
|
||||||
|
* InputManager.getLocalPosition(displayObject, pointer, output) will return the local coordinates of the specified displayObject and pointer.
|
||||||
|
* InputManager.hitTest will test for pointer hits against a Sprite/Image, its hitArea (if set) or any of its children.
|
||||||
|
* Text has lots of new methods to help style it: Text.fill, Text.align, Text.stroke, etc.
|
||||||
|
* Text now works happily with font names with spaces in them.
|
||||||
|
* Text.setShadow applies a drop shadow to the Text being rendered. Control the x, y, color and blur.
|
||||||
|
* Text.lineSpacing allows you to set additional spacing between each line that is rendered.
|
||||||
|
* Text.inputEnabled allows you to enable all input events over Text objects: dragging, clicking, etc - anything that works on a Sprite works on Text now too.
|
||||||
|
* Phaser.Ellipse added. A fully compatible port of the PIXI.Ellipse class, can be used in Sprite/Image hitArea tests.
|
||||||
|
* Phaser.Polygon added. A fully compatible port of the PIXI.Polygon class, can be used in Sprite/Image hitArea tests.
|
||||||
|
* InputHandler.pixelPerfectOver - performs a pixel perfect check to see if any pointer is over the current object (warning: very expensive!)
|
||||||
|
* InputHandler.pixelPerfectClick - performs a pixel perfect check but only when the pointer touches/clicks on the current object.
|
||||||
|
* TileSprite can now use a frame from a texture atlas or a sprite sheet.
|
||||||
|
* TileSprites can now be animated. See new example :)
|
||||||
|
* TileSprites have a new method: autoScroll(x, y) which sets an automatic scroll running (until stopped with TileSprite.stopScroll).
|
||||||
|
* BitmapText now uses the new XML parser which should work under CocoonJS without clashes.
|
||||||
|
* BitmapText signature changed so you can support fonts with spaces in their names.
|
||||||
|
* Loader.bitmapFont now has 2 extra parameters: xSpacing and ySpacing. These allow you to add extra spacing to each letter or line of the font.
|
||||||
|
* Added the new RetroFont class. This is for rendering fixed-width bitmap fonts into an Image object. It's a texture you can apply to a Sprite/Image.
|
||||||
|
* Added Cache.updateFrameData which is really useful for swapping FrameData blocks in the cache.
|
||||||
|
* Loader.physics now lets you load Lime + Corona JSON Physics data, which can be used with Body.loadPolygon and Body.loadData.
|
||||||
|
* Cache.addPhysicsData and Cache.getPhysicsData allow you to store parsed JSON physics data in the cache, for sharing between Bodies.
|
||||||
|
* fixedToCamera now works across all display objects. When enabled it will fix at its current x/y coordinate, but can be changed via cameraOffset.
|
||||||
|
* fixedToCamrea now works for Groups as well :) You can fix a Group to the camera and it will influence its children.
|
||||||
|
* Tilemap.createCollisionObjects will parse Tiled data for objectgroups and convert polyline instances into physics objects you can collide with in the world.
|
||||||
|
* Loader can now load JSON files specifically (game.load.json) and they are parsed and stored in the Game.Cache. Retrieve with game.cache.getJSON(key).
|
||||||
|
* TileSprites can now receive full Input events, dragging, etc and be positioned in-world and fixed to cameras.
|
||||||
|
* The StateManager now looks for a function called 'resumed' which is called when a game un-pauses.
|
||||||
|
* Key.onHold added. This event is dispatched every time the browser sends a keydown event and the key is already being held down.
|
||||||
|
* Stage.smoothed allows you to set if sprites will be smoothed when rendered. Set to false if you're using pixel art in your game. Default is true. Works in Canvas and WebGL.
|
||||||
|
* Sprite.smoothed and Image.smoothed allows you to set per-Sprite smoothing, perfect if you just want to keep a few sprites smoothed (or not)
|
||||||
|
* StateManager.start can now have as many parameters as you like. The order is: start(key, clearWorld, clearCache, ...) - they are passed to State.init() (NOT create!)
|
||||||
|
* Loader.script now has callback (and callbackContext) parameters, so you can specify a function to run once the JS has been injected into the body.
|
||||||
|
* Phaser.Timer.stop has a new parameter: clearEvents (default true), if true all the events in Timer will be cleared, otherwise they will remain (fixes #383)
|
||||||
|
* All GameObjects now have a 'destroyChildren' boolean as a parameter to their destroy method. It's default is true and the value propogates down its children.
|
||||||
|
* Pixi GrayFilter ported over (thanks nickryall #404)
|
||||||
|
* Animation.speed added. You can now change the animation speed on the fly, without re-starting the animation (feature request #458)
|
||||||
|
* Brand new Grunt task - creates each core library as its own file and a combined phaser.js.
|
||||||
|
* New build script now cleanly splits Phaser, Pixi and p2 so they are each UMD wrapped and each available in the global scope (now more requireJS friendly!).
|
||||||
|
* phaser-no-libs.js allows you to use your own version of p2.js or pixi.js with Phaser. Warning: This is totally unsupported. If you hit bugs, you fix them yourself.
|
||||||
|
* Group.sendToBottom(child) is the handy opposite of Group.bringToTop()
|
||||||
|
* Group.moveUp(child) will move a child up the display list, swapping with the child above it.
|
||||||
|
* Group.moveDown(child) will move a child down the display list, swapping with the child below it.
|
||||||
|
* Device.windowsPhone is now tested for.
|
||||||
|
* The Debug panel now works in WebGL mode. Pay attention to the warning at the top of the Debug docs (feature request #499)
|
||||||
|
* You can now create blank Tilemaps and then populate them with data later.
|
||||||
|
* A single Animation object now has 3 new events: onStart, onLoop and onComplete.
|
||||||
|
* Animation.loopCount holds the number of times the animation has looped since it last started.
|
||||||
|
* Tween.generateData(frameRate) allows you to generate tween data into an array, which can then be used however you wish (see new examples)
|
||||||
|
* Group.xy(index, x, y) allows you to set the x and y coordinates of a Group child at the given index.
|
||||||
|
* Group.reverse() reverses the display order of all children in the Group.
|
||||||
|
* Tweens are now bound to their own TweenManager, not always the global game one. So you can create your own managers now (for you clark :)
|
||||||
|
|
||||||
|
|
||||||
|
Updates:
|
||||||
|
|
||||||
|
* Massive thanks to clark-stevenson for doing an amazing job update the TypeScript definitions file.
|
||||||
|
* Debug.renderRectangle has a new parameter: filled. If true it renders as with fillRect, if false strokeRect.
|
||||||
|
* Phaser.AnimationParser now sets the trimmed data directly for Pixi Texture frames. Tested across JSON Hash, JSON Data, Sprite Sheet and XML.
|
||||||
|
* Game.add.renderTexture now has the addToCache parameter. If set the texture will be stored in Game.Cache and can be retrieved with Cache.getTexture(key).
|
||||||
|
* Game.add.bitmapData now has the addToCache parameter. If set the texture will be stored in Game.Cache and can be retrieved with Cache.getBitmapData(key).
|
||||||
|
* The InputManager now sets the canvas style cursor to 'inherit' instead of 'default'.
|
||||||
|
* World.reset now calls Camera.reset which sends the camera back to 0,0 and un-follows any object it may have been tracking.
|
||||||
|
* Added hostname: '*' to the grunt-connect in Gruntfile.js (fixes #426)
|
||||||
|
* Device, Canvas and GamePad classes all updated for better CocoonJS support (thanks Videlais)
|
||||||
|
* BitmapData.alphaMask will draw the given image onto a BitmapData using an image as an alpha mask.
|
||||||
|
* The new GameObjectCreator (which you access via game.make or State.make) lets you easily create an object but NOT add it to the display list.
|
||||||
|
* TilemapParser will now throw a warning if the tileset image isn't the right size for the tile dimensions.
|
||||||
|
* We now force IE11 into Canvas mode to avoid a Pixi bug with pre-multiplied alpha. Will remove once that is fixed, sorry, but it's better than no game at all, right? :(
|
||||||
|
* Loader.setPreloadSprite() will now set sprite.visible = true once the crop has been applied. Should help avoid issues (#430) on super-slow connections.
|
||||||
|
* Updated the way the page visibility is checked, should now be more compatible across more browsers.
|
||||||
|
* Phaser.Input.Key.isUp now defaults to 'true', as does GamepadButton.isUp (#474)
|
||||||
|
* Vastly improved visibility API support + pageshow/pagehide + focus/blur. Working across Chrome, IE, Firefox, iOS, Android (also fixes #161)
|
||||||
|
* Pausing the game will now mute audio and resuming will un-mute, unless it was muted via the game (fixes #439)
|
||||||
|
* ScaleManager has 2 new events: ScaleManager.enterFullScreen and ScaleManager.leaveFullScreen, so you can respond to fullscreen changes directly.
|
||||||
|
* RandomDataGenerator.integerInRange(min, max) now includes both `min` and `max` within its range (#501)
|
||||||
|
* Tween no longer copies all the object properties into the `_valuesStart` object on creation.
|
||||||
|
* Completely empty Tilemaps can now be created. This allows for dynamic map generation at runtime.
|
||||||
|
* Keyboard.event now stores the most recent DOM keyboard event.
|
||||||
|
* Animation.stop has a new parameter: dispatchComplete. If true it'll dispatch an Animation.onComplete event.
|
||||||
|
* TileSprites now have a physics body property and call it in the pre and post updates. As with all physics bodies it's null by default.
|
||||||
|
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
|
||||||
|
* Explicitly paused Timer continues if you un-focus and focus the browser window (thanks georgiee)
|
||||||
|
* Added TimerEvent.pendingDelete and checks in Timer.update, so that removing an event in a callback no longer throws an exception (thanks georgiee)
|
||||||
|
* Fixed TypeScript defs on lines 1741-1748 (thanks wombatbuddy)
|
||||||
|
* Previously if you used Sprite.crop() it would crop all Sprites that shared the same base image. It now takes a local copy of the texture data and crops just that.
|
||||||
|
* Tilemap had the wrong @method signatures so most were missing from the docs.
|
||||||
|
* Fixed bug where changing State would cause the camera to not reset if it was following an object.
|
||||||
|
* Tile had 2 properties (callback and callbackContext) that were never assigned, updated to use the proper names (thanks ratkingsimon)
|
||||||
|
* Fixed an error that would occur if you used InputHandler.onInputUp and the Sprite destroys itself during the event.
|
||||||
|
* IE11 didn't populate the Device.ieVersion value. Now extracted from Trident revision, but still use Device.trident instead for IE11+ checks.
|
||||||
|
* Fixed bug in Math.angleBetween where it was using the coordinates in the wrong order.
|
||||||
|
* Previously using a Pixel Perfect check didn't work if the Sprite was rotated or had a non-zero anchor point, now works under all conditions + atlas frames.
|
||||||
|
* If pixelPerfect Input Sprites overlapped each other the pixel check wasn't taken into consieration in the Pointer move method.
|
||||||
|
* Updated Input.Mouse to use event.button not event.which, so the const reference from input.mouse.button is correct (thanks grimor)
|
||||||
|
* Text that was fixedToCamera would 'jitter' if the world scrolled. Now works as expected across all fixed objects.
|
||||||
|
* Fixed a bug where Sound.play wouldn't pick-up the local loop setting if not specified in the parameter.
|
||||||
|
* Active animations now monitor if the game pauses, and resume normally when the game un-pauses (fixes #179)
|
||||||
|
* Swapping between tabs will now pause the game correctly on mobile browsers (iOS7+)
|
||||||
|
* Swapping between tabs will pause and resume tweens correctly, allowing their onComplete events to still fire (fixes #292)
|
||||||
|
* Fullscreen mode now uses window.outerWidth/Height when using EXACT_FIT as the scale mode, which fixes input coordinate errors (fixes #232)
|
||||||
|
* Fullscreen mode now works in Internet Explorer and uses the new fullscreen non-prefix call.
|
||||||
|
* Fixed TilemapParser - would spit out a tileset warning if margin/spacing were set (fix #485, thanks Cybolic)
|
||||||
|
* AnimationParser.spriteSheet wasn't taking the margin or spacing into account when calculating the numbers of sprites per row/column, nor was it allowing for extra power-of-two padding at the end (fix #482, thanks yig)
|
||||||
|
* AnimationManager.add documentation said that 'frames' could be null, but the code couldn't handle this so it defaults to an empty array if none given (thanks yig)
|
||||||
|
* Fixed issue stopping SoundManager.volume from working correctly on a global volume basis (fixes #488)
|
||||||
|
* Phaser.Timer will no longer create negative ticks during game boot, no matter how small the Timer delay is (fixes #366)
|
||||||
|
* Phaser.Timer will no longer resume if it was previously paused and the game loses focus and then resumes (fixes #383)
|
||||||
|
* Tweens now resume correctly if the game pauses (focus loss) while they are paused.
|
||||||
|
* Tweens don't double pause if they were already paused and the game pauses.
|
||||||
|
* Buttons are now cleanly destroyed if part of a Group without leaving their InputHandler running.
|
||||||
|
* You can now safely destroy a Group and the 'destroyChildren' boolean will propogate fully down the display list.
|
||||||
|
* Calling destroy on an already destroyed object would throw a run-time error. Now checked for and aborted.
|
||||||
|
* Calling destroy while in an Input Event callback now works for either the parent Group or the calling object itself.
|
||||||
|
* Loader.replaceInFileList wouldn't over-write the previous entry correctly, which caused the Loader.image overwrite parameter to fail (thanks basoko, fixes #493)
|
||||||
|
* If the game was set to NO_SCALE and you swapped orientation, it would pause and resize, then fail to resize when you swapped back (thanks starnut, fixes #258)
|
||||||
|
* Device no longer things a Windows Phone or Windows Tablet are desktop devices (thanks wombatbuddy, fixes #506)
|
||||||
|
* Sound.onMarkerComplete event is now dispatched when a marker stops. See Sound.onLoop for a looping marker event (thanks registered99, fixes #500)
|
||||||
|
* Events.onInputUp would be dispatched twice if the Sprite had drag enabled, now only dispatched once (thanks Overbryd, fixes #502)
|
||||||
|
* You can now load in CSV Tilemaps again and they get created properly (fixes #391)
|
||||||
|
* Tilemap.putTile can now insert a tile into a null/blank area of the map (before it could only replace existing tiles)
|
||||||
|
* Tilemap.putTile now correctly re-calculates the collision data based on the new collideIndexes array (fixes #371)
|
||||||
|
* Circle.circumferencePoint using the asDegrees parameter would apply degToRad instead of radToDeg (thanks Ziriax, fixes #509)
|
||||||
|
* InputHandler.enableSnap now correctly assigns the snap offset parameters (fixes #515)
|
||||||
|
* Objects that are 'fixedToCamera' are now still correctly placed even if the camera is scaled (#512)
|
||||||
|
|
||||||
|
|
||||||
|
TO DO:
|
||||||
|
|
||||||
|
* If you change the frame name of a pixel precise input Sprite, it will fail all clicks on it after the frame change.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md
|
||||||
|
|
||||||
|
|
||||||
|
How to Build
|
||||||
|
------------
|
||||||
|
|
||||||
|
We provide a fully compiled version of Phaser in the `build` directory, in both plain and minified formats.
|
||||||
|
|
||||||
|
We also provide a Grunt script that will build Phaser from source along with all the examples.
|
||||||
|
|
||||||
|
Run `grunt` in the phaser folder for a list of command-line options.
|
||||||
|
|
||||||
|
|
||||||
|
Koding
|
||||||
|
------
|
||||||
|
|
||||||
|
You can [][koding] and then start editing and previewing code right away using their web based VM development system.
|
||||||
|
|
||||||
|
|
||||||
|
Bower
|
||||||
|
-----
|
||||||
|
|
||||||
|
If you use bowser you can install phaser with:
|
||||||
|
|
||||||
|
`bower install phaser`
|
||||||
|
|
||||||
|
Nice and easy :)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
CDNJS
|
||||||
|
-----
|
||||||
|
|
||||||
|
Thanks to a community member Phaser is now available on [CDNJS](http://cdnjs.com). You can include the following in your html:
|
||||||
|
|
||||||
|
`http://cdnjs.cloudflare.com/ajax/libs/phaser/1.1.3/phaser.min.js`
|
||||||
|
|
||||||
|
Or if you prefer you can leave the protocol off, so it works via http and https:
|
||||||
|
|
||||||
|
`//cdnjs.cloudflare.com/ajax/libs/phaser/1.1.3/phaser.min.js`
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Games created with Phaser require a modern web browser that supports the canvas tag. This includes Internet Explorer 9+, Firefox, Chrome, Safari and Opera. It also works on mobile web browsers including stock Android 2.x browser and above and iOS5 Mobile Safari and above.
|
Games created with Phaser require a modern web browser that supports the canvas tag. This includes Internet Explorer 9+, Firefox, Chrome, Safari and Opera. It also works on mobile web browsers including stock Android 2.x browser and above and iOS5 Mobile Safari and above.
|
||||||
|
|
||||||
For developing with Phaser you can use either a plain-vanilla JavaScript approach or [TypeScript](https://typescript.codeplex.com/). We made no assumptions about how you like to code your games, and were careful not to impose any form of class/inheritance/structure upon you.
|
For developing with Phaser you can use either a plain-vanilla JavaScript approach or [TypeScript](https://typescript.codeplex.com/) using the provided TypeScript definitions file. We made no assumptions about how you like to code your games, and were careful not to impose any form of class/inheritance/structure upon you.
|
||||||
|
|
||||||
|
Phaser is 321 KB minified and 72 KB gzipped.
|
||||||
|
|
||||||
|
|
||||||
|
Learn By Example
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Phaser comes with an ever growing suite of Examples. Personally I feel that we learn better by looking at small refined code examples, so we created over 200 of them and create new ones to test every new feature added. Inside the `examples` folder you'll find the current set. If you write a particularly good example then please send it to us.
|
||||||
|
|
||||||
|
The examples need to be run through a local web server (in order to avoid file access permission errors from your browser). You can use your own web server, or start the included web server using grunt.
|
||||||
|
|
||||||
|
Using a locally installed web server browse to the examples folder:
|
||||||
|
|
||||||
|
examples/index.html
|
||||||
|
|
||||||
|
Alternatively in order to start the included web server, after you've cloned the repo, run `npm install` to install all dependencies, then `grunt connect` to start a local server. After running this command you should be able to access your local webserver at `http://127.0.0.1:8000`. Then browse to the examples folder: `http://127.0.0.1:8000/examples/index.html`
|
||||||
|
|
||||||
|
There is a new 'Side View' example viewer as well. This loads all the examples into a left-hand frame for faster navigation.
|
||||||
|
|
||||||
|
You can also browse all [Phaser Examples](http://gametest.mobi/phaser/) online.
|
||||||
|
|
||||||
Phaser is 275 KB minified and 62 KB gzipped.
|
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
**WebGL & Canvas**
|
**WebGL & Canvas**
|
||||||
|
|
||||||
Phaser uses both a Canvas and WebGL renderer internally and can automatically swap between them based on browser support. This allows for lightning fast rendering across Desktop and Mobile. Phaser uses and contributes towards the excellent Pixi.js library for rendering.
|
Phaser uses both a Canvas and WebGL renderer internally and can automatically swap between them based on browser support. This allows for lightning fast rendering across Desktop and Mobile. When running under WebGL Phaser now supports shaders, allowing for some incredible in-game effects. Phaser uses and contributes towards the excellent Pixi.js library for rendering.
|
||||||
|
|
||||||
**Preloader**
|
**Preloader**
|
||||||
|
|
||||||
We've made the loading of assets as simple as one line of code. Images, Sounds, Sprite Sheets, Tilemaps, JSON data, XML - all parsed and handled automatically, ready for use in game and stored in a global Cache for Sprites to share.
|
We've made the loading of assets as simple as one line of code. Images, Sounds, Sprite Sheets, Tilemaps, JSON data, XML and JavaScript files - all parsed and handled automatically, ready for use in game and stored in a global Cache for Sprites to share.
|
||||||
|
|
||||||
**Physics**
|
**Physics**
|
||||||
|
|
||||||
Phaser ships with our Arcade Physics system. An extremely light-weight AABB physics library perfect for low-powered devices and fast collision response. Control velocity, acceleration, bounce, drag and full collision and separation control.
|
Phaser ships with our Arcade Physics system. A SAT based collision and physics library perfect for low-powered devices and fast collision response. Control velocity, acceleration, bounce, damping and full collision and separation control. As of version 1.1.4 we now support rectangles, circles and polygon collision with full rotation.
|
||||||
|
|
||||||
**Sprites**
|
**Sprites**
|
||||||
|
|
||||||
@@ -109,100 +365,80 @@ We use Phaser every day on our many client projects. As a result it's constantly
|
|||||||
|
|
||||||
**Battle Tested**
|
**Battle Tested**
|
||||||
|
|
||||||
Although Phaser 1.0 is a brand new release it is born from years of experience building some of the biggest HTML5 games out there. We're not saying it is 100% bug free, but we use it for our client work every day, so issues get resolved <em>fast</em> and we stay on-top of the changing browser landscape.
|
Although Phaser 1.0 is a brand new release it is born from years of experience building some of the biggest mobile HTML5 games out there. We're not saying it is 100% bug free, but we use it for our client work every day, so issues get resolved <em>fast</em> and we stay on-top of the changing browser landscape.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Change Log
|
|
||||||
----------
|
|
||||||
|
|
||||||
Version 1.0.1
|
Road Map
|
||||||
|
--------
|
||||||
|
|
||||||
* Added checks into every Group function to ensure that the Group has children before running them.
|
Beyond version 2.0 here are some of the features planned for the future:
|
||||||
* Added optional flag to Group.create which allows you to set the default exists state of the Sprites.
|
|
||||||
* Sprite.animation.stop no longer needs an animation name parameter, will default to stopping the current animation.
|
|
||||||
* Fixed the license in package.json
|
|
||||||
* Fixed a logic bug in the separateTileX function that would sometimes cause tunneling of big sprites through small tiles.
|
|
||||||
|
|
||||||
Known Issues
|
Version 2.1 ("Shienar")
|
||||||
------------
|
|
||||||
|
|
||||||
* The TypeScript definition file isn't yet complete.
|
* Enhance the State Management, so you can perform non-destructive State swaps and persistence.
|
||||||
* The JSDOCS are not yet complete.
|
* A more advanced Particle system, one that can render to a single canvas (rather than spawn hundreds of Sprites), more advanced effects, etc.
|
||||||
|
* Ability to control DOM elements from the core game and layer them into the game.
|
||||||
|
* Touch Gestures.
|
||||||
|
* Support for parallel asset loading.
|
||||||
|
|
||||||
Future Plans
|
Version 2.2 ("Tarabon")
|
||||||
------------
|
|
||||||
|
|
||||||
The following list is not exhaustive and is subject to change:
|
* Comprehensive testing across Firefox OS devices, CocoonJS and Ejecta.
|
||||||
|
* Integration with third party services like Google Play Game Services and Amazon JS SDK.
|
||||||
|
* Flash CC HTML5 export integration.
|
||||||
|
* Massively enhance the audio side of Phaser. Take more advantage of Web Audio: echo effects, positional sound, etc.
|
||||||
|
|
||||||
* Integrate Advanced Physics system.
|
Beyond version 2.2
|
||||||
* Integrate Advanced Particle system.
|
|
||||||
* Better sound controls and audio effects.
|
|
||||||
* Google Play Game Services.
|
|
||||||
* Ability to layer another DOM object and have it controlled by the game.
|
|
||||||
* More GUI components: checkbox, radio button, window, etc.
|
|
||||||
* Tilemap: more advanced Tiled support and support for DAME tilemaps.
|
|
||||||
* Joypad support.
|
|
||||||
* Gestures input class.
|
|
||||||
|
|
||||||
Right now our main focus is on documentation.
|
* Test out packaging with Node-webkit.
|
||||||
|
* Game parameters stored in Google Docs.
|
||||||
|
* Look at HiDPI Canvas settings.
|
||||||
|
* Multiple Camera support.
|
||||||
|
* DragonBones support.
|
||||||
|
* Cache to localStorage using If-Modified-Since. [See github request](https://github.com/photonstorm/phaser/issues/495)
|
||||||
|
|
||||||
Test Suite
|
|
||||||
----------
|
|
||||||
|
|
||||||
Phaser comes with an ever growing Test Suite. Personally we learn better by looking at small refined code examples, so we create lots of them to test each new feature we add. Inside the Tests folder you'll find the current set. If you write a particularly good test then please send it to us.
|
Nadion
|
||||||
|
------
|
||||||
|
|
||||||
The tests need running through a local web server (to avoid file access permission errors from your browser).
|
[Nadion](https://github.com/jcd-as/nadion) is a set of powerful enhancements for Phaser that makes level building even easier. It includes features such as Trigger, Area, Alarms and Emitters, debug panels, state machines, parallax layer scrolling, 'developer mode' short-cuts and more.
|
||||||
|
|
||||||
Make sure you can browse to the Tests folder via your web server. If you've got php installed then launch:
|
|
||||||
|
|
||||||
examples/index.php
|
|
||||||
|
|
||||||
Right now the Test Suite requires PHP, but we will remove this requirement soon.
|
|
||||||
|
|
||||||
You can also browse the [Phaser Test Suite](http://gametest.mobi/phaser/) online.
|
|
||||||
|
|
||||||
Contributing
|
Contributing
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Phaser is in early stages and although we've still got a lot to add to it, we wanted to just get it out there and share it with the world.
|
We now have a full [Contributors Guide][contribute] which goes into the process in more detail, but here are the headlines:
|
||||||
|
|
||||||
If you find a bug (highly likely!) then please report it on github.
|
- If you find a bug then please report it on [GitHub Issues][issues] or our [Support Forum][forum].
|
||||||
|
|
||||||
If you have a feature request, or have written a small game or demo that shows Phaser in use, then please get in touch. We'd love to hear from you.
|
- If you have a feature request, or have written a game or demo that shows Phaser in use, then please get in touch. We'd love to hear from you! Either post to our [forum][forum] or email: rich@photonstorm.com
|
||||||
|
|
||||||
|
- If you issue a Pull Request for Phaser, please only do so againt the `dev` branch and *not* against the `master` branch.
|
||||||
|
|
||||||
|
- Before submitting a Pull Request please run your code through [JSHint](http://www.jshint.com/) to check for stylistic or formatting errors. To use JSHint, first install it by running `npm install jshint`, then test your code by running `jshint src`. This isn't a strict requirement and we are happy to receive Pull Requests that haven't been JSHinted, so don't let it put you off contributing, but do know that we'll reformat your source before going live with it.
|
||||||
|
|
||||||
You can do this on the Phaser board that is part of the [HTML5 Game Devs forum](http://www.html5gamedevs.com/forum/14-phaser/) or email: rich@photonstorm.com
|
|
||||||
|
|
||||||
Bugs?
|
Bugs?
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Please add them to the [Issue Tracker][1] with as much info as possible.
|
Please add them to the [Issue Tracker][issues] with as much info as possible, especially source code demonstrating the issue.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
"Being negative is not how we make progress" - Larry Page, Google
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
The MIT License (MIT)
|
Phaser is released under the [MIT License](http://opensource.org/licenses/MIT).
|
||||||
|
|
||||||
Copyright (c) 2013 Richard Davey, Photon Storm Ltd.
|
[issues]: https://github.com/photonstorm/phaser/issues
|
||||||
|
[contribute]: https://github.com/photonstorm/phaser/blob/master/CONTRIBUTING.md
|
||||||
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.
|
|
||||||
|
|
||||||
[1]: https://github.com/photonstorm/phaser/issues
|
|
||||||
[phaser]: https://github.com/photonstorm/phaser
|
[phaser]: https://github.com/photonstorm/phaser
|
||||||
|
[forum]: http://www.html5gamedevs.com/forum/14-phaser/
|
||||||
|
[koding]: https://koding.com/Teamwork?import=https://github.com/photonstorm/phaser/archive/master.zip&c=git1
|
||||||
|
|
||||||
|
[](https://github.com/igrigorik/ga-beacon)
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"name": "phaser",
|
||||||
|
"version": "1.1.5",
|
||||||
|
"homepage": "http://phaser.io",
|
||||||
|
"authors": [
|
||||||
|
"photonstorm <rich@photonstorm.com>"
|
||||||
|
],
|
||||||
|
"description": "A fun, free and fast 2D game framework for making HTML5 games for desktop and mobile, supporting Canvas and WebGL.",
|
||||||
|
"main": "build/phaser.min.js",
|
||||||
|
"keywords": [
|
||||||
|
"html5",
|
||||||
|
"game",
|
||||||
|
"games",
|
||||||
|
"framework",
|
||||||
|
"canvas",
|
||||||
|
"WebGL",
|
||||||
|
"tilemaps",
|
||||||
|
"physics",
|
||||||
|
"sprites",
|
||||||
|
"fonts",
|
||||||
|
"images",
|
||||||
|
"audio",
|
||||||
|
"Web",
|
||||||
|
"Audio",
|
||||||
|
"touch",
|
||||||
|
"input",
|
||||||
|
"mobile"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<a href="http://yui.2clics.net/">Minify it</a><br />
|
|
||||||
|
|
||||||
<textarea style="width: 800px; height: 800px">
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$js = file('../examples/js.php');
|
|
||||||
$output = "";
|
|
||||||
|
|
||||||
for ($i = 0; $i < count($js); $i++)
|
|
||||||
{
|
|
||||||
// <script src="../src/Phaser.js"></script>
|
|
||||||
$line = trim($js[$i]);
|
|
||||||
|
|
||||||
if (strpos($line, '<script') !== false)
|
|
||||||
{
|
|
||||||
$line = str_replace('<script src="', '', $line);
|
|
||||||
$line = str_replace('"></script>', '', $line);
|
|
||||||
|
|
||||||
echo $line . "\n";
|
|
||||||
|
|
||||||
// Read the file in
|
|
||||||
$source = file_get_contents($line);
|
|
||||||
|
|
||||||
if ($i == 4)
|
|
||||||
{
|
|
||||||
// Built at: {buildDate}
|
|
||||||
$source = str_replace('{buildDate}', date('r'), $source);
|
|
||||||
}
|
|
||||||
|
|
||||||
$output .= $source . "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//echo $output;
|
|
||||||
|
|
||||||
file_put_contents('phaser.js', $output);
|
|
||||||
|
|
||||||
?>
|
|
||||||
</textarea>
|
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
<?php
|
||||||
|
if (!isset($path))
|
||||||
|
{
|
||||||
|
$path = '..';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo <<<EOL
|
||||||
|
|
||||||
|
<script src="$path/src/p2.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/pixi/Pixi.js"></script>
|
||||||
|
<script src="$path/src/pixi/core/Point.js"></script>
|
||||||
|
<script src="$path/src/pixi/core/Rectangle.js"></script>
|
||||||
|
<script src="$path/src/pixi/core/Polygon.js"></script>
|
||||||
|
<script src="$path/src/pixi/core/Circle.js"></script>
|
||||||
|
<script src="$path/src/pixi/core/Ellipse.js"></script>
|
||||||
|
<script src="$path/src/pixi/core/Matrix.js"></script>
|
||||||
|
<script src="$path/src/pixi/display/DisplayObject.js"></script>
|
||||||
|
<script src="$path/src/pixi/display/DisplayObjectContainer.js"></script>
|
||||||
|
<script src="$path/src/pixi/display/Sprite.js"></script>
|
||||||
|
<script src="$path/src/pixi/display/SpriteBatch.js"></script>
|
||||||
|
<script src="$path/src/pixi/filters/FilterBlock.js"></script>
|
||||||
|
<script src="$path/src/pixi/text/Text.js"></script>
|
||||||
|
<script src="$path/src/pixi/text/BitmapText.js"></script>
|
||||||
|
<script src="$path/src/pixi/display/Stage.js"></script>
|
||||||
|
<script src="$path/src/pixi/utils/Utils.js"></script>
|
||||||
|
<script src="$path/src/pixi/utils/EventTarget.js"></script>
|
||||||
|
<script src="$path/src/pixi/utils/Polyk.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/utils/WebGLShaderUtils.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/shaders/PixiShader.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/shaders/PixiFastShader.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/shaders/StripShader.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/shaders/PrimitiveShader.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/utils/WebGLGraphics.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/WebGLRenderer.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/utils/WebGLMaskManager.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/utils/WebGLShaderManager.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/utils/WebGLFilterManager.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/webgl/utils/FilterTexture.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/canvas/utils/CanvasMaskManager.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/canvas/CanvasRenderer.js"></script>
|
||||||
|
<script src="$path/src/pixi/renderers/canvas/CanvasGraphics.js"></script>
|
||||||
|
<script src="$path/src/pixi/primitives/Graphics.js"></script>
|
||||||
|
<script src="$path/src/pixi/extras/TilingSprite.js"></script>
|
||||||
|
<script src="$path/src/pixi/textures/BaseTexture.js"></script>
|
||||||
|
<script src="$path/src/pixi/textures/Texture.js"></script>
|
||||||
|
<script src="$path/src/pixi/textures/RenderTexture.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/Phaser.js"></script>
|
||||||
|
<script src="$path/src/utils/Utils.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/geom/Circle.js"></script>
|
||||||
|
<script src="$path/src/geom/Point.js"></script>
|
||||||
|
<script src="$path/src/geom/Rectangle.js"></script>
|
||||||
|
<script src="$path/src/geom/Line.js"></script>
|
||||||
|
<script src="$path/src/geom/Ellipse.js"></script>
|
||||||
|
<script src="$path/src/geom/Polygon.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/core/Camera.js"></script>
|
||||||
|
<script src="$path/src/core/State.js"></script>
|
||||||
|
<script src="$path/src/core/StateManager.js"></script>
|
||||||
|
<script src="$path/src/core/LinkedList.js"></script>
|
||||||
|
<script src="$path/src/core/Signal.js"></script>
|
||||||
|
<script src="$path/src/core/SignalBinding.js"></script>
|
||||||
|
<script src="$path/src/core/Filter.js"></script>
|
||||||
|
<script src="$path/src/core/Plugin.js"></script>
|
||||||
|
<script src="$path/src/core/PluginManager.js"></script>
|
||||||
|
<script src="$path/src/core/Stage.js"></script>
|
||||||
|
<script src="$path/src/core/Group.js"></script>
|
||||||
|
<script src="$path/src/core/World.js"></script>
|
||||||
|
<script src="$path/src/core/Game.js"></script>
|
||||||
|
<script src="$path/src/core/ScaleManager.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/input/Input.js"></script>
|
||||||
|
<script src="$path/src/input/Key.js"></script>
|
||||||
|
<script src="$path/src/input/Keyboard.js"></script>
|
||||||
|
<script src="$path/src/input/Mouse.js"></script>
|
||||||
|
<script src="$path/src/input/MSPointer.js"></script>
|
||||||
|
<script src="$path/src/input/Pointer.js"></script>
|
||||||
|
<script src="$path/src/input/Touch.js"></script>
|
||||||
|
<script src="$path/src/input/Gamepad.js"></script>
|
||||||
|
<script src="$path/src/input/SinglePad.js"></script>
|
||||||
|
<script src="$path/src/input/GamepadButton.js"></script>
|
||||||
|
<script src="$path/src/input/InputHandler.js"></script>
|
||||||
|
<script src="$path/src/input/Gestures.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/gameobjects/Events.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/GameObjectCreator.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/GameObjectFactory.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/BitmapData.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/Sprite.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/Image.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/TileSprite.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/Text.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/BitmapText.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/Button.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/Graphics.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/RenderTexture.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/SpriteBatch.js"></script>
|
||||||
|
<script src="$path/src/gameobjects/RetroFont.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/system/Canvas.js"></script>
|
||||||
|
<script src="$path/src/system/Device.js"></script>
|
||||||
|
<script src="$path/src/system/RequestAnimationFrame.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/math/Math.js"></script>
|
||||||
|
<script src="$path/src/math/RandomDataGenerator.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/net/Net.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/tween/TweenManager.js"></script>
|
||||||
|
<script src="$path/src/tween/Tween.js"></script>
|
||||||
|
<script src="$path/src/tween/Easing.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/time/Time.js"></script>
|
||||||
|
<script src="$path/src/time/Timer.js"></script>
|
||||||
|
<script src="$path/src/time/TimerEvent.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/animation/AnimationManager.js"></script>
|
||||||
|
<script src="$path/src/animation/Animation.js"></script>
|
||||||
|
<script src="$path/src/animation/Frame.js"></script>
|
||||||
|
<script src="$path/src/animation/FrameData.js"></script>
|
||||||
|
<script src="$path/src/animation/AnimationParser.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/loader/Cache.js"></script>
|
||||||
|
<script src="$path/src/loader/Loader.js"></script>
|
||||||
|
<script src="$path/src/loader/LoaderParser.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/sound/Sound.js"></script>
|
||||||
|
<script src="$path/src/sound/SoundManager.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/utils/Debug.js"></script>
|
||||||
|
<script src="$path/src/utils/Color.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/physics/Physics.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/physics/arcade/World.js"></script>
|
||||||
|
<script src="$path/src/physics/arcade/Body.js"></script>
|
||||||
|
<script src="$path/src/physics/arcade/QuadTree.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/physics/ninja/World.js"></script>
|
||||||
|
<script src="$path/src/physics/ninja/Body.js"></script>
|
||||||
|
<script src="$path/src/physics/ninja/AABB.js"></script>
|
||||||
|
<script src="$path/src/physics/ninja/Tile.js"></script>
|
||||||
|
<script src="$path/src/physics/ninja/Circle.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/physics/p2/World.js"></script>
|
||||||
|
<script src="$path/src/physics/p2/PointProxy.js"></script>
|
||||||
|
<script src="$path/src/physics/p2/InversePointProxy.js"></script>
|
||||||
|
<script src="$path/src/physics/p2/Body.js"></script>
|
||||||
|
<script src="$path/src/physics/p2/Spring.js"></script>
|
||||||
|
<script src="$path/src/physics/p2/Material.js"></script>
|
||||||
|
<script src="$path/src/physics/p2/ContactMaterial.js"></script>
|
||||||
|
<script src="$path/src/physics/p2/CollisionGroup.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/particles/Particles.js"></script>
|
||||||
|
<script src="$path/src/particles/arcade/ArcadeParticles.js"></script>
|
||||||
|
<script src="$path/src/particles/arcade/Emitter.js"></script>
|
||||||
|
|
||||||
|
<script src="$path/src/tilemap/Tile.js"></script>
|
||||||
|
<script src="$path/src/tilemap/Tilemap.js"></script>
|
||||||
|
<script src="$path/src/tilemap/TilemapLayer.js"></script>
|
||||||
|
<script src="$path/src/tilemap/TilemapParser.js"></script>
|
||||||
|
<script src="$path/src/tilemap/Tileset.js"></script>
|
||||||
|
EOL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,7 +1,511 @@
|
|||||||
Change Log
|
Change Log
|
||||||
----------
|
==========
|
||||||
|
|
||||||
V0.9.8
|
Version 1.1.4 - "Kandor" - February 5th 2014
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
Significant API changes:
|
||||||
|
|
||||||
|
* Loader.tileset has been removed as it's no longer required, this was as part of the Tilemap system overhaul.
|
||||||
|
* TilemapLayers are now created via the Tilemap object itself: map.createLayer(x, y, width, height, tileset, layer, group) and no longer via the GameObjectFactory.
|
||||||
|
* Tilemap.createFromObjects can now turn a bunch of Tiled objects into Sprites in one single call, and copies across all properties as well.
|
||||||
|
* Tween.onStartCallback and onCompleteCallback have been removed to avoid confusion. You should use the onStart, onLoop and onComplete events instead.
|
||||||
|
* Button.forceOut default value has changed from true to false, so Buttons will revert to an Up state (if set) when pressed and released.
|
||||||
|
* The way the collision process callback works has changed significantly and now works as originally intended.
|
||||||
|
* The World level quadtree is no longer created, they are now built and ripped down each time you collide a Group, this helps collision accuracy.
|
||||||
|
* A SAT system has been integrated for Body collision and separation.
|
||||||
|
* Bodies are no longer added to a world quadtree, so have had all of their quadtree properties removed such as skipQuadtree, quadTreeIndex, etc.
|
||||||
|
* Body.drag has been removed. Please use the new Body.linearDamping value instead (which is a number value, not a Point object)
|
||||||
|
* Body.embedded and Body.wasTouching have been removed as they are no longer required.
|
||||||
|
* Body.customSeparateX/Y have been removed as you should now use Body.customSeparateCallback.
|
||||||
|
* Body.maxVelocity defaults have been removed from 10,000 to 2000.
|
||||||
|
* Body.customSeparateCallback allows you to set your own callback when two Bodies need to separate rather than using the built-in method.
|
||||||
|
* Body.collideCallback allows you to set a callback that is fired whenever the Body is hit on any of its active faces.
|
||||||
|
* Body.allowCollision has been renamed to Body.checkCollision.
|
||||||
|
* Body.rebound is a boolean that controls if a body will exchange velocity on collision. Set to false to allow it to be 'pushed' (see new examples).
|
||||||
|
* Removed Body.deltaAbsX and deltaAbsY as they are no longer used internally.
|
||||||
|
* Body.screenX and screenY moved to getters, no longer calculated every frame.
|
||||||
|
* ArcadePhysics now has setBounds and setBoundsToWorld, and you can specify which walls are created or not (left, right, up, down)
|
||||||
|
* Removed: Debug.renderSpriteTouching, Debug.renderLocalTransformInfo, Debug.renderWorldTransformInfo, Debug.renderSpriteCollision and Debug.dumpLinkedList.
|
||||||
|
* Body.setSize has been removed. Please use Body.setCircle, setRectangle or setPolygon instead.
|
||||||
|
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
* Phaser.Timer is now feature complete and fully documented. You can create Phaser.TimerEvents on a Timer and lots of new examples have been provided.
|
||||||
|
* Gamepad API support has been added with lots of new examples (thanks Karl Macklin)
|
||||||
|
* Phaser.Game constructor can now be passed a single object containing all of your game settings + Stage settings. Useful for advanced configurations.
|
||||||
|
* The width/height given to Phaser.Game can now be percentages, i.e. "100%" will set the width to the maximum window innerWidth.
|
||||||
|
* Added a stage.fullScreenScaleMode property to determine scaling when fullscreen (thanks oysterCrusher)
|
||||||
|
* Added support for margin and spacing around a frame in Loader.spritesheet.
|
||||||
|
* Added Device.vibration to check if the Vibration API is available or not.
|
||||||
|
* Added Device.trident and Device.tridentVersion for testing IE11.
|
||||||
|
* Added Device.silk for detecting a Kindle Fire and updated desktop OS check to exclude Kindles (thanks LuckieLordie)
|
||||||
|
* TilemapLayers now have debug and debugAlpha values, this turns on the drawing of the collision edges (very handy for debugging, as the name implies!)
|
||||||
|
* Tweens have a new event: onLoop.
|
||||||
|
* You can now load any binary file via the Loader: game.load.binary(key, url, callback) - the optional callback allows for post-load processing before entering the Cache.
|
||||||
|
* Group.set will let you deep set a new propery on a single child of the Group.
|
||||||
|
* Stage.display property added. A direct reference to the root Pixi Stage object (very useful for RenderTexture manipulation)
|
||||||
|
* Added Ejecta detection to Device (thanks endel)
|
||||||
|
* Tweens can now work with relative + and - values. You can do: `tween(sprite).to( { x: '+400' })` and it will add 400 to the current sprite.x value.
|
||||||
|
* Buttons now properly use their upFrame if set.
|
||||||
|
* InputHandler now has snapOffsetX and snapOffsetY properties so your snap grid doesn't have to be 0,0 aligned (thanks srmeier)
|
||||||
|
* Loader.progressFloat contains the actual non-rounded progress value, where-as Loader.progress contains a rounded value. Use progressFloat if you've > 100 files to load.
|
||||||
|
* Groups can now be added to other Groups as children via group.add() and group.addAt()
|
||||||
|
* Groups now have an 'alive' property, which can be useful when iterating through child groups with functions like forEachAlive.
|
||||||
|
* Added a new Project Template "Full Screen Mobile" which you can find in the resources folder. Contains html / css / layout needed for a deployed Phaser game.
|
||||||
|
* Body.speed - the current speed of the body.
|
||||||
|
* Body.angle - the current angle the Body is facing based on its velocity. This is not the same as the Sprite angle that may own the body.
|
||||||
|
* Body.linearDamping - This now replaces Body.drag and provides for a much smoother damping (friction) experience.
|
||||||
|
* Body.minBounceVelocity - If a Body has bounce set, this threshold controls if it should rebound or not. Use it to stop 'jittering' on bounds/tiles with super-low velocities.
|
||||||
|
* QuadTree.populate - you can pass it a Group and it'll automatically insert all of the children ready for inspection.
|
||||||
|
* Input.setMoveCallback allows you to set a callback that will be fired each time the activePointer receives a DOM move event.
|
||||||
|
* Math.distancePow(x1,y1,x2,y2,power) returns the distance between two coordinates at the given power.
|
||||||
|
* Physics.collide now supports the 2nd parameter as an array, for when you want to collide an object against a number of sprites that aren't all in the same Group.
|
||||||
|
* Physics.overlap now supports the 2nd parameter as an array, for when you want to overlap test an object against a number of sprites that aren't all in the same Group.
|
||||||
|
* Math.reverseAngle - reverses an angle (in radians).
|
||||||
|
* Math.normalizeAngle - normalises an angle, now in radians only.
|
||||||
|
* Math.normalizeLatitude - Normalizes a latitude to the [-90,90] range.
|
||||||
|
* Math.normalizeLongitude - Normalizes a longitude to the [-180,180] range.
|
||||||
|
* Phaser.Line added to the geometry classes, with full point on line/segment and intersection tests (see new examples)
|
||||||
|
* Phaser.CANVAS_PX_ROUND is a boolean. If 'true' the Canvas renderer will Math.floor() all coordinates before drawImage, stopping pixel interpolation. Defaults to false.
|
||||||
|
* Phaser.CANVAS_CLEAR_RECT is a boolean. If 'true' (the default) it will context.clearRect() every frame. If false this is skipped (useful if you know you don't need it)
|
||||||
|
* Collision now works between Sprites positioned via sprite.x/y, sprite.body.x/y or sprite.body.velocity.
|
||||||
|
* If you are tweening a sprite and still want physics collision, set `sprite.body.moves = false` otherwise it will fight against the tween motion.
|
||||||
|
* Game.enableStep will enable core game loop stepping. When enabled you must call game.step() directly (perhaps via a DOM button?), very useful for debugging!
|
||||||
|
* Game.disableStep turns core update loop stepping off.
|
||||||
|
* Debug.renderPhysicsBody(body, color) is extremely useful for debugging the new physics bodies. Will draw the outline + points in the color given.
|
||||||
|
* Debug.renderBodyInfo(sprite, x, y, color) will display lots of Sprite body data.
|
||||||
|
* Sprite.events.onBeginContact will be fired when a Body makes contact with another Body. Once contact is over an onEndContact event will be dispatched.
|
||||||
|
|
||||||
|
|
||||||
|
New Examples:
|
||||||
|
|
||||||
|
* Physics - Bounce by Patrick OReilly.
|
||||||
|
* Physics - Bounce with gravity by Patrick OReilly.
|
||||||
|
* Physics - Bounce accelerator (use the keyboard) by Patrick OReilly.
|
||||||
|
* Physics - Bounce knock (use the keyboard) by Patrick OReilly.
|
||||||
|
* Physics - Snake (use the keyboard to control the snake like creature) by Patrick OReilly and Richard Davey.
|
||||||
|
* Physics - Launcher - Angry Birds style ball launcher demo by Patrick OReilly.
|
||||||
|
* Physics - Launcher Follow - throw the sprite anywhere in the world by Patrick OReilly.
|
||||||
|
* Physics - Launcher Follow World - an advanced version of the Launcher Follow example by Patrick OReilly.
|
||||||
|
* Input - Touch Joystick example showing how to use the clay.io virtual game controller (thanks gabehollombe)
|
||||||
|
* Games - Matching Pairs by Patrick OReilly.
|
||||||
|
* Games - Simon Says by Patrick OReilly.
|
||||||
|
* Tweens - Example showing how to use the tween events, onStart, onLoop and onComplete.
|
||||||
|
* Display - Pixi Render Texture. A Phaser conversion of the Pixi.js Render Texture example.
|
||||||
|
* Input - 5 new examples showing how to use the Gamepad API (thanks Karl Macklin)
|
||||||
|
* Animation - Group Creation, showing how to create animations across all Group children in one call.
|
||||||
|
* Particles - Rain by Jens Anders Bakke.
|
||||||
|
* Particles - Snow by Jens Anders Bakke.
|
||||||
|
* Groups - Nested Groups - showing how to embed one Group into another Group.
|
||||||
|
* Time - Lots of new examples showing how to use the updated Phaser.Timer class.
|
||||||
|
|
||||||
|
|
||||||
|
Updates:
|
||||||
|
|
||||||
|
* Updated to latest Pixi.js dev branch build (pre 1.4 release)
|
||||||
|
* When a Sprite is destroyed any active filters are removed at the same time.
|
||||||
|
* Updated Pixi.js so that removing filters now works correctly without breaking the display list.
|
||||||
|
* Phaser.Canvas.create updated so it can be given an ID as the 3rd parameter (can also be set via new Game configuration object).
|
||||||
|
* Updated display/fullscreen example to reflect new full screen change.
|
||||||
|
* Loads of updates to the TypeScript definitions files - games fully compile now and lots of missing classes added :) (thanks Niondir)
|
||||||
|
* Removed 'null parent' check from Group constructor. Will parent to game.world only if parent value is undefined.
|
||||||
|
* The tutorials have now been translated into Spanish - thanks feiss :)
|
||||||
|
* separateY updated to re-implement the 'riding platforms' special condition (thanks cocoademon)
|
||||||
|
* SoundManager.onSoundDecode now dispatches the key followed by the sound object, also now dispatched by the Cache when doing an auto-decode on load.
|
||||||
|
* Switch method of using trimmed sprites to support scaling and rotation (thanks cocoademon)
|
||||||
|
* Most of the GameObjectFactory functions now have a group parameter, so you can do: game.add.sprite(x, y, frame, frameName, group) rather than defaulting to the World group.
|
||||||
|
* Group.countLiving and countDead used to return -1 if the Group was empty, but now return 0.
|
||||||
|
* Text can now be fixedToCamera, updated world/fixed to camera example to show this.
|
||||||
|
* ArcadePhysics.overlap and collide now recognise TileSprites in the collision checks.
|
||||||
|
* Lots of documentation fixes in the Tween class.
|
||||||
|
* Tweens fire an onLoop event if they are set to repeat. onComplete is now only fired for the final repeat (or never if the repeat is infinite)
|
||||||
|
* Pointer used to un-pause a paused game every time it was clicked/touched (this avoided some rogue browser plugins). Now only happens if Stage.disableVisibilityChange is true.
|
||||||
|
* Input doesn't set the cursor to default if it's already set to none.
|
||||||
|
* You can now collide a group against itself. This will check all children against each other, but not themselves (thanks cocoademon)
|
||||||
|
* RenderTexture.render / renderXY has a new parameter: renderHidden, a boolean which will allow you to render Sprites even if their visible is set to false.
|
||||||
|
* Added in prototype.constructor definitions to every class (thanks darkoverlordofdata)
|
||||||
|
* Group.destroy has a new parameter: destroyChildren (boolean) which will optionally call the destroy method of all Group children.
|
||||||
|
* Button.clearFrames method has been added.
|
||||||
|
* Device.quirksMode is a boolean that informs you if the page is in strict (false) or quirks (true) mode.
|
||||||
|
* Canvas.getOffset now runs a strict/quirks check and uses document.documentElement when calculating scrollTop and scrollLeft to avoid Chrome console warnings.
|
||||||
|
* The Time class now has its own Phaser.Timer which you can access through game.time.events. See the new Timer examples to show how to use them.
|
||||||
|
* Added StateManager.getCurrentState to return the currently running State object (thanks Niondir)
|
||||||
|
* Removed the console.log redirect from Utils as it was messing with Firefox.
|
||||||
|
* Body.acceleration is now much smoother and less eratic at high speeds.
|
||||||
|
* Removed ArcadePhysics binding to the QuadTree, so it can now be used independantly of the physics system.
|
||||||
|
* Removed ArcadePhysics.preUpdate and postUpdate as neither are needed any more.
|
||||||
|
* Body.bottom and Body.right are no longer rounded, so will give accurate sub-pixel values.
|
||||||
|
* Fixed lots of documentation in the Emitter class.
|
||||||
|
* The delta timer value used for physics calculations has had its cap limit modified from 1.0 to 0.05 in line with the core updates.
|
||||||
|
* Phaser.Math.min enhanced so you can now pass in either an array of numbers or lots of numbers as parameters to get the lowest.
|
||||||
|
* Phaser.Math.max added as the opposite of Math.min.
|
||||||
|
* Phaser.Math.minProperty and maxProperty added. Like Math.min/max but can be given a property an an array or list of objects to inspect.
|
||||||
|
* Added 'full' paramter to Body.reset, allowing you to control if motion or all data is reset or not.
|
||||||
|
* Exposed Group.pivot and Sprite.pivot to allow you to directly set the pivot points for rotation.
|
||||||
|
* Swapped to using the native and faster Array.isArray check.
|
||||||
|
* Added callback context parameter to Tween.onUpdateCallback(callback, context) to avoid having to bind or create anonymous functions.
|
||||||
|
* Updated TweenManager.removeAll so it flags all tweens as pendingDelete rather than nuking the array, to avoid tween callback array size errors (thanks DarkDev)
|
||||||
|
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
|
||||||
|
* Cache.getImageKeys returned __missing in the array, now excluded.
|
||||||
|
* Fixed Group.scale so you can now scale a Group directly.
|
||||||
|
* Removed World.scale as it was preventing Group.scale from working - you can still scale the world, but you'll need to factor in Input changes yourself.
|
||||||
|
* Moved 'dirty' flag for Tilemap to a per-layer flag. Fixes #242
|
||||||
|
* Group.length now returns the number of children in the Group regardless of their exists/alive state, or 0 if the Group has no children.
|
||||||
|
* Switch Camera.setBoundsToWorld to match world.bounds instead of world (thanks cocoademon)
|
||||||
|
* Fixed an issue where passing null as the Group parent wouldn't set it to game.world as it should have (thanks tito100)
|
||||||
|
* Fixed Pixi bug (#425) incorrect width property for multi-line BitmapText (thanks jcd-as)
|
||||||
|
* Tween.onStart is now called when the tween starts AFTER the delay value, if given (thanks stevenbouma)
|
||||||
|
* Sprites that are fixedToCamera can now be input dragged regardless of world position (thanks RafaelOliveira)
|
||||||
|
* RenderTexture now displays correctly in Canvas games.
|
||||||
|
* Canvas.addToDOM is now more robust when applying the overflowHidden style.
|
||||||
|
* Fixed Pixi.StripShader which should stop the weird TileSprite GPU issues some were reporting (thanks GoodboyDigital)
|
||||||
|
* Patched desyrel.xml so it doesn't contain any zero width/height characters, as they broke Firefox 25.
|
||||||
|
* Cache.addSound now implements a locked attribute (thanks haden)
|
||||||
|
* Sound now checks for CocoonJS during playback to avoid readyState clash (thanks haden)
|
||||||
|
* Buttons now clear previously set frames correctly if you call setFrames.
|
||||||
|
* Sounds will now loop correctly if they are paused and resumed (thanks haden)
|
||||||
|
* InputHandler.checkBoundsRect and checkBoundsSprite now take into account if the Sprite is fixedToCamera or not.
|
||||||
|
* Removed the frame property from TileSprites as it cannot use them, it tiles the whole image only, not just a section of it.
|
||||||
|
* Fixed WebGLRenderer updateGraphics bug (thanks theadam)
|
||||||
|
* Removed duplicate Timer.create line (thanks hstolte)
|
||||||
|
* Fixed issue with the camera being slightly out of sync with 'fixedToCamera' sprites.
|
||||||
|
* 1px camera jitter issue fixed where map is same size, or smaller than the game size.
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.1.3 - "Arafel" - November 29th 2013
|
||||||
|
---------------------------------------------
|
||||||
|
|
||||||
|
New features:
|
||||||
|
|
||||||
|
* Phaser.Filter. A new way to use the new WebGL shaders/filters that the new version of Pixi supports.
|
||||||
|
* Phaser.BitmapData object. A Canvas you can freely draw to with lots of functions. Can be used as a texture for Sprites. See the new examples and docs for details.
|
||||||
|
* The entire Phaser library has been updated to match the new JSHint configuration.
|
||||||
|
* Added a .jshintrc so contributions can be run through JSHint to help retain formatting across the library (thanks kevinthompson)
|
||||||
|
* Added a new in-built texture. Sprites now use __default if no texture was provided (a 32x32 transparent PNG) or __missing if one was given but not found (a 32x32 black box with a green cross through it)
|
||||||
|
* Loader can now load JavaScript files. Just use game.load.script('key', 'url') - the file will be turned into a script tag in the document head on successful load.
|
||||||
|
* RenderTexture.render now takes a Phaser.Group. Also added renderXY for when you don't want to make a new Point object.
|
||||||
|
* Physics.overlap now supports Sprites, Groups or Emitters and can perform group vs. group (etc) overlap checks with a custom callback and process handler.
|
||||||
|
* Added Sound.externalNode which allows you to connect a Sound to an external node input rather than the SoundManager gain node.
|
||||||
|
* Added SoundManager.connectToMaster boolean. Used in conjunction with Sound.externalNode you can easily configure audio nodes to connect together for special effects.
|
||||||
|
* PluginManager.remove, added PluginManager.removeAll (thanks crazysam)
|
||||||
|
* scrollFactorX/scrollFactorY have been added to TilemapLayers (thanks jcd-as)
|
||||||
|
* Phaser.Game parent can now be an HTMLElement or a string (thanks beeglebug)
|
||||||
|
* Now using the latest version of Pixi.js. Which means you can use all the sexy new WebGL filters :)
|
||||||
|
* Sprite.animations.getAnimation will return an animation instance which was added by name.
|
||||||
|
* Added Mouse.button which is set to the button that was pressed: Phaser.Mouse.LEFT_BUTTON, MIDDLE_BUTTON or RIGHT_BUTTON (thanks wKLV)
|
||||||
|
* Added Mouse.pointerLock signal which you can listen to whenever the browser enters or leaves pointer lock mode.
|
||||||
|
* StageScaleMode.forceOrientation allows you to lock your game to one orientation and display a Sprite (i.e. a "please rotate" screen) when incorrect.
|
||||||
|
* World.visible boolean added, toggles rendering of the world on/off entirely.
|
||||||
|
* Polygon class & drawPolygon method added to Graphics (thanks rjimenezda)
|
||||||
|
* Added Group.iterate, a powerful way to count or return children that match a certain criteria. Refactored Group to use iterate, lots of repeated code cut.
|
||||||
|
* Added Group.sort. You can now sort the Group based on any given numeric property (x, y, health), finally you can do depth-sorting :) Example created to show.
|
||||||
|
* Enhanced renderTexture so it can accept a Phaser.Group object and improved documentation and examples.
|
||||||
|
* Device.littleEndian boolean added. Only safe to use if the browser supports TypedArrays (which IE9 doesn't, but nearly all others do)
|
||||||
|
* You can now call game.sound.play() and simply pass it a key. The sound will play if the audio system is unlocked and optionally destroy itself on complete.
|
||||||
|
* Mouse.capture is a boolean. If set to true then DOM mouse events will have event.preventDefault() applied, if false they will propogate fully.
|
||||||
|
* The object returned by Math.sinCosGenerator now contains a length property.
|
||||||
|
|
||||||
|
Updates:
|
||||||
|
|
||||||
|
* Lots of documentation fixes and updates across nearly all files. Tilemap now documented for example and lots of instances of 'Description' filled out.
|
||||||
|
* ArcadePhysics.updateMotion applies the dt to the velocity calculations as well as position now (thanks jcs)
|
||||||
|
* RequestAnimationFrame now retains the callbackID which is passed to cancelRequestAnimationFrame.
|
||||||
|
* Button now goes back to over state when setFrames used in action (thanks beeglebug)
|
||||||
|
* plugins now have a postUpdate callback (thanks cocoademon)
|
||||||
|
* Tided up the Graphics object (thanks BorisKozo)
|
||||||
|
* If running in Canvas mode and you have a render function it will save the context and reset the transform before running your render function.
|
||||||
|
* Sprite will now check the exists property of the Group it is in, if the Group.exists = false the Sprite won't update.
|
||||||
|
* If you specify 'null' as a Group parent it will now revert to using the World as the parent (before only 'undefined' worked)
|
||||||
|
* Skip preupdate/update for PIXI hierarchies in which an ancestor doesn't exist (thanks cocoademon)
|
||||||
|
* Loader.audio can now accept either an array of URL strings or a single URL string (thanks crazysam + kevinthompson)
|
||||||
|
* MSPointer updated to support IE11 by dropping the prefix from the event listeners.
|
||||||
|
* Device.cocoonJS added to detect if the game is running under Cocoon or a native browser.
|
||||||
|
* Loader now uses a new queue system internally, meaning you can have assets with the same key spread across different types.
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
|
||||||
|
* Lots of fixes to the TypeScript definitions file (many thanks gltovar)
|
||||||
|
* Tilemap commands use specified layer when one given (thanks Izzimach)
|
||||||
|
* Mouse.stop now uses the true useCapture, which means the event listeners stop listening correctly (thanks beeglebug)
|
||||||
|
* Input Keyboard example fix (thanks Atrodilla)
|
||||||
|
* BitmapText.destroy now checks if it has a canvas before calling parentNode on it.
|
||||||
|
* Group.swap had a hellish to find bug that only manifested when B-A upward swaps occured. Hours of debugging later = bug crushed.
|
||||||
|
* Point.rotate asDegrees fixed (thanks BorisKozo)
|
||||||
|
* ArcadePhysics.separateTile wasn't returning the value, so the custom process callback wasn't getting called (thanks flameiguana)
|
||||||
|
* StageScaleMode.forceOrientation now correctly stores the forcePortrait value (thanks haden)
|
||||||
|
* Fixes to Math and Loader (thanks theJare)
|
||||||
|
* Tween - isRunning not reset when non-looped tween completes (thanks crazysam + kevinthompson)
|
||||||
|
* Math.normalizeAngle and Math.wrapAngle (thanks theJare)
|
||||||
|
* Device.isTouch modified to test maxTouchPointers instead of MSPointer.
|
||||||
|
* InputHandler.checkPointerOver now checks the visible status of the Sprite Group before processing.
|
||||||
|
* The Sprite hulls (used for tile collision) were not being updated in sprite->sprite separations (thanks jcs)
|
||||||
|
* Plugins that had a postUpdate but no Update weren't being marked as active (thanks crazysam)
|
||||||
|
* StateManager.onPausedCallback function is not called when the game is paused (thanks haden)
|
||||||
|
* Fix for 'jitter' in scrolling where tilemaps & sprites are one frame off (thanks jcs)
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.1.2 - November 1st 2013
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
* New: You'll now find a complete Basic project Template in the resources/Project Templates folder. Will add more complex ones soon.
|
||||||
|
* New: Phaser.Button now has the ability to set over/out/up/down sound effects so they play automatically based on those events.
|
||||||
|
* New: Added init method to plugins, to be called as they are added to the PluginManager (thanks beeglebug)
|
||||||
|
* New: Physics.Body now has a center property (issue 142, thanks MikeMnD)
|
||||||
|
* New: Lots of fixes across Full Screen Mode support. Input now works, scaling restores properly, world scale is correct and anti-alias support added.
|
||||||
|
* New: Added Group.cursor. This points to the first item added to a Group. You can move the cursor with Group.next() and Group.previous().
|
||||||
|
* New: Added Tween.isTweening(object) to check if an object is currently being tweened or not (thanks mikehamil10)
|
||||||
|
* New: Added getMagnitude, setMagnitude, normalize and isZero methods to Point (thanks beeglebug)
|
||||||
|
* New/Change: Group.callAll now supports nested functions and a context, making it really powerful!
|
||||||
|
* Updated: Fixed a few final bugs in the Sprite body and bounds calculations, in turn this resolved the Tilemap collision issues in the 1.1 release.
|
||||||
|
* Updated: Finished documentation for the Phaser.Button class.
|
||||||
|
* Updated: Fixed the Invaders game sample and enhanced it.
|
||||||
|
* Updated: Fixed the Star Struck game sample and enhanced it.
|
||||||
|
* Updated: If you pause an Animation, when you next play it it'll resume (un-pause itself).
|
||||||
|
* Updated: hexToRGB now accepts short hex codes (#EEE) (thanks beeglebug)
|
||||||
|
* Updated: State functions (preload, update, render, etc) are now passed the current game as a parameter (thanks beeglebug)
|
||||||
|
* Updated: If your game is running in Canvas (not WebGL) you can now set Stage.backgroundColor to rgba style CSS strings, allowing for semi-transparent game backgrounds.
|
||||||
|
* Updated: event.preventDefault() has been added to all Mouse event handlers.
|
||||||
|
* Updated: Sprite.deltaX/Y removed due to non-use. prevX/Y values moved to Sprite._cache.prevX/Y.
|
||||||
|
* Updated: Due to missing extends parameter the Sprite prototype was picking up functions from classes it never meant to (Button, TilemapLayer), now fully isolated.
|
||||||
|
* Fixed issue 135 - Added typeof checks into most ArcadePhysics functions to avoid errors with zero values.
|
||||||
|
* Fixed issue 136 - distanceTo using worldX/Y instead of x/y.
|
||||||
|
* Fixed lots of examples where the cursor keys / space bar were not locked from moving the browser page (if you find any more, please tell us!)
|
||||||
|
* Fixed issue 149 - Starling XML files now load properly again, also created an Example to show use of them (thanks haden)
|
||||||
|
* Fixed an issue where if the Starling XML file didn't contain a frameX/Y value it would crash on import.
|
||||||
|
* Fixed the Multiple Animations Example - it's now a lovely underwater scene :)
|
||||||
|
* Fixed issue 141 - If a Sprite is dragged and you release the Pointer while not over the Sprite, it will think it's still over it (thanks Paratron)
|
||||||
|
* Fixed issue 88 - Incorrect game.input.x/y values on click with scaled stage (thanks DrHackenstein)
|
||||||
|
* Fixed issue 143 - Entering full screen mode made the Input x/y coordinates go wrong.
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.1.1 - October 26th 2013
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
* Quick patch to get Phaser.AUTO working again on Firefox / Android.
|
||||||
|
* Any key added via addKey now automatically adds it to the capture list.
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.1 - October 25th 2013
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
What's New:
|
||||||
|
|
||||||
|
* JSDoc is go! We've added jsdoc3 blocks to every property and function, in every file and published the API docs to the docs folder.
|
||||||
|
* Brand new Example system (no more php!) and over 150 examples to learn from too.
|
||||||
|
* New TypeScript definitions file generated (in the build folder - thanks to TomTom1229 for manually enhancing this).
|
||||||
|
* New Grunt based build system added (thanks to Florent Cailhol)
|
||||||
|
* New: Phaser.Animation.generateFrameNames - really useful when creating animation data from texture atlases using file names, not indexes.
|
||||||
|
* Added Sprite.play as a handy short-cut to play an animation already loaded onto a Sprite.
|
||||||
|
* Added Canvas.setUserSelect() to disable touchCallouts and user selections within the canvas.
|
||||||
|
* Added Keyboard.addKey() which creates a new Phaser.Key object that can be polled for updates, pressed states, etc. See the 2 new examples showing use.
|
||||||
|
* Added Button.freezeFrames boolean. Stops the frames being set on mouse events if true.
|
||||||
|
* Extended the Loader 404 error to display the url of the file that didn't load as well as the key.
|
||||||
|
* New: Direction constants have been added to Sprites and adjust based on body motion.
|
||||||
|
* Brand new Sprite.update loop handler. Combined with the transform cache fix and further optimisations this is now much quicker to execute.
|
||||||
|
* Added Keyboard.createCursorKeys() which creates an object with 4 Key objects inside it mapped to up, down, left and right. See the new example in the input folder.
|
||||||
|
* Added Body.skipQuadTree boolean for more fine-grained control over when a body is added to the World QuadTree.
|
||||||
|
* Re-implemented Angular Velocity and Angular Acceleration on the Sprite.body and created 2 new examples to show use.
|
||||||
|
* Added Sprite.fixedToCamera boolean. A Sprite that is fixed to the camera doesn't move with the world, but has its x/y coordinates relative to the top-left of the camera.
|
||||||
|
* Added Group.createMultiple - useful when you need to create a Group of identical sprites for pooling, such as bullets.
|
||||||
|
* Added Group.total. Same as Group.length, but more in line with the rest of the Group naming.
|
||||||
|
* Added Sprite.outOfBoundsKill boolean flag. Will automatically kill a sprite that leaves the game World bounds (off by default).
|
||||||
|
* Lots of changes and fixes in ArcadePhysics, including:
|
||||||
|
* Functions with "mouse" in the title have been updated to "pointer" to more accurately reflect what they do.
|
||||||
|
* New velocity functions: moveToObject, moveToPointer, moveToXY
|
||||||
|
* New acceleration functions: accelerateToObject, accelerateToPointer, accelerateToXY
|
||||||
|
* New distance functions: distanceBetween, distanceToXY, distanceToPointer
|
||||||
|
* New angle functions: angleBetween, angleToXY, angleToPointer
|
||||||
|
* velocityFromAngle and velocityFromRotation added with examples created.
|
||||||
|
* Added killOnComplete parameter to Animation.play. Really useful in situations where you want a Sprite to animate once then kill itself on complete, like an explosion effect.
|
||||||
|
* Added Sprite.loadTexture(key, frame) which allows you to load a new texture set into an existing sprite rather than having to create a new sprite.
|
||||||
|
* Added Sprite.destroy back in again and made it a lot more robust at cleaning up child objects.
|
||||||
|
* Added 'return this' to all the core Loader functions so you can chain load calls if you so wish.
|
||||||
|
* Added Text.destroy() and BitmapText.destroy(), also updated Group.remove to make it more bullet-proof when an element doesn't have any events.
|
||||||
|
* Added Phaser.Utils.shuffle to shuffle an array.
|
||||||
|
* Added Graphics.destroy, x, y and updated angle functions.
|
||||||
|
* Added AnimationManager.refreshFrame - will reset the texture being used for a Sprite (useful after a crop rect clear)
|
||||||
|
* Added Physics.overlap(sprite1, sprite2) for quick body vs. body overlap tests with no separation performed.
|
||||||
|
* On a busy page it's possible for the game to boot with an incorrect stage offset x/y which can cause input events to be calculated wrong. A new property has been added to Stage to combat this issue: Stage.checkOffsetInterval. By default it will check the canvas offset every 2500ms and adjust it accordingly. You can set the value to 'false' to disable the check entirely, or set a higher or lower value. We recommend that you get the value quite low during your games preloader, but once the game has fully loaded hopefully the containing page will have settled down, so it's probably safe to disable the check entirely.
|
||||||
|
* Added Rectangle.floorAll to floor all values in a Rectangle (x, y, width and height).
|
||||||
|
|
||||||
|
What's changed:
|
||||||
|
|
||||||
|
* Renamed Phaser.Text.text to Phaser.Text.content to avoid conflict and overwrite from Pixi local var.
|
||||||
|
* Renamed Phaser.Text.style to Phaser.Text.font to avoid conflict and overwrite from Pixi local var.
|
||||||
|
* Phaser.Button now sets useHandCursor to true by default.
|
||||||
|
* Change: When you start a new State all active tweens are now purged.
|
||||||
|
* When the game boots it will now by default disable user-select and touch action events on the game canvas.
|
||||||
|
* Moved LinkedList.dump to Debug.dumpLinkedList(list)
|
||||||
|
* Phaser.Animation.Frame is now Phaser.Frame
|
||||||
|
* Phaser.Animation.FrameData is now Phaser.FrameData
|
||||||
|
* Phaser.Animation.Parser is now Phaser.AnimationParser (also the file has renamed from Parser.js to AnimationParser.js)
|
||||||
|
* Phaser.Loader.Parser is now Phaser.LoaderParser (also the file has renamed from Parser.js to LoaderParser.js)
|
||||||
|
* Change: We've removed the scrollFactor property from all Game Objects. Sorry, but the new Camera system doesn't work with it and it caused all kinds of issues anyway. We will sort out a replacement for it at a later date.
|
||||||
|
* Change: World now extends Phaser.Group. As a result we've updated GameObjectFactory and other classes that linked to it. If you have anywhere in your code that used to reference world.group you can just remove 'group' from that. So before, world.group.add() is now just world.add().
|
||||||
|
* Change: The Camera has been completely revamped. Rather than adjusting the position of all display objects (bad) it now just shifts the position of the single world container (good!), this is much quicker and also stops the game objects positions from self-adjusting all the time, allowing for them to be properly nested with other containers.
|
||||||
|
* Made Sprite.body optional and added in checks, so you can safely null the Sprite body object if using your own physics system and not impact rendering.
|
||||||
|
* Moved the Camera update checks to World.postUpdate, so all the sprites get the correct adjusted camera position.
|
||||||
|
* The default Game.antialias value is now 'true', so graphics will be smoothed automatically in canvas. Disable it via the Game constructor or Canvas utils.
|
||||||
|
* Phaser.Group now automatically calls updateTransform on any child added to it (avoids temp. frame glitches when new objects are rendered on their first frame).
|
||||||
|
|
||||||
|
What has been updated:
|
||||||
|
|
||||||
|
* Complete overhaul of Physics.Arcade.Body - now significantly more stable and faster too.
|
||||||
|
* Updated ArcadePhysics.separateX/Y to use new body system - much better results now.
|
||||||
|
* Added World.postUpdate - all sprite position changes, as a result of physics, happen here before the render.
|
||||||
|
* Added Animation.paused - can be set to true/false.
|
||||||
|
* Added support for Body.maxVelocity (thanks cocoademon)
|
||||||
|
* InputHandler now creates the _pointerData array on creation and populates with one empty set of values, so pointerOver etc all work before a start call.
|
||||||
|
* Removed the callbackContext parameter from Group.callAll because it's no longer needed.
|
||||||
|
* Updated Group.forEach, forEachAlive and forEachDead so you can now pass as many parameters as you want, which will all be given to the callback after the child.
|
||||||
|
* Updated build script so it can be run from the command-line and includes UMD wrappers (thanks iaincarsberg)
|
||||||
|
* World.randomX/Y now returns values anywhere in the world.bounds range (if set, otherwise 0), including negative values.
|
||||||
|
* Updated InputHandler to use Math.round rather than Math.floor when snapping an object during drag.
|
||||||
|
* If you didn't provide the useNumericIndex parameter then AnimationManager.add will set the value by looking at the datatype of the first element in the frames array.
|
||||||
|
* Group.create now sets the visible and alive properties of the Sprite to the same value as the 'exists' parameter.
|
||||||
|
* World.randomX/Y now works with negative World.bounds values.
|
||||||
|
* Tweens .to will now always return the parent (thanks powerfear)
|
||||||
|
* You can now pass a PIXI.Texture to Sprite (you also need to pass a Phaser.Frame as the frame parameter) but this is useful for Sprites sharing joint canvases.
|
||||||
|
* Group.alpha is now exposed publically and changes the Group container object (not the children directly, who can still have their own alpha values)
|
||||||
|
* Device.webGL uses new inspection code to accurately catch more webGL capable devices.
|
||||||
|
* Debug.renderSpriteBody updated to use a the new Sprite.Body.screenX/Y properties.
|
||||||
|
* Additional checks added to AnimationManager.frame/frameName on the given values.
|
||||||
|
* You can now null a Sprite.crop and it will clear down the crop rect area correctly.
|
||||||
|
* Phaser.Time physicsElapsed delta timer clamp added. Stops rogue iOS / slow mobile timer errors causing crazy high deltas.
|
||||||
|
* Animation.generateFrameNames can now work in reverse, so the start/stop values can create frames that increment or decrement respectively.
|
||||||
|
* Loader updated to use xhr.responseText when loading json, csv or text files. xhr.response is still used for Web Audio binary files (thanks bubba)
|
||||||
|
* Input.onDown and onUp events now dispatch the original event that triggered them (i.e. a MouseEvent or TouchEvent) as the 2nd parameter, after the Pointer (thanks rezoner)
|
||||||
|
* Updated Sprite.crop significantly. Values are now cached, stopping constant Texture frame updates and you can do sprite.crop.width++ for example (thanks haden)
|
||||||
|
* Change: Sprite.crop needs to be enabled with sprite.cropEnabled = true.
|
||||||
|
* Sprite.loadTexture now works correctly with static images, RenderTextures and Animations.
|
||||||
|
* Lots of fixes within Sprite.bounds. The bounds is now correct regardless of rotation, anchor or scale of the Sprite or any of its parent objects.
|
||||||
|
|
||||||
|
What has been fixed:
|
||||||
|
|
||||||
|
* QuadTree bug found in 1.0.5 now fixed. The QuadTree is updated properly now using localTransform values.
|
||||||
|
* Fixed the Bounce.In and Bounce.InOut tweens (thanks XekeDeath)
|
||||||
|
* Fixed an issue in Animation.update where if the game was paused it would get an insane delta timer throwing a uuid error.
|
||||||
|
* Added PixiPatch.js to patch in a few essential features until Pixi is updated.
|
||||||
|
* Fixed issue in Animation.play where the given frameRate and loop values wouldn't overwrite those set on construction.
|
||||||
|
* Fixed small bug stopping Tween.pause / resume from resuming correctly when called directly.
|
||||||
|
* Fixed an issue where Tweens.removeAll wasn't clearing tweens in the addition queue.
|
||||||
|
* Fixed Particle Emitters when using Emitter width/height (thanks XekeDeath)
|
||||||
|
* Made animation looping more robust when skipping frames (thanks XekeDeath)
|
||||||
|
* Fix for incorrect new particle positioning (issue #73) (thanks cottonflop)
|
||||||
|
* Fixed issue in Sound.play where if you gave a missing marker it would play the whole sound sprite instead.
|
||||||
|
* Button.setFrames will set the current frame based on the button state immediately.
|
||||||
|
* Loaded.setPreloadSprite now rounds the width/height values and starts from 1. This fixes canvas draw errors in IE9/10 and Firefox.
|
||||||
|
* Fixed issue causing Keyboard.justPressed to always fire (thanks stemkoski)
|
||||||
|
* Fixed bug in LinkedList#remove that could cause first to point to a dead node (thanks onedayitwillmake)
|
||||||
|
* Fixed Cache.addDefaultImage so the default image works in Canvas as well as WebGL. Updated to a new image (32x32 black square with green outline)
|
||||||
|
* Fixed a bug in the Sprite transform cache check that caused the skew/scale cache to get constantly invalidated - now only updates as needed, significant performance increase!
|
||||||
|
* Fixed typo in StageScaleMode so it's not pageAlignVeritcally any longer, but pageAlignVertically.
|
||||||
|
* Fixed issue in Group.countLiving / countDead where the value was off by one (thanks mjablonski)
|
||||||
|
* Fixed issue with a jittery Camera if you moved a Sprite via velocity instead of x/y placement.
|
||||||
|
* Fixed the RandomDataGenerator.sow method so if you give in the same seed you'll now get the same results (thanks Hsaka)
|
||||||
|
* Fixed Issue #101 (Mouse Button 0 is not recognised, thanks rezoner)
|
||||||
|
* Fixed an issue where creating an animation with just one frame with an index of zero would cause a UUID error (thanks SYNYST3R1)
|
||||||
|
* Fixed Rectangle.union (thanks andron77)
|
||||||
|
* Fixed Sound.resume so it now correctly resumes playback from the point it was paused (fixes issue 51, thanks Yora).
|
||||||
|
* Fixed issue 105 where a dragged object that was destroyed would cause an Input error (thanks onedayitwillmake)
|
||||||
|
* Fixed Issue 111 - calling Kill on a Phaser.Graphics instance causes error on undefined events.
|
||||||
|
* Game.destroy will now stop the raf from running as well as close down all input related event listeners (issue 92, thanks astrism)
|
||||||
|
* Pixel Perfect click detection now works even if the Sprite is part of a texture atlas.
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.0.6 - September 24th 2013
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
* Added check into Pointer.move to always consider a Sprite that has pixelPerfect enabled, regardless of render ID.
|
||||||
|
* BUG: The pixel perfect click check doesn't work if the sprite is part of a texture atlas yet.
|
||||||
|
* Fixed issue with anti-alias in the Game constructor not being set correctly (thanks luizbills)
|
||||||
|
* Added support for the Graphics game object back in and two examples (thanks earok for spotting)
|
||||||
|
* New: Tweens can now be chained via multiple to() calls + example created (thanks to powerfear for adding)
|
||||||
|
* Fixed Math.wrap (thanks TheJare)
|
||||||
|
* New: When loading a Sprite Sheet you can now pass negative values for the frame sizes which specifies the number of rows/columns to load instead (thanks TheJare)
|
||||||
|
* New: BitmapText now supports anchor and has fixed box dimensions (thanks TheJare)
|
||||||
|
* Fixed bug where if a State contains an empty Preloader the Update will not be called (thanks TheJare)
|
||||||
|
* Several new examples added (cameras, tweens, etc)
|
||||||
|
* Added in extra checks to halt collision if it involves an empty Group (thanks cang)
|
||||||
|
* Added time smoothing to Animation update to help frames hopefully not get too out of sync during long animations with high frame rates.
|
||||||
|
* Added frame skip to Animation.update. If it gets too far behind it will now skip frames to try and catch up.
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.0.5 - September 20th 2013
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
* Fixed issue in FrameData.getFrameIndexes where the input array was being ignored.
|
||||||
|
* Added Math.numberArray - Returns an Array containing the numbers from min to max (inclusive), useful for animation frame construction.
|
||||||
|
* Fixed a horrendously sneaky bug: If a new tween was created in the onComplete callback of a tween about to be deleted, it would get automatically spliced.
|
||||||
|
* Added a pendingDelete property to Tween to stop tweens that were removed during a callback from causing update errors during the TweenManager loop.
|
||||||
|
* Added Group.length property.
|
||||||
|
* Added explicit x/y attributes to Phaser.Text to make it work with the camera system (thanks cocoademon).
|
||||||
|
* Fixed issue stopping multiple animations from playing, only the most recent would play (frames array was being overwritten, thanks Legrandk)
|
||||||
|
* Updated Debug.renderSpriteBounds() so it doesn't use the deprecated Sprite.worldView any more (thanks MikeMnD)
|
||||||
|
* Added 2 new properties to the Text object: Text.text and Text.style, both are getter/setters and don't flag dirty unless changed, so safe for core loop use.
|
||||||
|
* Removed the exists check from Group.callAll, it now runs on all children (as the name implies)
|
||||||
|
* Added Group.callAllExists - you can now call a function on all children who have exists = the provided boolean.
|
||||||
|
* Finished off the Breakout example game - now fully playable, proper rebound, scoring, lives, etc.
|
||||||
|
* Removed Group.sort dummy entry until it's working.
|
||||||
|
* Removed ArcadePhysics.postUpdate.
|
||||||
|
* Updated Sprite.update to set renderable to false when the object goes out of Camera, not 'visible' false, otherwise it stops the transform being updated by Pixi.
|
||||||
|
* BUG: There is a known issue where the wrong rect coordinates are given to the QuadTree if the Sprite is a child of a Group or another Sprite which has an x/y offset.
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.0.4 - September 18th 2013
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
* Small fix to Phaser.Canvas to stop it from setting overflow hidden if the parent DOM element doesn't exist.
|
||||||
|
* Added Loader.setPreloadSprite(sprite, direction) - this will automatically apply a crop rect to the Sprite which is updated in line with the load progress.
|
||||||
|
* A lot of changes inside the StateManager. State functions are now passed through link() which automatically creates the key Game properties (load, input, etc)
|
||||||
|
* Fixed a bug in getFrameByName that wouldn't return the first frame in the array.
|
||||||
|
* Updated Phaser.Rectangle.intersects to use x and y instead of left and top so it can be used to check Physics bodies overlapping.
|
||||||
|
* Fixed issue in Cache where the Frame index wasn't being set correctly (thanks Cameron)
|
||||||
|
* Fixed issue in Sprite where boundsY wasn't set (thanks Cameron)
|
||||||
|
* For some reason there were 2 copies of the Canvas class in the build file - fixed, a few KB saved :)
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.0.3 - September 17th 2013
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
* FrameData.getFrameIndexes and getFrameIndexesByName refactored into a more versatile getFrames function.
|
||||||
|
* Various fixes to looping parameters in the Sound system.
|
||||||
|
* Documentation started across most classes. Keep track of progress in the Docs folder.
|
||||||
|
* Optimised AnimationManager.add so it will only get the required frames rather than all of them and is now faster at parsing the frame data.
|
||||||
|
* Fixed Phaser.Text and Phaser.BitmapText so they now render correctly and added several Text examples.
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.0.2 - September 16th 2013
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
* Added optional parameter to Animation.stop: resetFrame. If true the animation will be stopped and then the current frame reset to the first frame in the animation.
|
||||||
|
* Fixed an issue causing 'explode' particle bursts to ignore the quantity parameter.
|
||||||
|
* Added 'collideWorldBounds' to Emitter.makeParticles function.
|
||||||
|
* Added Emitter.angularDrag
|
||||||
|
* Changed Emitter.bounce from a number to a Point, so now set its x/y properties to control different amounts of bounce per axis.
|
||||||
|
* Fixed a bug in the AnimationManager where useNumericIndex was always set to true
|
||||||
|
* Added in lots of Particle examples
|
||||||
|
* Added in the start of a Breakout game
|
||||||
|
* Added in the start of a Platformer game
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.0.1 - September 15th 2013
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
* Added checks into every Group function to ensure that the Group has children before running them.
|
||||||
|
* Added optional flag to Group.create which allows you to set the default exists state of the Sprites.
|
||||||
|
* Sprite.animation.stop no longer needs an animation name parameter, will default to stopping the current animation.
|
||||||
|
* Fixed the license in package.json
|
||||||
|
* Fixed a logic bug in the separateTileX function that would sometimes cause tunneling of big sprites through small tiles.
|
||||||
|
|
||||||
|
|
||||||
|
Version 0.9.8
|
||||||
|
-------------
|
||||||
|
|
||||||
* Massive refactoring across the entire codebase.
|
* Massive refactoring across the entire codebase.
|
||||||
* Removed Basic and GameObject and put Sprite on a diet. 127 properties and methods cut down to 32.
|
* Removed Basic and GameObject and put Sprite on a diet. 127 properties and methods cut down to 32.
|
||||||
@@ -109,7 +613,8 @@ V0.9.8
|
|||||||
* Added CanvasUtils class, including ability to set image rendering, add a canvas to the dom and other handy things.
|
* Added CanvasUtils class, including ability to set image rendering, add a canvas to the dom and other handy things.
|
||||||
|
|
||||||
|
|
||||||
V0.9.6
|
Version 0.9.6
|
||||||
|
-------------
|
||||||
|
|
||||||
* Virtually every class now has documentation - if you spot a typo or something missing please shout (thanks pixelpicosean).
|
* Virtually every class now has documentation - if you spot a typo or something missing please shout (thanks pixelpicosean).
|
||||||
* Grunt file updated to produce the new Special FX JS file (thanks HackManiac).
|
* Grunt file updated to produce the new Special FX JS file (thanks HackManiac).
|
||||||
@@ -197,7 +702,9 @@ V0.9.6
|
|||||||
* Added the GameObjectFactory to Phaser.State
|
* Added the GameObjectFactory to Phaser.State
|
||||||
* Added new format parameter to Loader.addTextureAtlas defining the format. Currently supported: JSON Array and Starling/Sparrow XML.
|
* Added new format parameter to Loader.addTextureAtlas defining the format. Currently supported: JSON Array and Starling/Sparrow XML.
|
||||||
|
|
||||||
V0.9.5
|
|
||||||
|
Version 0.9.5
|
||||||
|
-------------
|
||||||
|
|
||||||
* Moved the BootScreen and PauseScreen out of Stage into their own classes (system/screens/BootScreen and PauseScreen).
|
* Moved the BootScreen and PauseScreen out of Stage into their own classes (system/screens/BootScreen and PauseScreen).
|
||||||
* Updated the PauseScreen to show a subtle animation effect, making it easier to create your own interesting pause screens.
|
* Updated the PauseScreen to show a subtle animation effect, making it easier to create your own interesting pause screens.
|
||||||
@@ -231,7 +738,9 @@ V0.9.5
|
|||||||
* Added fun new "map draw" test - rebound those carrots! :)
|
* Added fun new "map draw" test - rebound those carrots! :)
|
||||||
* Changed SoundManager class to respect volume on first play (thanks initials and hackmaniac)
|
* Changed SoundManager class to respect volume on first play (thanks initials and hackmaniac)
|
||||||
|
|
||||||
V0.9.4
|
|
||||||
|
Version 0.9.4
|
||||||
|
--------------
|
||||||
|
|
||||||
* Added Tilemap.getTile, getTileFromWorldXY, getTileFromInputXY
|
* Added Tilemap.getTile, getTileFromWorldXY, getTileFromInputXY
|
||||||
* Added Tilemap.setCollisionByIndex and setCollisionByRange
|
* Added Tilemap.setCollisionByIndex and setCollisionByRange
|
||||||
@@ -243,7 +752,9 @@ V0.9.4
|
|||||||
* Fixed: Circle.isEmpty properly checks diameter (thanks bapuna)
|
* Fixed: Circle.isEmpty properly checks diameter (thanks bapuna)
|
||||||
* Updated Gruntfile to export new version of phaser.js wrapped in a UMD block for require.js/commonJS (thanks Hackmaniac)
|
* Updated Gruntfile to export new version of phaser.js wrapped in a UMD block for require.js/commonJS (thanks Hackmaniac)
|
||||||
|
|
||||||
V0.9.3
|
|
||||||
|
Version 0.9.3
|
||||||
|
-------------
|
||||||
|
|
||||||
* Added the new ScrollZone game object. Endlessly useful but especially for scrolling backdrops. Created 6 example tests.
|
* Added the new ScrollZone game object. Endlessly useful but especially for scrolling backdrops. Created 6 example tests.
|
||||||
* Added GameObject.hideFromCamera(cameraID) to stop an object rendering to specific cameras (also showToCamera and clearCameraList)
|
* Added GameObject.hideFromCamera(cameraID) to stop an object rendering to specific cameras (also showToCamera and clearCameraList)
|
||||||
@@ -261,7 +772,9 @@ V0.9.3
|
|||||||
* Removed the need for DynamicTextures to require a key property and updated test cases.
|
* Removed the need for DynamicTextures to require a key property and updated test cases.
|
||||||
* You can now pass an array or a single value to Input.Keyboard.addKeyCapture().
|
* You can now pass an array or a single value to Input.Keyboard.addKeyCapture().
|
||||||
|
|
||||||
V0.9.2
|
|
||||||
|
Version 0.9.2
|
||||||
|
-------------
|
||||||
|
|
||||||
* Fixed issue with create not being called if there was an empty init method.
|
* Fixed issue with create not being called if there was an empty init method.
|
||||||
* Added ability to flip a sprite (Sprite.flipped = true) + a test case for it.
|
* Added ability to flip a sprite (Sprite.flipped = true) + a test case for it.
|
||||||
@@ -269,7 +782,9 @@ V0.9.2
|
|||||||
* Sprite animations don't restart if you call play on them when they are already running.
|
* Sprite animations don't restart if you call play on them when they are already running.
|
||||||
* Added Stage.disablePauseScreen. Set to true to stop your game pausing when the tab loses focus.
|
* Added Stage.disablePauseScreen. Set to true to stop your game pausing when the tab loses focus.
|
||||||
|
|
||||||
V0.9.1
|
|
||||||
|
Version 0.9.1
|
||||||
|
-------------
|
||||||
|
|
||||||
* Added the new align property to GameObjects that controls placement when rendering.
|
* Added the new align property to GameObjects that controls placement when rendering.
|
||||||
* Added an align example to the Sprites test group (click the mouse to change alignment position)
|
* Added an align example to the Sprites test group (click the mouse to change alignment position)
|
||||||
@@ -279,7 +794,8 @@ for new collision system.
|
|||||||
* Game.Input now has 2 signals you can subscribe to for down/up events, see the Sprite align example for use.
|
* Game.Input now has 2 signals you can subscribe to for down/up events, see the Sprite align example for use.
|
||||||
* Updated the States examples to bring in-line with 0.9 release.
|
* Updated the States examples to bring in-line with 0.9 release.
|
||||||
|
|
||||||
V0.9
|
Version 0.9
|
||||||
|
-----------
|
||||||
|
|
||||||
* Large refactoring. Everything now lives inside the Phaser module, so all code and all tests have been updated to reflect this. Makes coding a tiny bit more verbose but stops the framework from globbing up the global namespace. Also should make code-insight work in WebStorm and similar editors.
|
* Large refactoring. Everything now lives inside the Phaser module, so all code and all tests have been updated to reflect this. Makes coding a tiny bit more verbose but stops the framework from globbing up the global namespace. Also should make code-insight work in WebStorm and similar editors.
|
||||||
* Added the new GeomSprite object. This is a sprite that uses a geometry class for display (Circle, Rectangle, Point, Line). It's extremely flexible!
|
* Added the new GeomSprite object. This is a sprite that uses a geometry class for display (Circle, Rectangle, Point, Line). It's extremely flexible!
|
||||||
@@ -290,27 +806,35 @@ V0.9
|
|||||||
* Added new Motion class which contains lots of handy functions like 'moveTowardsObject', 'velocityFromAngle' and more.
|
* Added new Motion class which contains lots of handy functions like 'moveTowardsObject', 'velocityFromAngle' and more.
|
||||||
* Tween Manager added. You can now create tweens via Game.createTween (or for more control game.tweens). All the usual suspects are here: Bounce, * Elastic, Quintic, etc and it's hooked into the core game clock, so if your game pauses and resumes your tweens adjust accordingly.
|
* Tween Manager added. You can now create tweens via Game.createTween (or for more control game.tweens). All the usual suspects are here: Bounce, * Elastic, Quintic, etc and it's hooked into the core game clock, so if your game pauses and resumes your tweens adjust accordingly.
|
||||||
|
|
||||||
V0.8
|
|
||||||
|
Version 0.8
|
||||||
|
-----------
|
||||||
|
|
||||||
* Added ability to set Sprite frame by name (sprite.frameName), useful when you've loaded a Texture Atlas with filename values set rather than using frame indexes.
|
* Added ability to set Sprite frame by name (sprite.frameName), useful when you've loaded a Texture Atlas with filename values set rather than using frame indexes.
|
||||||
* Updated texture atlas 4 demo to show this.
|
* Updated texture atlas 4 demo to show this.
|
||||||
* Fixed a bug that would cause a run-time error if you tried to create a sprite using an invalid texture key.
|
* Fixed a bug that would cause a run-time error if you tried to create a sprite using an invalid texture key.
|
||||||
* Added in DynamicTexture support and a test case for it.
|
* Added in DynamicTexture support and a test case for it.
|
||||||
|
|
||||||
V0.7
|
|
||||||
|
Version 0.7
|
||||||
|
-----------
|
||||||
|
|
||||||
* Renamed FullScreen to StageScaleMode as it's much more fitting. Tested across Android and iOS with the various scale modes.
|
* Renamed FullScreen to StageScaleMode as it's much more fitting. Tested across Android and iOS with the various scale modes.
|
||||||
* Added in world x/y coordinates to the input class, and the ability to get world x/y input coordinates from any Camera.
|
* Added in world x/y coordinates to the input class, and the ability to get world x/y input coordinates from any Camera.
|
||||||
* Added the RandomDataGenerator for seeded random number generation.
|
* Added the RandomDataGenerator for seeded random number generation.
|
||||||
* Setting the game world size now resizes the default camera (optional bool flag)
|
* Setting the game world size now resizes the default camera (optional bool flag)
|
||||||
|
|
||||||
V0.6
|
|
||||||
|
Version 0.6
|
||||||
|
-----------
|
||||||
|
|
||||||
* Added in Touch support for mobile devices (and desktops that enable it) and populated x/y coords in Input with common values from touch and mouse.
|
* Added in Touch support for mobile devices (and desktops that enable it) and populated x/y coords in Input with common values from touch and mouse.
|
||||||
* Added new Circle geometry class (used by Touch) and moved them into a Geom folder.
|
* Added new Circle geometry class (used by Touch) and moved them into a Geom folder.
|
||||||
* Added in Device class for device inspection.
|
* Added in Device class for device inspection.
|
||||||
* Added FullScreen class to enable full-screen support on mobile devices (scrolls URL bar out of the way on iOS and Android)
|
* Added FullScreen class to enable full-screen support on mobile devices (scrolls URL bar out of the way on iOS and Android)
|
||||||
|
|
||||||
V0.5
|
|
||||||
|
Version 0.5
|
||||||
|
-----------
|
||||||
|
|
||||||
* Initial release
|
* Initial release
|
||||||
|
|||||||
@@ -0,0 +1,868 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: animation/AnimationParser.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: animation/AnimationParser.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Responsible for parsing sprite sheet and JSON data into the internal FrameData format that Phaser uses for animations.
|
||||||
|
*
|
||||||
|
* @class Phaser.AnimationParser
|
||||||
|
*/
|
||||||
|
Phaser.AnimationParser = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse a Sprite Sheet and extract the animation frame data from it.
|
||||||
|
*
|
||||||
|
* @method Phaser.AnimationParser.spriteSheet
|
||||||
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
* @param {string} key - The Game.Cache asset key of the Sprite Sheet image.
|
||||||
|
* @param {number} frameWidth - The fixed width of each frame of the animation.
|
||||||
|
* @param {number} frameHeight - The fixed height of each frame of the animation.
|
||||||
|
* @param {number} [frameMax=-1] - The total number of animation frames to extact from the Sprite Sheet. The default value of -1 means "extract all frames".
|
||||||
|
* @param {number} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
|
||||||
|
* @param {number} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
|
||||||
|
* @return {Phaser.FrameData} A FrameData object containing the parsed frames.
|
||||||
|
*/
|
||||||
|
spriteSheet: function (game, key, frameWidth, frameHeight, frameMax, margin, spacing) {
|
||||||
|
|
||||||
|
// How big is our image?
|
||||||
|
var img = game.cache.getImage(key);
|
||||||
|
|
||||||
|
if (img == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var width = img.width;
|
||||||
|
var height = img.height;
|
||||||
|
|
||||||
|
if (frameWidth <= 0)
|
||||||
|
{
|
||||||
|
frameWidth = Math.floor(-width / Math.min(-1, frameWidth));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frameHeight <= 0)
|
||||||
|
{
|
||||||
|
frameHeight = Math.floor(-height / Math.min(-1, frameHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
var row = Math.round(width / frameWidth);
|
||||||
|
var column = Math.round(height / frameHeight);
|
||||||
|
var total = row * column;
|
||||||
|
|
||||||
|
if (frameMax !== -1)
|
||||||
|
{
|
||||||
|
total = frameMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zero or smaller than frame sizes?
|
||||||
|
if (width === 0 || height === 0 || width < frameWidth || height < frameHeight || total === 0)
|
||||||
|
{
|
||||||
|
console.warn("Phaser.AnimationParser.spriteSheet: width/height zero or width/height < given frameWidth/frameHeight");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's create some frames then
|
||||||
|
var data = new Phaser.FrameData();
|
||||||
|
var x = margin;
|
||||||
|
var y = margin;
|
||||||
|
|
||||||
|
for (var i = 0; i < total; i++)
|
||||||
|
{
|
||||||
|
var uuid = game.rnd.uuid();
|
||||||
|
|
||||||
|
data.addFrame(new Phaser.Frame(i, x, y, frameWidth, frameHeight, '', uuid));
|
||||||
|
|
||||||
|
PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[key], {
|
||||||
|
x: x,
|
||||||
|
y: y,
|
||||||
|
width: frameWidth,
|
||||||
|
height: frameHeight
|
||||||
|
});
|
||||||
|
|
||||||
|
x += frameWidth + spacing;
|
||||||
|
|
||||||
|
if (x === width)
|
||||||
|
{
|
||||||
|
x = margin;
|
||||||
|
y += frameHeight + spacing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the JSON data and extract the animation frame data from it.
|
||||||
|
*
|
||||||
|
* @method Phaser.AnimationParser.JSONData
|
||||||
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
* @param {Object} json - The JSON data from the Texture Atlas. Must be in Array format.
|
||||||
|
* @param {string} cacheKey - The Game.Cache asset key of the texture image.
|
||||||
|
* @return {Phaser.FrameData} A FrameData object containing the parsed frames.
|
||||||
|
*/
|
||||||
|
JSONData: function (game, json, cacheKey) {
|
||||||
|
|
||||||
|
// Malformed?
|
||||||
|
if (!json['frames'])
|
||||||
|
{
|
||||||
|
console.warn("Phaser.AnimationParser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array");
|
||||||
|
console.log(json);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's create some frames then
|
||||||
|
var data = new Phaser.FrameData();
|
||||||
|
|
||||||
|
// By this stage frames is a fully parsed array
|
||||||
|
var frames = json['frames'];
|
||||||
|
var newFrame;
|
||||||
|
|
||||||
|
for (var i = 0; i < frames.length; i++)
|
||||||
|
{
|
||||||
|
var uuid = game.rnd.uuid();
|
||||||
|
|
||||||
|
newFrame = data.addFrame(new Phaser.Frame(
|
||||||
|
i,
|
||||||
|
frames[i].frame.x,
|
||||||
|
frames[i].frame.y,
|
||||||
|
frames[i].frame.w,
|
||||||
|
frames[i].frame.h,
|
||||||
|
frames[i].filename,
|
||||||
|
uuid
|
||||||
|
));
|
||||||
|
|
||||||
|
PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
|
||||||
|
x: frames[i].frame.x,
|
||||||
|
y: frames[i].frame.y,
|
||||||
|
width: frames[i].frame.w,
|
||||||
|
height: frames[i].frame.h
|
||||||
|
});
|
||||||
|
|
||||||
|
if (frames[i].trimmed)
|
||||||
|
{
|
||||||
|
newFrame.setTrim(
|
||||||
|
frames[i].trimmed,
|
||||||
|
frames[i].sourceSize.w,
|
||||||
|
frames[i].sourceSize.h,
|
||||||
|
frames[i].spriteSourceSize.x,
|
||||||
|
frames[i].spriteSourceSize.y,
|
||||||
|
frames[i].spriteSourceSize.w,
|
||||||
|
frames[i].spriteSourceSize.h
|
||||||
|
);
|
||||||
|
|
||||||
|
PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frames[i].spriteSourceSize.x, frames[i].spriteSourceSize.y, frames[i].sourceSize.w, frames[i].sourceSize.h);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the JSON data and extract the animation frame data from it.
|
||||||
|
*
|
||||||
|
* @method Phaser.AnimationParser.JSONDataHash
|
||||||
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
* @param {Object} json - The JSON data from the Texture Atlas. Must be in JSON Hash format.
|
||||||
|
* @param {string} cacheKey - The Game.Cache asset key of the texture image.
|
||||||
|
* @return {Phaser.FrameData} A FrameData object containing the parsed frames.
|
||||||
|
*/
|
||||||
|
JSONDataHash: function (game, json, cacheKey) {
|
||||||
|
|
||||||
|
// Malformed?
|
||||||
|
if (!json['frames'])
|
||||||
|
{
|
||||||
|
console.warn("Phaser.AnimationParser.JSONDataHash: Invalid Texture Atlas JSON given, missing 'frames' object");
|
||||||
|
console.log(json);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's create some frames then
|
||||||
|
var data = new Phaser.FrameData();
|
||||||
|
|
||||||
|
// By this stage frames is a fully parsed array
|
||||||
|
var frames = json['frames'];
|
||||||
|
var newFrame;
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
for (var key in frames)
|
||||||
|
{
|
||||||
|
var uuid = game.rnd.uuid();
|
||||||
|
|
||||||
|
newFrame = data.addFrame(new Phaser.Frame(
|
||||||
|
i,
|
||||||
|
frames[key].frame.x,
|
||||||
|
frames[key].frame.y,
|
||||||
|
frames[key].frame.w,
|
||||||
|
frames[key].frame.h,
|
||||||
|
key,
|
||||||
|
uuid
|
||||||
|
));
|
||||||
|
|
||||||
|
PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
|
||||||
|
x: frames[key].frame.x,
|
||||||
|
y: frames[key].frame.y,
|
||||||
|
width: frames[key].frame.w,
|
||||||
|
height: frames[key].frame.h
|
||||||
|
});
|
||||||
|
|
||||||
|
if (frames[key].trimmed)
|
||||||
|
{
|
||||||
|
newFrame.setTrim(
|
||||||
|
frames[key].trimmed,
|
||||||
|
frames[key].sourceSize.w,
|
||||||
|
frames[key].sourceSize.h,
|
||||||
|
frames[key].spriteSourceSize.x,
|
||||||
|
frames[key].spriteSourceSize.y,
|
||||||
|
frames[key].spriteSourceSize.w,
|
||||||
|
frames[key].spriteSourceSize.h
|
||||||
|
);
|
||||||
|
|
||||||
|
PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frames[key].spriteSourceSize.x, frames[key].spriteSourceSize.y, frames[key].sourceSize.w, frames[key].sourceSize.h);
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the XML data and extract the animation frame data from it.
|
||||||
|
*
|
||||||
|
* @method Phaser.AnimationParser.XMLData
|
||||||
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
* @param {Object} xml - The XML data from the Texture Atlas. Must be in Starling XML format.
|
||||||
|
* @param {string} cacheKey - The Game.Cache asset key of the texture image.
|
||||||
|
* @return {Phaser.FrameData} A FrameData object containing the parsed frames.
|
||||||
|
*/
|
||||||
|
XMLData: function (game, xml, cacheKey) {
|
||||||
|
|
||||||
|
// Malformed?
|
||||||
|
if (!xml.getElementsByTagName('TextureAtlas'))
|
||||||
|
{
|
||||||
|
console.warn("Phaser.AnimationParser.XMLData: Invalid Texture Atlas XML given, missing <TextureAtlas> tag");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's create some frames then
|
||||||
|
var data = new Phaser.FrameData();
|
||||||
|
var frames = xml.getElementsByTagName('SubTexture');
|
||||||
|
var newFrame;
|
||||||
|
|
||||||
|
var uuid;
|
||||||
|
var name;
|
||||||
|
var frame;
|
||||||
|
var x;
|
||||||
|
var y;
|
||||||
|
var width;
|
||||||
|
var height;
|
||||||
|
var frameX;
|
||||||
|
var frameY;
|
||||||
|
var frameWidth;
|
||||||
|
var frameHeight;
|
||||||
|
|
||||||
|
for (var i = 0; i < frames.length; i++)
|
||||||
|
{
|
||||||
|
uuid = game.rnd.uuid();
|
||||||
|
|
||||||
|
frame = frames[i].attributes;
|
||||||
|
|
||||||
|
name = frame.name.nodeValue;
|
||||||
|
x = parseInt(frame.x.nodeValue, 10);
|
||||||
|
y = parseInt(frame.y.nodeValue, 10);
|
||||||
|
width = parseInt(frame.width.nodeValue, 10);
|
||||||
|
height = parseInt(frame.height.nodeValue, 10);
|
||||||
|
|
||||||
|
frameX = null;
|
||||||
|
frameY = null;
|
||||||
|
|
||||||
|
if (frame.frameX)
|
||||||
|
{
|
||||||
|
frameX = Math.abs(parseInt(frame.frameX.nodeValue, 10));
|
||||||
|
frameY = Math.abs(parseInt(frame.frameY.nodeValue, 10));
|
||||||
|
frameWidth = parseInt(frame.frameWidth.nodeValue, 10);
|
||||||
|
frameHeight = parseInt(frame.frameHeight.nodeValue, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
newFrame = data.addFrame(new Phaser.Frame(i, x, y, width, height, name, uuid));
|
||||||
|
|
||||||
|
PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[cacheKey], {
|
||||||
|
x: x,
|
||||||
|
y: y,
|
||||||
|
width: width,
|
||||||
|
height: height
|
||||||
|
});
|
||||||
|
|
||||||
|
// Trimmed?
|
||||||
|
if (frameX !== null || frameY !== null)
|
||||||
|
{
|
||||||
|
newFrame.setTrim(true, width, height, frameX, frameY, frameWidth, frameHeight);
|
||||||
|
|
||||||
|
PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frameX, frameY, width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,933 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: gameobjects/BitmapData.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: gameobjects/BitmapData.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new BitmapData object.
|
||||||
|
*
|
||||||
|
* @class Phaser.BitmapData
|
||||||
|
*
|
||||||
|
* @classdesc A BitmapData object contains a Canvas element to which you can draw anything you like via normal Canvas context operations.
|
||||||
|
* A single BitmapData can be used as the texture one or many Images/Sprites. So if you need to dynamically create a Sprite texture then they are a good choice.
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
* @param {string} key - Internal Phaser reference key for the render texture.
|
||||||
|
* @param {number} [width=100] - The width of the BitmapData in pixels.
|
||||||
|
* @param {number} [height=100] - The height of the BitmapData in pixels.
|
||||||
|
*/
|
||||||
|
Phaser.BitmapData = function (game, key, width, height) {
|
||||||
|
|
||||||
|
if (typeof width === 'undefined') { width = 100; }
|
||||||
|
if (typeof height === 'undefined') { height = 100; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
*/
|
||||||
|
this.game = game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {string} key - The key of the BitmapData in the Cache, if stored there.
|
||||||
|
*/
|
||||||
|
this.key = key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} width - The width of the BitmapData in pixels.
|
||||||
|
*/
|
||||||
|
this.width = width;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} height - The height of the BitmapData in pixels.
|
||||||
|
*/
|
||||||
|
this.height = height;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {HTMLCanvasElement} canvas - The canvas to which this BitmapData draws.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.canvas = Phaser.Canvas.create(width, height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.context = this.canvas.getContext('2d');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {CanvasRenderingContext2D} ctx - A reference to BitmapData.context.
|
||||||
|
*/
|
||||||
|
this.ctx = this.context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {array} imageData - The canvas image data.
|
||||||
|
*/
|
||||||
|
this.imageData = this.context.getImageData(0, 0, width, height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {UInt8Clamped} pixels - A reference to the context imageData buffer.
|
||||||
|
*/
|
||||||
|
if (this.imageData.data.buffer)
|
||||||
|
{
|
||||||
|
this.pixels = this.imageData.data.buffer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.pixels = this.imageData.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {PIXI.BaseTexture} baseTexture - The PIXI.BaseTexture.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.baseTexture = new PIXI.BaseTexture(this.canvas);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {PIXI.Texture} texture - The PIXI.Texture.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.texture = new PIXI.Texture(this.baseTexture);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Frame} textureFrame - The Frame this BitmapData uses for rendering.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.textureFrame = new Phaser.Frame(0, 0, 0, width, height, 'bitmapData', game.rnd.uuid());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} type - The const type of this object.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.type = Phaser.BITMAPDATA;
|
||||||
|
|
||||||
|
this._dirty = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Phaser.BitmapData.prototype = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the given objects so that they use this BitmapData as their texture. This will replace any texture they will currently have set.
|
||||||
|
*
|
||||||
|
* @method Phaser.BitmapData#add
|
||||||
|
* @param {Phaser.Sprite|Phaser.Sprite[]|Phaser.Image|Phaser.Image[]} object - Either a single Sprite/Image or an Array of Sprites/Images.
|
||||||
|
*/
|
||||||
|
add: function (object) {
|
||||||
|
|
||||||
|
if (Array.isArray(object))
|
||||||
|
{
|
||||||
|
for (var i = 0; i < object.length; i++)
|
||||||
|
{
|
||||||
|
if (object[i]['loadTexture'])
|
||||||
|
{
|
||||||
|
object[i].loadTexture(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
object.loadTexture(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the BitmapData.
|
||||||
|
* @method Phaser.BitmapData#clear
|
||||||
|
*/
|
||||||
|
clear: function () {
|
||||||
|
|
||||||
|
this.context.clearRect(0, 0, this.width, this.height);
|
||||||
|
|
||||||
|
this._dirty = true;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resizes the BitmapData.
|
||||||
|
* @method Phaser.BitmapData#resize
|
||||||
|
*/
|
||||||
|
resize: function (width, height) {
|
||||||
|
|
||||||
|
if (width !== this.width || height !== this.height)
|
||||||
|
{
|
||||||
|
console.log('bmd resize', width, height);
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
this.canvas.width = width;
|
||||||
|
this.canvas.height = height;
|
||||||
|
this.textureFrame.width = width;
|
||||||
|
this.textureFrame.height = height;
|
||||||
|
this.imageData = this.context.getImageData(0, 0, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._dirty = true;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method Phaser.BitmapData#refreshBuffer
|
||||||
|
*/
|
||||||
|
refreshBuffer: function () {
|
||||||
|
|
||||||
|
this.imageData = this.context.getImageData(0, 0, this.width, this.height);
|
||||||
|
this.pixels = new Int32Array(this.imageData.data.buffer);
|
||||||
|
|
||||||
|
// this.data8 = new Uint8ClampedArray(this.imageData.buffer);
|
||||||
|
// this.data32 = new Uint32Array(this.imageData.buffer);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the color of the given pixel to the specified red, green, blue and alpha values.
|
||||||
|
* @method Phaser.BitmapData#setPixel32
|
||||||
|
* @param {number} x - The X coordinate of the pixel to be set.
|
||||||
|
* @param {number} y - The Y coordinate of the pixel to be set.
|
||||||
|
* @param {number} red - The red color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} green - The green color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} blue - The blue color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} alpha - The alpha color value, between 0 and 0xFF (255).
|
||||||
|
*/
|
||||||
|
setPixel32: function (x, y, red, green, blue, alpha) {
|
||||||
|
|
||||||
|
if (x >= 0 && x <= this.width && y >= 0 && y <= this.height)
|
||||||
|
{
|
||||||
|
this.pixels[y * this.width + x] = (alpha << 24) | (blue << 16) | (green << 8) | red;
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (this.isLittleEndian)
|
||||||
|
{
|
||||||
|
this.data32[y * this.width + x] = (alpha << 24) | (blue << 16) | (green << 8) | red;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.data32[y * this.width + x] = (red << 24) | (green << 16) | (blue << 8) | alpha;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// this.imageData.data.set(this.data8);
|
||||||
|
|
||||||
|
this.context.putImageData(this.imageData, 0, 0);
|
||||||
|
|
||||||
|
this._dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the color of the given pixel to the specified red, green and blue values.
|
||||||
|
*
|
||||||
|
* @method Phaser.BitmapData#setPixel
|
||||||
|
* @param {number} x - The X coordinate of the pixel to be set.
|
||||||
|
* @param {number} y - The Y coordinate of the pixel to be set.
|
||||||
|
* @param {number} red - The red color value (between 0 and 255)
|
||||||
|
* @param {number} green - The green color value (between 0 and 255)
|
||||||
|
* @param {number} blue - The blue color value (between 0 and 255)
|
||||||
|
*/
|
||||||
|
setPixel: function (x, y, red, green, blue) {
|
||||||
|
|
||||||
|
this.setPixel32(x, y, red, green, blue, 255);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the color of a specific pixel.
|
||||||
|
*
|
||||||
|
* @param {number} x - The X coordinate of the pixel to get.
|
||||||
|
* @param {number} y - The Y coordinate of the pixel to get.
|
||||||
|
* @return {number} A native color value integer (format: 0xRRGGBB)
|
||||||
|
*/
|
||||||
|
getPixel: function (x, y) {
|
||||||
|
|
||||||
|
if (x >= 0 && x <= this.width && y >= 0 && y <= this.height)
|
||||||
|
{
|
||||||
|
return this.data32[y * this.width + x];
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the color of a specific pixel including its alpha value.
|
||||||
|
*
|
||||||
|
* @param {number} x - The X coordinate of the pixel to get.
|
||||||
|
* @param {number} y - The Y coordinate of the pixel to get.
|
||||||
|
* @return {number} A native color value integer (format: 0xAARRGGBB)
|
||||||
|
*/
|
||||||
|
getPixel32: function (x, y) {
|
||||||
|
|
||||||
|
if (x >= 0 && x <= this.width && y >= 0 && y <= this.height)
|
||||||
|
{
|
||||||
|
return this.data32[y * this.width + x];
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all the pixels from the region specified by the given Rectangle object.
|
||||||
|
*
|
||||||
|
* @param {Phaser.Rectangle} rect - The Rectangle region to get.
|
||||||
|
* @return {array} CanvasPixelArray.
|
||||||
|
*/
|
||||||
|
getPixels: function (rect) {
|
||||||
|
|
||||||
|
return this.context.getImageData(rect.x, rect.y, rect.width, rect.height);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies the pixels from the source image to this BitmapData based on the given area and destination.
|
||||||
|
*
|
||||||
|
* @param {HTMLImage|string} source - The Image to draw. If you give a key it will try and find the Image in the Game.Cache.
|
||||||
|
* @param {Phaser.Rectangle} area - The Rectangle region to copy from the source image.
|
||||||
|
* @param {number} destX - The destination x coordinate to copy the image to.
|
||||||
|
* @param {number} destY - The destination y coordinate to copy the image to.
|
||||||
|
*/
|
||||||
|
copyPixels: function (source, area, destX, destY) {
|
||||||
|
|
||||||
|
if (typeof source === 'string')
|
||||||
|
{
|
||||||
|
source = this.game.cache.getImage(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source)
|
||||||
|
{
|
||||||
|
this.context.drawImage(source, area.x, area.y, area.width, area.height, destX, destY, area.width, area.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws the given image to this BitmapData at the coordinates specified. If you need to only draw a part of the image use BitmapData.copyPixels instead.
|
||||||
|
*
|
||||||
|
* @param {HTMLImage|string} source - The Image to draw. If you give a key it will try and find the Image in the Game.Cache.
|
||||||
|
* @param {number} destX - The destination x coordinate to draw the image to.
|
||||||
|
* @param {number} destY - The destination y coordinate to draw the image to.
|
||||||
|
*/
|
||||||
|
draw: function (source, destX, destY) {
|
||||||
|
|
||||||
|
if (typeof source === 'string')
|
||||||
|
{
|
||||||
|
source = this.game.cache.getImage(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source)
|
||||||
|
{
|
||||||
|
this.context.drawImage(source, 0, 0, source.width, source.height, destX, destY, source.width, source.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws the given image onto this BitmapData using an image as an alpha mask.
|
||||||
|
*
|
||||||
|
* @param {HTMLImage|string} source - The Image to draw. If you give a key it will try and find the Image in the Game.Cache.
|
||||||
|
* @param {HTMLImage|string} mask - The Image to use as the alpha mask. If you give a key it will try and find the Image in the Game.Cache.
|
||||||
|
*/
|
||||||
|
alphaMask: function (source, mask) {
|
||||||
|
|
||||||
|
var temp = this.context.globalCompositeOperation;
|
||||||
|
|
||||||
|
if (typeof mask === 'string')
|
||||||
|
{
|
||||||
|
mask = this.game.cache.getImage(mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mask)
|
||||||
|
{
|
||||||
|
this.context.drawImage(mask, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.context.globalCompositeOperation = 'source-atop';
|
||||||
|
|
||||||
|
if (typeof source === 'string')
|
||||||
|
{
|
||||||
|
source = this.game.cache.getImage(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source)
|
||||||
|
{
|
||||||
|
this.context.drawImage(source, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.context.globalCompositeOperation = temp;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the game is running in WebGL this will push the texture up to the GPU if it's dirty.
|
||||||
|
* This is called automatically if the BitmapData is being used by a Sprite, otherwise you need to remember to call it in your render function.
|
||||||
|
*
|
||||||
|
* @method Phaser.BitmapData#render
|
||||||
|
*/
|
||||||
|
render: function () {
|
||||||
|
|
||||||
|
if (this._dirty)
|
||||||
|
{
|
||||||
|
// Only needed if running in WebGL, otherwise this array will never get cleared down
|
||||||
|
if (this.game.renderType === Phaser.WEBGL)
|
||||||
|
{
|
||||||
|
PIXI.texturesToUpdate.push(this.baseTexture);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._dirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.BitmapData.prototype.constructor = Phaser.BitmapData;
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,980 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: gameobjects/BitmapText.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: gameobjects/BitmapText.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new BitmapText object.
|
||||||
|
*
|
||||||
|
* @class Phaser.BitmapText
|
||||||
|
*
|
||||||
|
* @classdesc BitmapText objects work by taking a texture file and an XML file that describes the font layout.
|
||||||
|
*
|
||||||
|
* On Windows you can use the free app BMFont: http://www.angelcode.com/products/bmfont/
|
||||||
|
* On OS X we recommend Glyph Designer: http://www.71squared.com/en/glyphdesigner
|
||||||
|
* For Web there is the great Littera: http://kvazars.com/littera/
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
* @param {number} x - X position of the new bitmapText object.
|
||||||
|
* @param {number} y - Y position of the new bitmapText object.
|
||||||
|
* @param {string} font - The key of the BitmapFont as stored in Game.Cache.
|
||||||
|
* @param {string} [text=''] - The actual text that will be rendered. Can be set later via BitmapText.text.
|
||||||
|
* @param {number} [size=32] - The size the font will be rendered in, in pixels.
|
||||||
|
*/
|
||||||
|
Phaser.BitmapText = function (game, x, y, font, text, size) {
|
||||||
|
|
||||||
|
x = x || 0;
|
||||||
|
y = y || 0;
|
||||||
|
font = font || '';
|
||||||
|
text = text || '';
|
||||||
|
size = size || 32;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Game} game - A reference to the currently running Game.
|
||||||
|
*/
|
||||||
|
this.game = game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {boolean} exists - If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.exists = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {string} name - The user defined name given to this BitmapText.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.name = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} type - The const type of this object.
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
this.type = Phaser.BITMAPTEXT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Point} world - The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.
|
||||||
|
*/
|
||||||
|
this.world = new Phaser.Point(x, y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {string} _text - Internal cache var.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._text = text;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {string} _font - Internal cache var.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._font = font;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} _fontSize - Internal cache var.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._fontSize = size;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {string} _align - Internal cache var.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._align = 'left';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} _tint - Internal cache var.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._tint = 0xFFFFFF;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Events} events - The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.
|
||||||
|
*/
|
||||||
|
this.events = new Phaser.Events(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.InputHandler|null} input - The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it.
|
||||||
|
*/
|
||||||
|
this.input = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.
|
||||||
|
*/
|
||||||
|
this.cameraOffset = new Phaser.Point();
|
||||||
|
|
||||||
|
PIXI.BitmapText.call(this, text);
|
||||||
|
|
||||||
|
this.position.set(x, y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A small internal cache:
|
||||||
|
* 0 = previous position.x
|
||||||
|
* 1 = previous position.y
|
||||||
|
* 2 = previous rotation
|
||||||
|
* 3 = renderID
|
||||||
|
* 4 = fresh? (0 = no, 1 = yes)
|
||||||
|
* 5 = outOfBoundsFired (0 = no, 1 = yes)
|
||||||
|
* 6 = exists (0 = no, 1 = yes)
|
||||||
|
* 7 = fixed to camera (0 = no, 1 = yes)
|
||||||
|
* @property {Int16Array} _cache
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.BitmapText.prototype = Object.create(PIXI.BitmapText.prototype);
|
||||||
|
Phaser.BitmapText.prototype.constructor = Phaser.BitmapText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method Phaser.BitmapText.prototype.setStyle
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
Phaser.BitmapText.prototype.setStyle = function() {
|
||||||
|
|
||||||
|
this.style = { align: this._align };
|
||||||
|
this.fontName = this._font;
|
||||||
|
this.fontSize = this._fontSize;
|
||||||
|
this.dirty = true;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically called by World.preUpdate.
|
||||||
|
* @method Phaser.BitmapText.prototype.preUpdate
|
||||||
|
*/
|
||||||
|
Phaser.BitmapText.prototype.preUpdate = function () {
|
||||||
|
|
||||||
|
this._cache[0] = this.world.x;
|
||||||
|
this._cache[1] = this.world.y;
|
||||||
|
this._cache[2] = this.rotation;
|
||||||
|
|
||||||
|
if (!this.exists || !this.parent.exists)
|
||||||
|
{
|
||||||
|
this.renderOrderID = -1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.autoCull)
|
||||||
|
{
|
||||||
|
// Won't get rendered but will still get its transform updated
|
||||||
|
this.renderable = this.game.world.camera.screenView.intersects(this.getBounds());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]);
|
||||||
|
|
||||||
|
if (this.visible)
|
||||||
|
{
|
||||||
|
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override and use this function in your own custom objects to handle any update requirements you may have.
|
||||||
|
*
|
||||||
|
* @method Phaser.BitmapText.prototype.update
|
||||||
|
*/
|
||||||
|
Phaser.BitmapText.prototype.update = function() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically called by World.postUpdate.
|
||||||
|
* @method Phaser.BitmapText.prototype.postUpdate
|
||||||
|
*/
|
||||||
|
Phaser.BitmapText.prototype.postUpdate = function () {
|
||||||
|
|
||||||
|
// Fixed to Camera?
|
||||||
|
if (this._cache[7] === 1)
|
||||||
|
{
|
||||||
|
this.position.x = this.game.camera.view.x + this.cameraOffset.x;
|
||||||
|
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy this BitmapText instance. This will remove any filters and un-parent any children.
|
||||||
|
* @method Phaser.BitmapText.prototype.destroy
|
||||||
|
*/
|
||||||
|
Phaser.BitmapText.prototype.destroy = function() {
|
||||||
|
|
||||||
|
if (this.parent)
|
||||||
|
{
|
||||||
|
this.parent.remove(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var i = this.children.length;
|
||||||
|
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
this.removeChild(this.children[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.exists = false;
|
||||||
|
this.visible = false;
|
||||||
|
|
||||||
|
this.filters = null;
|
||||||
|
this.mask = null;
|
||||||
|
this.game = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Phaser.BitmapText#align
|
||||||
|
* @property {string} align - Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.BitmapText.prototype, 'align', {
|
||||||
|
|
||||||
|
get: function() {
|
||||||
|
return this._align;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(value) {
|
||||||
|
|
||||||
|
if (value !== this._align)
|
||||||
|
{
|
||||||
|
this._align = value;
|
||||||
|
this.setStyle();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Phaser.BitmapText#tint
|
||||||
|
* @property {number} tint - The tint applied to the BitmapText. This is a hex value. Set to white to disable (0xFFFFFF)
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.BitmapText.prototype, 'tint', {
|
||||||
|
|
||||||
|
get: function() {
|
||||||
|
return this._tint;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(value) {
|
||||||
|
|
||||||
|
if (value !== this._tint)
|
||||||
|
{
|
||||||
|
this._tint = value;
|
||||||
|
this.dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the rotation of the Text, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
|
||||||
|
* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.
|
||||||
|
* If you wish to work in radians instead of degrees use the property Sprite.rotation instead.
|
||||||
|
* @name Phaser.BitmapText#angle
|
||||||
|
* @property {number} angle - Gets or sets the angle of rotation in degrees.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.BitmapText.prototype, 'angle', {
|
||||||
|
|
||||||
|
get: function() {
|
||||||
|
return Phaser.Math.radToDeg(this.rotation);
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(value) {
|
||||||
|
this.rotation = Phaser.Math.degToRad(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Phaser.BitmapText#font
|
||||||
|
* @property {string} font - The font the text will be rendered in, i.e. 'Arial'. Must be loaded in the browser before use.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.BitmapText.prototype, 'font', {
|
||||||
|
|
||||||
|
get: function() {
|
||||||
|
return this._font;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(value) {
|
||||||
|
|
||||||
|
if (value !== this._font)
|
||||||
|
{
|
||||||
|
this._font = value.trim();
|
||||||
|
this.style.font = this._fontSize + "px '" + this._font + "'";
|
||||||
|
this.dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Phaser.BitmapText#fontSize
|
||||||
|
* @property {number} fontSize - The size of the font in pixels.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.BitmapText.prototype, 'fontSize', {
|
||||||
|
|
||||||
|
get: function() {
|
||||||
|
return this._fontSize;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(value) {
|
||||||
|
|
||||||
|
value = parseInt(value);
|
||||||
|
|
||||||
|
if (value !== this._fontSize)
|
||||||
|
{
|
||||||
|
this._fontSize = value;
|
||||||
|
this.style.font = this._fontSize + "px '" + this._font + "'";
|
||||||
|
this.dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The text string to be displayed by this Text object, taking into account the style settings.
|
||||||
|
* @name Phaser.BitmapText#text
|
||||||
|
* @property {string} text - The text string to be displayed by this Text object, taking into account the style settings.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.BitmapText.prototype, 'text', {
|
||||||
|
|
||||||
|
get: function() {
|
||||||
|
return this._text;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(value) {
|
||||||
|
|
||||||
|
if (value !== this._text)
|
||||||
|
{
|
||||||
|
this._text = value.toString() || ' ';
|
||||||
|
this.dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default a Text object won't process any input events at all. By setting inputEnabled to true the Phaser.InputHandler is
|
||||||
|
* activated for this object and it will then start to process click/touch events and more.
|
||||||
|
*
|
||||||
|
* @name Phaser.BitmapText#inputEnabled
|
||||||
|
* @property {boolean} inputEnabled - Set to true to allow this object to receive input events.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.BitmapText.prototype, "inputEnabled", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
|
||||||
|
return (this.input && this.input.enabled);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
if (this.input === null)
|
||||||
|
{
|
||||||
|
this.input = new Phaser.InputHandler(this);
|
||||||
|
this.input.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.input && this.input.enabled)
|
||||||
|
{
|
||||||
|
this.input.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An BitmapText that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in BitmapText.cameraOffset.
|
||||||
|
* Note that the cameraOffset values are in addition to any parent in the display list.
|
||||||
|
* So if this BitmapText was in a Group that has x: 200, then this will be added to the cameraOffset.x
|
||||||
|
*
|
||||||
|
* @name Phaser.BitmapText#fixedToCamera
|
||||||
|
* @property {boolean} fixedToCamera - Set to true to fix this BitmapText to the Camera at its current world coordinates.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.BitmapText.prototype, "fixedToCamera", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
|
||||||
|
return !!this._cache[7];
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
this._cache[7] = 1;
|
||||||
|
this.cameraOffset.set(this.x, this.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this._cache[7] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,983 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: core/Camera.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: core/Camera.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Camera is your view into the game world. It has a position and size and renders only those objects within its field of view.
|
||||||
|
* The game automatically creates a single Stage sized camera on boot. Move the camera around the world with Phaser.Camera.x/y
|
||||||
|
*
|
||||||
|
* @class Phaser.Camera
|
||||||
|
* @constructor
|
||||||
|
* @param {Phaser.Game} game - Game reference to the currently running game.
|
||||||
|
* @param {number} id - Not being used at the moment, will be when Phaser supports multiple camera
|
||||||
|
* @param {number} x - Position of the camera on the X axis
|
||||||
|
* @param {number} y - Position of the camera on the Y axis
|
||||||
|
* @param {number} width - The width of the view rectangle
|
||||||
|
* @param {number} height - The height of the view rectangle
|
||||||
|
*/
|
||||||
|
Phaser.Camera = function (game, id, x, y, width, height) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Game} game - A reference to the currently running Game.
|
||||||
|
*/
|
||||||
|
this.game = game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.World} world - A reference to the game world.
|
||||||
|
*/
|
||||||
|
this.world = game.world;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} id - Reserved for future multiple camera set-ups.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.id = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Camera view.
|
||||||
|
* The view into the world we wish to render (by default the game dimensions).
|
||||||
|
* The x/y values are in world coordinates, not screen coordinates, the width/height is how many pixels to render.
|
||||||
|
* Objects outside of this view are not rendered if set to camera cull.
|
||||||
|
* @property {Phaser.Rectangle} view
|
||||||
|
*/
|
||||||
|
this.view = new Phaser.Rectangle(x, y, width, height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Rectangle} screenView - Used by Sprites to work out Camera culling.
|
||||||
|
*/
|
||||||
|
this.screenView = new Phaser.Rectangle(x, y, width, height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Camera is bound to this Rectangle and cannot move outside of it. By default it is enabled and set to the size of the World.
|
||||||
|
* The Rectangle can be located anywhere in the world and updated as often as you like. If you don't wish the Camera to be bound
|
||||||
|
* at all then set this to null. The values can be anything and are in World coordinates, with 0,0 being the center of the world.
|
||||||
|
* @property {Phaser.Rectangle} bounds - The Rectangle in which the Camera is bounded. Set to null to allow for movement anywhere.
|
||||||
|
*/
|
||||||
|
this.bounds = new Phaser.Rectangle(x, y, width, height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Rectangle} deadzone - Moving inside this Rectangle will not cause camera moving.
|
||||||
|
*/
|
||||||
|
this.deadzone = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {boolean} visible - Whether this camera is visible or not.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.visible = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {boolean} atLimit - Whether this camera is flush with the World Bounds or not.
|
||||||
|
*/
|
||||||
|
this.atLimit = { x: false, y: false };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Sprite} target - If the camera is tracking a Sprite, this is a reference to it, otherwise null.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.target = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} edge - Edge property.
|
||||||
|
* @private
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this._edge = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {PIXI.DisplayObject} displayObject - The display object to which all game objects are added. Set by World.boot
|
||||||
|
*/
|
||||||
|
this.displayObject = null;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constant
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
Phaser.Camera.FOLLOW_LOCKON = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constant
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
Phaser.Camera.FOLLOW_PLATFORMER = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constant
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
Phaser.Camera.FOLLOW_TOPDOWN = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constant
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
Phaser.Camera.FOLLOW_TOPDOWN_TIGHT = 3;
|
||||||
|
|
||||||
|
Phaser.Camera.prototype = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells this camera which sprite to follow.
|
||||||
|
* @method Phaser.Camera#follow
|
||||||
|
* @param {Phaser.Sprite} target - The object you want the camera to track. Set to null to not follow anything.
|
||||||
|
* @param {number} [style] Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
|
||||||
|
*/
|
||||||
|
follow: function (target, style) {
|
||||||
|
|
||||||
|
if (typeof style === "undefined") { style = Phaser.Camera.FOLLOW_LOCKON; }
|
||||||
|
|
||||||
|
this.target = target;
|
||||||
|
|
||||||
|
var helper;
|
||||||
|
|
||||||
|
switch (style) {
|
||||||
|
|
||||||
|
case Phaser.Camera.FOLLOW_PLATFORMER:
|
||||||
|
var w = this.width / 8;
|
||||||
|
var h = this.height / 3;
|
||||||
|
this.deadzone = new Phaser.Rectangle((this.width - w) / 2, (this.height - h) / 2 - h * 0.25, w, h);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Phaser.Camera.FOLLOW_TOPDOWN:
|
||||||
|
helper = Math.max(this.width, this.height) / 4;
|
||||||
|
this.deadzone = new Phaser.Rectangle((this.width - helper) / 2, (this.height - helper) / 2, helper, helper);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Phaser.Camera.FOLLOW_TOPDOWN_TIGHT:
|
||||||
|
helper = Math.max(this.width, this.height) / 8;
|
||||||
|
this.deadzone = new Phaser.Rectangle((this.width - helper) / 2, (this.height - helper) / 2, helper, helper);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Phaser.Camera.FOLLOW_LOCKON:
|
||||||
|
this.deadzone = null;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this.deadzone = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move the camera focus on a display object instantly.
|
||||||
|
* @method Phaser.Camera#focusOn
|
||||||
|
* @param {any} displayObject - The display object to focus the camera on. Must have visible x/y properties.
|
||||||
|
*/
|
||||||
|
focusOn: function (displayObject) {
|
||||||
|
|
||||||
|
this.setPosition(Math.round(displayObject.x - this.view.halfWidth), Math.round(displayObject.y - this.view.halfHeight));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move the camera focus on a location instantly.
|
||||||
|
* @method Phaser.Camera#focusOnXY
|
||||||
|
* @param {number} x - X position.
|
||||||
|
* @param {number} y - Y position.
|
||||||
|
*/
|
||||||
|
focusOnXY: function (x, y) {
|
||||||
|
|
||||||
|
this.setPosition(Math.round(x - this.view.halfWidth), Math.round(y - this.view.halfHeight));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update focusing and scrolling.
|
||||||
|
* @method Phaser.Camera#update
|
||||||
|
*/
|
||||||
|
update: function () {
|
||||||
|
|
||||||
|
if (this.target)
|
||||||
|
{
|
||||||
|
this.updateTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.bounds)
|
||||||
|
{
|
||||||
|
this.checkBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.displayObject.position.x = -this.view.x;
|
||||||
|
this.displayObject.position.y = -this.view.y;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal method
|
||||||
|
* @method Phaser.Camera#updateTarget
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
updateTarget: function () {
|
||||||
|
|
||||||
|
if (this.deadzone)
|
||||||
|
{
|
||||||
|
this._edge = this.target.x - this.deadzone.x;
|
||||||
|
|
||||||
|
if (this.view.x > this._edge)
|
||||||
|
{
|
||||||
|
this.view.x = this._edge;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._edge = this.target.x + this.target.width - this.deadzone.x - this.deadzone.width;
|
||||||
|
|
||||||
|
if (this.view.x < this._edge)
|
||||||
|
{
|
||||||
|
this.view.x = this._edge;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._edge = this.target.y - this.deadzone.y;
|
||||||
|
|
||||||
|
if (this.view.y > this._edge)
|
||||||
|
{
|
||||||
|
this.view.y = this._edge;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._edge = this.target.y + this.target.height - this.deadzone.y - this.deadzone.height;
|
||||||
|
|
||||||
|
if (this.view.y < this._edge)
|
||||||
|
{
|
||||||
|
this.view.y = this._edge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.focusOnXY(this.target.x, this.target.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the Camera bounds to match the game world.
|
||||||
|
* @method Phaser.Camera#setBoundsToWorld
|
||||||
|
*/
|
||||||
|
setBoundsToWorld: function () {
|
||||||
|
|
||||||
|
this.bounds.setTo(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to ensure the camera doesn't venture outside of the game world.
|
||||||
|
* @method Phaser.Camera#checkWorldBounds
|
||||||
|
*/
|
||||||
|
checkBounds: function () {
|
||||||
|
|
||||||
|
this.atLimit.x = false;
|
||||||
|
this.atLimit.y = false;
|
||||||
|
|
||||||
|
// Make sure we didn't go outside the cameras bounds
|
||||||
|
if (this.view.x < this.bounds.x)
|
||||||
|
{
|
||||||
|
this.atLimit.x = true;
|
||||||
|
this.view.x = this.bounds.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.view.right > this.bounds.right)
|
||||||
|
{
|
||||||
|
this.atLimit.x = true;
|
||||||
|
this.view.x = this.bounds.right - this.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.view.y < this.bounds.top)
|
||||||
|
{
|
||||||
|
this.atLimit.y = true;
|
||||||
|
this.view.y = this.bounds.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.view.bottom > this.bounds.bottom)
|
||||||
|
{
|
||||||
|
this.atLimit.y = true;
|
||||||
|
this.view.y = this.bounds.bottom - this.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.view.floor();
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A helper function to set both the X and Y properties of the camera at once
|
||||||
|
* without having to use game.camera.x and game.camera.y.
|
||||||
|
*
|
||||||
|
* @method Phaser.Camera#setPosition
|
||||||
|
* @param {number} x - X position.
|
||||||
|
* @param {number} y - Y position.
|
||||||
|
*/
|
||||||
|
setPosition: function (x, y) {
|
||||||
|
|
||||||
|
this.view.x = x;
|
||||||
|
this.view.y = y;
|
||||||
|
|
||||||
|
if (this.bounds)
|
||||||
|
{
|
||||||
|
this.checkBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the size of the view rectangle given the width and height in parameters.
|
||||||
|
*
|
||||||
|
* @method Phaser.Camera#setSize
|
||||||
|
* @param {number} width - The desired width.
|
||||||
|
* @param {number} height - The desired height.
|
||||||
|
*/
|
||||||
|
setSize: function (width, height) {
|
||||||
|
|
||||||
|
this.view.width = width;
|
||||||
|
this.view.height = height;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the camera back to 0,0 and un-follows any object it may have been tracking.
|
||||||
|
*
|
||||||
|
* @method Phaser.Camera#reset
|
||||||
|
*/
|
||||||
|
reset: function () {
|
||||||
|
|
||||||
|
this.target = null;
|
||||||
|
this.view.x = 0;
|
||||||
|
this.view.y = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.Camera.prototype.constructor = Phaser.Camera;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Cameras x coordinate. This value is automatically clamped if it falls outside of the World bounds.
|
||||||
|
* @name Phaser.Camera#x
|
||||||
|
* @property {number} x - Gets or sets the cameras x position.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Camera.prototype, "x", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this.view.x;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
|
||||||
|
this.view.x = value;
|
||||||
|
|
||||||
|
if (this.bounds)
|
||||||
|
{
|
||||||
|
this.checkBounds();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Cameras y coordinate. This value is automatically clamped if it falls outside of the World bounds.
|
||||||
|
* @name Phaser.Camera#y
|
||||||
|
* @property {number} y - Gets or sets the cameras y position.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Camera.prototype, "y", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this.view.y;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
|
||||||
|
this.view.y = value;
|
||||||
|
|
||||||
|
if (this.bounds)
|
||||||
|
{
|
||||||
|
this.checkBounds();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Cameras width. By default this is the same as the Game size and should not be adjusted for now.
|
||||||
|
* @name Phaser.Camera#width
|
||||||
|
* @property {number} width - Gets or sets the cameras width.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Camera.prototype, "width", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this.view.width;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
this.view.width = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Cameras height. By default this is the same as the Game size and should not be adjusted for now.
|
||||||
|
* @name Phaser.Camera#height
|
||||||
|
* @property {number} height - Gets or sets the cameras height.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Camera.prototype, "height", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this.view.height;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
this.view.height = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,840 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: system/Canvas.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: system/Canvas.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Canvas class handles everything related to creating the `canvas` DOM tag that Phaser will use, including styles, offset and aspect ratio.
|
||||||
|
*
|
||||||
|
* @class Phaser.Canvas
|
||||||
|
* @static
|
||||||
|
*/
|
||||||
|
Phaser.Canvas = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a `canvas` DOM element. The element is not automatically added to the document.
|
||||||
|
*
|
||||||
|
* @method Phaser.Canvas.create
|
||||||
|
* @param {number} [width=256] - The width of the canvas element.
|
||||||
|
* @param {number} [height=256] - The height of the canvas element..
|
||||||
|
* @param {string} [id=''] - If given this will be set as the ID of the canvas element, otherwise no ID will be set.
|
||||||
|
* @return {HTMLCanvasElement} The newly created canvas element.
|
||||||
|
*/
|
||||||
|
create: function (width, height, id) {
|
||||||
|
|
||||||
|
width = width || 256;
|
||||||
|
height = height || 256;
|
||||||
|
|
||||||
|
// var canvas = document.createElement('canvas');
|
||||||
|
var canvas = document.createElement(navigator.isCocoonJS ? 'screencanvas' : 'canvas');
|
||||||
|
|
||||||
|
if (typeof id === 'string')
|
||||||
|
{
|
||||||
|
canvas.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.width = width;
|
||||||
|
canvas.height = height;
|
||||||
|
|
||||||
|
canvas.style.display = 'block';
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the DOM offset values of any given element
|
||||||
|
* @method Phaser.Canvas.getOffset
|
||||||
|
* @param {HTMLElement} element - The targeted element that we want to retrieve the offset.
|
||||||
|
* @param {Phaser.Point} [point] - The point we want to take the x/y values of the offset.
|
||||||
|
* @return {Phaser.Point} - A point objet with the offsetX and Y as its properties.
|
||||||
|
*/
|
||||||
|
getOffset: function (element, point) {
|
||||||
|
|
||||||
|
point = point || new Phaser.Point();
|
||||||
|
|
||||||
|
var box = element.getBoundingClientRect();
|
||||||
|
var clientTop = element.clientTop || document.body.clientTop || 0;
|
||||||
|
var clientLeft = element.clientLeft || document.body.clientLeft || 0;
|
||||||
|
|
||||||
|
// Without this check Chrome is now throwing console warnings about strict vs. quirks :(
|
||||||
|
|
||||||
|
var scrollTop = 0;
|
||||||
|
var scrollLeft = 0;
|
||||||
|
|
||||||
|
if (document.compatMode === 'CSS1Compat')
|
||||||
|
{
|
||||||
|
scrollTop = window.pageYOffset || document.documentElement.scrollTop || element.scrollTop || 0;
|
||||||
|
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || element.scrollLeft || 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scrollTop = window.pageYOffset || document.body.scrollTop || element.scrollTop || 0;
|
||||||
|
scrollLeft = window.pageXOffset || document.body.scrollLeft || element.scrollLeft || 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
point.x = box.left + scrollLeft - clientLeft;
|
||||||
|
point.y = box.top + scrollTop - clientTop;
|
||||||
|
|
||||||
|
return point;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the aspect ratio of the given canvas.
|
||||||
|
*
|
||||||
|
* @method Phaser.Canvas.getAspectRatio
|
||||||
|
* @param {HTMLCanvasElement} canvas - The canvas to get the aspect ratio from.
|
||||||
|
* @return {number} The ratio between canvas' width and height.
|
||||||
|
*/
|
||||||
|
getAspectRatio: function (canvas) {
|
||||||
|
return canvas.width / canvas.height;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the background color behind the canvas. This changes the canvas style property.
|
||||||
|
*
|
||||||
|
* @method Phaser.Canvas.setBackgroundColor
|
||||||
|
* @param {HTMLCanvasElement} canvas - The canvas to set the background color on.
|
||||||
|
* @param {string} [color] - The color to set. Can be in the format 'rgb(r,g,b)', or '#RRGGBB' or any valid CSS color.
|
||||||
|
* @return {HTMLCanvasElement} Returns the source canvas.
|
||||||
|
*/
|
||||||
|
setBackgroundColor: function (canvas, color) {
|
||||||
|
|
||||||
|
color = color || 'rgb(0,0,0)';
|
||||||
|
|
||||||
|
canvas.style.backgroundColor = color;
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the touch-action property on the canvas style. Can be used to disable default browser touch actions.
|
||||||
|
*
|
||||||
|
* @method Phaser.Canvas.setTouchAction
|
||||||
|
* @param {HTMLCanvasElement} canvas - The canvas to set the touch action on.
|
||||||
|
* @param {String} [value] - The touch action to set. Defaults to 'none'.
|
||||||
|
* @return {HTMLCanvasElement} The source canvas.
|
||||||
|
*/
|
||||||
|
setTouchAction: function (canvas, value) {
|
||||||
|
|
||||||
|
value = value || 'none';
|
||||||
|
|
||||||
|
canvas.style.msTouchAction = value;
|
||||||
|
canvas.style['ms-touch-action'] = value;
|
||||||
|
canvas.style['touch-action'] = value;
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the user-select property on the canvas style. Can be used to disable default browser selection actions.
|
||||||
|
*
|
||||||
|
* @method Phaser.Canvas.setUserSelect
|
||||||
|
* @param {HTMLCanvasElement} canvas - The canvas to set the touch action on.
|
||||||
|
* @param {String} [value] - The touch action to set. Defaults to 'none'.
|
||||||
|
* @return {HTMLCanvasElement} The source canvas.
|
||||||
|
*/
|
||||||
|
setUserSelect: function (canvas, value) {
|
||||||
|
|
||||||
|
value = value || 'none';
|
||||||
|
|
||||||
|
canvas.style['-webkit-touch-callout'] = value;
|
||||||
|
canvas.style['-webkit-user-select'] = value;
|
||||||
|
canvas.style['-khtml-user-select'] = value;
|
||||||
|
canvas.style['-moz-user-select'] = value;
|
||||||
|
canvas.style['-ms-user-select'] = value;
|
||||||
|
canvas.style['user-select'] = value;
|
||||||
|
canvas.style['-webkit-tap-highlight-color'] = 'rgba(0, 0, 0, 0)';
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the given canvas element to the DOM. The canvas will be added as a child of the given parent.
|
||||||
|
* If no parent is given it will be added as a child of the document.body.
|
||||||
|
*
|
||||||
|
* @method Phaser.Canvas.addToDOM
|
||||||
|
* @param {HTMLCanvasElement} canvas - The canvas to set the touch action on.
|
||||||
|
* @param {string|HTMLElement} parent - The DOM element to add the canvas to.
|
||||||
|
* @param {boolean} [overflowHidden=true] - If set to true it will add the overflow='hidden' style to the parent DOM element.
|
||||||
|
* @return {HTMLCanvasElement} Returns the source canvas.
|
||||||
|
*/
|
||||||
|
addToDOM: function (canvas, parent, overflowHidden) {
|
||||||
|
|
||||||
|
var target;
|
||||||
|
|
||||||
|
if (typeof overflowHidden === 'undefined') { overflowHidden = true; }
|
||||||
|
|
||||||
|
if (parent)
|
||||||
|
{
|
||||||
|
if (typeof parent === 'string')
|
||||||
|
{
|
||||||
|
// hopefully an element ID
|
||||||
|
target = document.getElementById(parent);
|
||||||
|
}
|
||||||
|
else if (typeof parent === 'object' && parent.nodeType === 1)
|
||||||
|
{
|
||||||
|
// quick test for a HTMLelement
|
||||||
|
target = parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback, covers an invalid ID and a non HTMLelement object
|
||||||
|
if (!target)
|
||||||
|
{
|
||||||
|
target = document.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (overflowHidden && target.style)
|
||||||
|
{
|
||||||
|
target.style.overflow = 'hidden';
|
||||||
|
}
|
||||||
|
|
||||||
|
target.appendChild(canvas);
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the transform of the given canvas to the matrix values provided.
|
||||||
|
*
|
||||||
|
* @method Phaser.Canvas.setTransform
|
||||||
|
* @param {CanvasRenderingContext2D} context - The context to set the transform on.
|
||||||
|
* @param {number} translateX - The value to translate horizontally by.
|
||||||
|
* @param {number} translateY - The value to translate vertically by.
|
||||||
|
* @param {number} scaleX - The value to scale horizontally by.
|
||||||
|
* @param {number} scaleY - The value to scale vertically by.
|
||||||
|
* @param {number} skewX - The value to skew horizontaly by.
|
||||||
|
* @param {number} skewY - The value to skew vertically by.
|
||||||
|
* @return {CanvasRenderingContext2D} Returns the source context.
|
||||||
|
*/
|
||||||
|
setTransform: function (context, translateX, translateY, scaleX, scaleY, skewX, skewY) {
|
||||||
|
|
||||||
|
context.setTransform(scaleX, skewX, skewY, scaleY, translateX, translateY);
|
||||||
|
|
||||||
|
return context;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
|
||||||
|
* By default browsers have image smoothing enabled, which isn't always what you visually want, especially
|
||||||
|
* when using pixel art in a game. Note that this sets the property on the context itself, so that any image
|
||||||
|
* drawn to the context will be affected. This sets the property across all current browsers but support is
|
||||||
|
* patchy on earlier browsers, especially on mobile.
|
||||||
|
*
|
||||||
|
* @method Phaser.Canvas.setSmoothingEnabled
|
||||||
|
* @param {CanvasRenderingContext2D} context - The context to enable or disable the image smoothing on.
|
||||||
|
* @param {boolean} value - If set to true it will enable image smoothing, false will disable it.
|
||||||
|
* @return {CanvasRenderingContext2D} Returns the source context.
|
||||||
|
*/
|
||||||
|
setSmoothingEnabled: function (context, value) {
|
||||||
|
|
||||||
|
context['imageSmoothingEnabled'] = value;
|
||||||
|
context['mozImageSmoothingEnabled'] = value;
|
||||||
|
context['oImageSmoothingEnabled'] = value;
|
||||||
|
context['webkitImageSmoothingEnabled'] = value;
|
||||||
|
context['msImageSmoothingEnabled'] = value;
|
||||||
|
|
||||||
|
return context;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the CSS image-rendering property on the given canvas to be 'crisp' (aka 'optimize contrast on webkit').
|
||||||
|
* Note that if this doesn't given the desired result then see the setSmoothingEnabled.
|
||||||
|
*
|
||||||
|
* @method Phaser.Canvas.setImageRenderingCrisp
|
||||||
|
* @param {HTMLCanvasElement} canvas - The canvas to set image-rendering crisp on.
|
||||||
|
* @return {HTMLCanvasElement} Returns the source canvas.
|
||||||
|
*/
|
||||||
|
setImageRenderingCrisp: function (canvas) {
|
||||||
|
|
||||||
|
canvas.style['image-rendering'] = 'optimizeSpeed';
|
||||||
|
canvas.style['image-rendering'] = 'crisp-edges';
|
||||||
|
canvas.style['image-rendering'] = '-moz-crisp-edges';
|
||||||
|
canvas.style['image-rendering'] = '-webkit-optimize-contrast';
|
||||||
|
canvas.style['image-rendering'] = 'optimize-contrast';
|
||||||
|
canvas.style.msInterpolationMode = 'nearest-neighbor';
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the CSS image-rendering property on the given canvas to be 'bicubic' (aka 'auto').
|
||||||
|
* Note that if this doesn't given the desired result then see the CanvasUtils.setSmoothingEnabled method.
|
||||||
|
*
|
||||||
|
* @method Phaser.Canvas.setImageRenderingBicubic
|
||||||
|
* @param {HTMLCanvasElement} canvas The canvas to set image-rendering bicubic on.
|
||||||
|
* @return {HTMLCanvasElement} Returns the source canvas.
|
||||||
|
*/
|
||||||
|
setImageRenderingBicubic: function (canvas) {
|
||||||
|
|
||||||
|
canvas.style['image-rendering'] = 'auto';
|
||||||
|
canvas.style.msInterpolationMode = 'bicubic';
|
||||||
|
|
||||||
|
return canvas;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,574 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: physics/CollisionGroup.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: physics/CollisionGroup.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collision Group
|
||||||
|
*
|
||||||
|
* @class Phaser.Physics.CollisionGroup
|
||||||
|
* @classdesc Physics Collision Group Constructor
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
Phaser.Physics.CollisionGroup = function (bitmask) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} mask - The CollisionGroup bitmask.
|
||||||
|
*/
|
||||||
|
this.mask = bitmask;
|
||||||
|
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,904 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: utils/Color.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: utils/Color.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of methods useful for manipulating and comparing colors.
|
||||||
|
*
|
||||||
|
* @class Phaser.Color
|
||||||
|
*/
|
||||||
|
Phaser.Color = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given an alpha and 3 color values this will return an integer representation of it.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.getColor32
|
||||||
|
* @static
|
||||||
|
* @param {number} alpha - The Alpha value (between 0 and 255).
|
||||||
|
* @param {number} red - The Red channel value (between 0 and 255).
|
||||||
|
* @param {number} green - The Green channel value (between 0 and 255).
|
||||||
|
* @param {number} blue - The Blue channel value (between 0 and 255).
|
||||||
|
* @returns {number} A native color value integer (format: 0xAARRGGBB).
|
||||||
|
*/
|
||||||
|
getColor32: function (alpha, red, green, blue) {
|
||||||
|
return alpha << 24 | red << 16 | green << 8 | blue;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given 3 color values this will return an integer representation of it.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.getColor
|
||||||
|
* @static
|
||||||
|
* @param {number} red - The Red channel value (between 0 and 255).
|
||||||
|
* @param {number} green - The Green channel value (between 0 and 255).
|
||||||
|
* @param {number} blue - The Blue channel value (between 0 and 255).
|
||||||
|
* @returns {number} A native color value integer (format: 0xRRGGBB).
|
||||||
|
*/
|
||||||
|
getColor: function (red, green, blue) {
|
||||||
|
return red << 16 | green << 8 | blue;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the given hex string into an integer color value.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.hexToRGB
|
||||||
|
* @static
|
||||||
|
* @param {string} h - The string hex color to convert.
|
||||||
|
* @returns {number} The rgb color value.
|
||||||
|
*/
|
||||||
|
hexToRGB: function (h) {
|
||||||
|
|
||||||
|
var hex16 = (h.charAt(0) == "#") ? h.substring(1, 7) : h;
|
||||||
|
|
||||||
|
if (hex16.length==3)
|
||||||
|
{
|
||||||
|
hex16 = hex16.charAt(0) + hex16.charAt(0) + hex16.charAt(1) + hex16.charAt(1) + hex16.charAt(2) + hex16.charAt(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
var red = parseInt(hex16.substring(0, 2), 16);
|
||||||
|
var green = parseInt(hex16.substring(2, 4), 16);
|
||||||
|
var blue = parseInt(hex16.substring(4, 6), 16);
|
||||||
|
|
||||||
|
return red << 16 | green << 8 | blue;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string containing handy information about the given color including string hex value,
|
||||||
|
* RGB format information and HSL information. Each section starts on a newline, 3 lines in total.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.getColorInfo
|
||||||
|
* @static
|
||||||
|
* @param {number} color - A color value in the format 0xAARRGGBB.
|
||||||
|
* @returns {string} String containing the 3 lines of information.
|
||||||
|
*/
|
||||||
|
getColorInfo: function (color) {
|
||||||
|
|
||||||
|
var argb = Phaser.Color.getRGB(color);
|
||||||
|
var hsl = Phaser.Color.RGBtoHSV(color);
|
||||||
|
|
||||||
|
// Hex format
|
||||||
|
var result = Phaser.Color.RGBtoHexstring(color) + "\n";
|
||||||
|
|
||||||
|
// RGB format
|
||||||
|
result = result.concat("Alpha: " + argb.alpha + " Red: " + argb.red + " Green: " + argb.green + " Blue: " + argb.blue) + "\n";
|
||||||
|
|
||||||
|
// HSL info
|
||||||
|
result = result.concat("Hue: " + hsl.hue + " Saturation: " + hsl.saturation + " Lightnes: " + hsl.lightness);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a string representation of the color in the format 0xAARRGGBB.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.RGBtoHexstring
|
||||||
|
* @static
|
||||||
|
* @param {number} color - The color to get the string representation for
|
||||||
|
* @returns {string} A string of length 10 characters in the format 0xAARRGGBB
|
||||||
|
*/
|
||||||
|
RGBtoHexstring: function (color) {
|
||||||
|
|
||||||
|
var argb = Phaser.Color.getRGB(color);
|
||||||
|
|
||||||
|
return "0x" + Phaser.Color.colorToHexstring(argb.alpha) + Phaser.Color.colorToHexstring(argb.red) + Phaser.Color.colorToHexstring(argb.green) + Phaser.Color.colorToHexstring(argb.blue);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a string representation of the color in the format #RRGGBB.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.RGBtoWebstring
|
||||||
|
* @static
|
||||||
|
* @param {number} color - The color to get the string representation for.
|
||||||
|
* @returns {string} A string of length 10 characters in the format 0xAARRGGBB.
|
||||||
|
*/
|
||||||
|
RGBtoWebstring: function (color) {
|
||||||
|
|
||||||
|
var argb = Phaser.Color.getRGB(color);
|
||||||
|
|
||||||
|
return "#" + Phaser.Color.colorToHexstring(argb.red) + Phaser.Color.colorToHexstring(argb.green) + Phaser.Color.colorToHexstring(argb.blue);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a string containing a hex representation of the given color.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.colorToHexstring
|
||||||
|
* @static
|
||||||
|
* @param {number} color - The color channel to get the hex value for, must be a value between 0 and 255).
|
||||||
|
* @returns {string} A string of length 2 characters, i.e. 255 = FF, 0 = 00.
|
||||||
|
*/
|
||||||
|
colorToHexstring: function (color) {
|
||||||
|
|
||||||
|
var digits = "0123456789ABCDEF";
|
||||||
|
var lsd = color % 16;
|
||||||
|
var msd = (color - lsd) / 16;
|
||||||
|
var hexified = digits.charAt(msd) + digits.charAt(lsd);
|
||||||
|
return hexified;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interpolates the two given colours based on the supplied step and currentStep properties.
|
||||||
|
* @method Phaser.Color.interpolateColor
|
||||||
|
* @static
|
||||||
|
* @param {number} color1 - The first color value.
|
||||||
|
* @param {number} color2 - The second color value.
|
||||||
|
* @param {number} steps - The number of steps to run the interpolation over.
|
||||||
|
* @param {number} currentStep - The currentStep value. If the interpolation will take 100 steps, a currentStep value of 50 would be half-way between the two.
|
||||||
|
* @param {number} alpha - The alpha of the returned color.
|
||||||
|
* @returns {number} The interpolated color value.
|
||||||
|
*/
|
||||||
|
interpolateColor: function (color1, color2, steps, currentStep, alpha) {
|
||||||
|
|
||||||
|
if (typeof alpha === "undefined") { alpha = 255; }
|
||||||
|
|
||||||
|
var src1 = Phaser.Color.getRGB(color1);
|
||||||
|
var src2 = Phaser.Color.getRGB(color2);
|
||||||
|
var r = (((src2.red - src1.red) * currentStep) / steps) + src1.red;
|
||||||
|
var g = (((src2.green - src1.green) * currentStep) / steps) + src1.green;
|
||||||
|
var b = (((src2.blue - src1.blue) * currentStep) / steps) + src1.blue;
|
||||||
|
|
||||||
|
return Phaser.Color.getColor32(alpha, r, g, b);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interpolates the two given colours based on the supplied step and currentStep properties.
|
||||||
|
* @method Phaser.Color.interpolateColorWithRGB
|
||||||
|
* @static
|
||||||
|
* @param {number} color - The first color value.
|
||||||
|
* @param {number} r - The red color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} g - The green color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} b - The blue color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} steps - The number of steps to run the interpolation over.
|
||||||
|
* @param {number} currentStep - The currentStep value. If the interpolation will take 100 steps, a currentStep value of 50 would be half-way between the two.
|
||||||
|
* @returns {number} The interpolated color value.
|
||||||
|
*/
|
||||||
|
interpolateColorWithRGB: function (color, r, g, b, steps, currentStep) {
|
||||||
|
|
||||||
|
var src = Phaser.Color.getRGB(color);
|
||||||
|
var or = (((r - src.red) * currentStep) / steps) + src.red;
|
||||||
|
var og = (((g - src.green) * currentStep) / steps) + src.green;
|
||||||
|
var ob = (((b - src.blue) * currentStep) / steps) + src.blue;
|
||||||
|
|
||||||
|
return Phaser.Color.getColor(or, og, ob);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interpolates the two given colours based on the supplied step and currentStep properties.
|
||||||
|
* @method Phaser.Color.interpolateRGB
|
||||||
|
* @static
|
||||||
|
* @param {number} r1 - The red color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} g1 - The green color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} b1 - The blue color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} r2 - The red color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} g2 - The green color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} b2 - The blue color value, between 0 and 0xFF (255).
|
||||||
|
* @param {number} steps - The number of steps to run the interpolation over.
|
||||||
|
* @param {number} currentStep - The currentStep value. If the interpolation will take 100 steps, a currentStep value of 50 would be half-way between the two.
|
||||||
|
* @returns {number} The interpolated color value.
|
||||||
|
*/
|
||||||
|
interpolateRGB: function (r1, g1, b1, r2, g2, b2, steps, currentStep) {
|
||||||
|
|
||||||
|
var r = (((r2 - r1) * currentStep) / steps) + r1;
|
||||||
|
var g = (((g2 - g1) * currentStep) / steps) + g1;
|
||||||
|
var b = (((b2 - b1) * currentStep) / steps) + b1;
|
||||||
|
|
||||||
|
return Phaser.Color.getColor(r, g, b);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a random color value between black and white
|
||||||
|
* Set the min value to start each channel from the given offset.
|
||||||
|
* Set the max value to restrict the maximum color used per channel.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.getRandomColor
|
||||||
|
* @static
|
||||||
|
* @param {number} min - The lowest value to use for the color.
|
||||||
|
* @param {number} max - The highest value to use for the color.
|
||||||
|
* @param {number} alpha - The alpha value of the returning color (default 255 = fully opaque).
|
||||||
|
* @returns {number} 32-bit color value with alpha.
|
||||||
|
*/
|
||||||
|
getRandomColor: function (min, max, alpha) {
|
||||||
|
|
||||||
|
if (typeof min === "undefined") { min = 0; }
|
||||||
|
if (typeof max === "undefined") { max = 255; }
|
||||||
|
if (typeof alpha === "undefined") { alpha = 255; }
|
||||||
|
|
||||||
|
// Sanity checks
|
||||||
|
if (max > 255) {
|
||||||
|
return Phaser.Color.getColor(255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (min > max) {
|
||||||
|
return Phaser.Color.getColor(255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
var red = min + Math.round(Math.random() * (max - min));
|
||||||
|
var green = min + Math.round(Math.random() * (max - min));
|
||||||
|
var blue = min + Math.round(Math.random() * (max - min));
|
||||||
|
|
||||||
|
return Phaser.Color.getColor32(alpha, red, green, blue);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the component parts of a color as an Object with the properties alpha, red, green, blue
|
||||||
|
*
|
||||||
|
* Alpha will only be set if it exist in the given color (0xAARRGGBB)
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.getRGB
|
||||||
|
* @static
|
||||||
|
* @param {number} color - Color in RGB (0xRRGGBB) or ARGB format (0xAARRGGBB).
|
||||||
|
* @returns {object} An Object with properties: alpha, red, green, blue.
|
||||||
|
*/
|
||||||
|
getRGB: function (color) {
|
||||||
|
|
||||||
|
return {
|
||||||
|
alpha: color >>> 24,
|
||||||
|
red: color >> 16 & 0xFF,
|
||||||
|
green: color >> 8 & 0xFF,
|
||||||
|
blue: color & 0xFF
|
||||||
|
};
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a CSS friendly string value from the given color.
|
||||||
|
* @method Phaser.Color.getWebRGB
|
||||||
|
* @static
|
||||||
|
* @param {number} color
|
||||||
|
* @returns {string}A string in the format: 'rgba(r,g,b,a)'
|
||||||
|
*/
|
||||||
|
getWebRGB: function (color) {
|
||||||
|
|
||||||
|
var alpha = (color >>> 24) / 255;
|
||||||
|
var red = color >> 16 & 0xFF;
|
||||||
|
var green = color >> 8 & 0xFF;
|
||||||
|
var blue = color & 0xFF;
|
||||||
|
|
||||||
|
return 'rgba(' + red.toString() + ',' + green.toString() + ',' + blue.toString() + ',' + alpha.toString() + ')';
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a native color value (in the format 0xAARRGGBB) this will return the Alpha component, as a value between 0 and 255.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.getAlpha
|
||||||
|
* @static
|
||||||
|
* @param {number} color - In the format 0xAARRGGBB.
|
||||||
|
* @returns {number} The Alpha component of the color, will be between 0 and 1 (0 being no Alpha (opaque), 1 full Alpha (transparent)).
|
||||||
|
*/
|
||||||
|
getAlpha: function (color) {
|
||||||
|
return color >>> 24;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a native color value (in the format 0xAARRGGBB) this will return the Alpha component as a value between 0 and 1.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.getAlphaFloat
|
||||||
|
* @static
|
||||||
|
* @param {number} color - In the format 0xAARRGGBB.
|
||||||
|
* @returns {number} The Alpha component of the color, will be between 0 and 1 (0 being no Alpha (opaque), 1 full Alpha (transparent)).
|
||||||
|
*/
|
||||||
|
getAlphaFloat: function (color) {
|
||||||
|
return (color >>> 24) / 255;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a native color value (in the format 0xAARRGGBB) this will return the Red component, as a value between 0 and 255.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.getRed
|
||||||
|
* @static
|
||||||
|
* @param {number} color In the format 0xAARRGGBB.
|
||||||
|
* @returns {number} The Red component of the color, will be between 0 and 255 (0 being no color, 255 full Red).
|
||||||
|
*/
|
||||||
|
getRed: function (color) {
|
||||||
|
return color >> 16 & 0xFF;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a native color value (in the format 0xAARRGGBB) this will return the Green component, as a value between 0 and 255.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.getGreen
|
||||||
|
* @static
|
||||||
|
* @param {number} color - In the format 0xAARRGGBB.
|
||||||
|
* @returns {number} The Green component of the color, will be between 0 and 255 (0 being no color, 255 full Green).
|
||||||
|
*/
|
||||||
|
getGreen: function (color) {
|
||||||
|
return color >> 8 & 0xFF;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a native color value (in the format 0xAARRGGBB) this will return the Blue component, as a value between 0 and 255.
|
||||||
|
*
|
||||||
|
* @method Phaser.Color.getBlue
|
||||||
|
* @static
|
||||||
|
* @param {number} color - In the format 0xAARRGGBB.
|
||||||
|
* @returns {number} The Blue component of the color, will be between 0 and 255 (0 being no color, 255 full Blue).
|
||||||
|
*/
|
||||||
|
getBlue: function (color) {
|
||||||
|
return color & 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,617 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: physics/ContactMaterial.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: physics/ContactMaterial.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a physics material
|
||||||
|
*
|
||||||
|
* @class Phaser.Physics.ContactMaterial
|
||||||
|
* @classdesc Physics ContactMaterial Constructor
|
||||||
|
* @constructor
|
||||||
|
* @param {Phaser.Physics.Material} materialA
|
||||||
|
* @param {Phaser.Physics.Material} materialB
|
||||||
|
* @param {object} [options]
|
||||||
|
*/
|
||||||
|
Phaser.Physics.ContactMaterial = function (materialA, materialB, options) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} id - The contact material identifier.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Physics.Material} materialA - First material participating in the contact material.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Physics.Material} materialB - First second participating in the contact material.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} [friction=0.3] - Friction to use in the contact of these two materials.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} [restitution=0.0] - Restitution to use in the contact of these two materials.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} [stiffness=1e7] - Stiffness of the resulting ContactEquation that this ContactMaterial generate.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} [relaxation=3] - Relaxation of the resulting ContactEquation that this ContactMaterial generate.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} [frictionStiffness=1e7] - Stiffness of the resulting FrictionEquation that this ContactMaterial generate.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} [frictionRelaxation=3] - Relaxation of the resulting FrictionEquation that this ContactMaterial generate.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} [surfaceVelocity=0] - Will add surface velocity to this material. If bodyA rests on top if bodyB, and the surface velocity is positive, bodyA will slide to the right.
|
||||||
|
*/
|
||||||
|
|
||||||
|
p2.ContactMaterial.call(this, materialA, materialB, options);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Phaser.Physics.ContactMaterial.prototype = Object.create(p2.ContactMaterial.prototype);
|
||||||
|
Phaser.Physics.ContactMaterial.prototype.constructor = Phaser.Physics.ContactMaterial;
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,849 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: geom/Ellipse.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: geom/Ellipse.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @author Chad Engler <chad@pantherdev.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Ellipse object. A curve on a plane surrounding two focal points.
|
||||||
|
* @class Ellipse
|
||||||
|
* @classdesc Phaser - Ellipse
|
||||||
|
* @constructor
|
||||||
|
* @param {number} [x=0] - The X coordinate of the upper-left corner of the framing rectangle of this ellipse.
|
||||||
|
* @param {number} [y=0] - The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.
|
||||||
|
* @param {number} [width=0] - The overall width of this ellipse.
|
||||||
|
* @param {number} [height=0] - The overall height of this ellipse.
|
||||||
|
* @return {Phaser.Ellipse} This Ellipse object
|
||||||
|
*/
|
||||||
|
Phaser.Ellipse = function (x, y, width, height) {
|
||||||
|
|
||||||
|
this.type = Phaser.ELLIPSE;
|
||||||
|
|
||||||
|
x = x || 0;
|
||||||
|
y = y || 0;
|
||||||
|
width = width || 0;
|
||||||
|
height = height || 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} x - The X coordinate of the upper-left corner of the framing rectangle of this ellipse.
|
||||||
|
*/
|
||||||
|
this.x = x;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} y - The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.
|
||||||
|
*/
|
||||||
|
this.y = y;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} width - The overall width of this ellipse.
|
||||||
|
*/
|
||||||
|
this.width = width;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} height - The overall height of this ellipse.
|
||||||
|
*/
|
||||||
|
this.height = height;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.Ellipse.prototype = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the members of the Ellipse to the specified values.
|
||||||
|
* @method Phaser.Ellipse#setTo
|
||||||
|
* @param {number} x - The X coordinate of the upper-left corner of the framing rectangle of this ellipse.
|
||||||
|
* @param {number} y - The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.
|
||||||
|
* @param {number} width - The overall width of this ellipse.
|
||||||
|
* @param {number} height - The overall height of this ellipse.
|
||||||
|
* @return {Phaser.Ellipse} This Ellipse object.
|
||||||
|
*/
|
||||||
|
setTo: function (x, y, width, height) {
|
||||||
|
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies the x, y, width and height properties from any given object to this Ellipse.
|
||||||
|
* @method Phaser.Ellipse#copyFrom
|
||||||
|
* @param {any} source - The object to copy from.
|
||||||
|
* @return {Phaser.Ellipse} This Ellipse object.
|
||||||
|
*/
|
||||||
|
copyFrom: function (source) {
|
||||||
|
|
||||||
|
return this.setTo(source.x, source.y, source.width, source.height);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies the x, y and diameter properties from this Circle to any given object.
|
||||||
|
* @method Phaser.Ellipse#copyTo
|
||||||
|
* @param {any} dest - The object to copy to.
|
||||||
|
* @return {Object} This dest object.
|
||||||
|
*/
|
||||||
|
copyTo: function(dest) {
|
||||||
|
|
||||||
|
dest.x = this.x;
|
||||||
|
dest.y = this.y;
|
||||||
|
dest.width = this.width;
|
||||||
|
dest.height = this.height;
|
||||||
|
|
||||||
|
return dest;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new Ellipse object with the same values for the x, y, width, and height properties as this Ellipse object.
|
||||||
|
* @method Phaser.Ellipse#clone
|
||||||
|
* @param {Phaser.Ellipse} out - Optional Ellipse object. If given the values will be set into the object, otherwise a brand new Ellipse object will be created and returned.
|
||||||
|
* @return {Phaser.Ellipse} The cloned Ellipse object.
|
||||||
|
*/
|
||||||
|
clone: function(out) {
|
||||||
|
|
||||||
|
if (typeof out === "undefined")
|
||||||
|
{
|
||||||
|
out = new Phaser.Ellipse(this.x, this.y, this.width, this.height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
out.setTo(this.x, this.y, this.width, this.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the given x/y coordinates are within this Ellipse object.
|
||||||
|
* @method Phaser.Ellipse#contains
|
||||||
|
* @param {number} x - The X value of the coordinate to test.
|
||||||
|
* @param {number} y - The Y value of the coordinate to test.
|
||||||
|
* @return {boolean} True if the coordinates are within this ellipse, otherwise false.
|
||||||
|
*/
|
||||||
|
contains: function (x, y) {
|
||||||
|
|
||||||
|
return Phaser.Ellipse.contains(this, x, y);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this object.
|
||||||
|
* @method Phaser.Ellipse#toString
|
||||||
|
* @return {string} A string representation of the instance.
|
||||||
|
*/
|
||||||
|
toString: function () {
|
||||||
|
return "[{Phaser.Ellipse (x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + ")}]";
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.Ellipse.prototype.constructor = Phaser.Ellipse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The left coordinate of the Ellipse. The same as the X coordinate.
|
||||||
|
* @name Phaser.Ellipse#left
|
||||||
|
* @propety {number} left - Gets or sets the value of the leftmost point of the ellipse.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Ellipse.prototype, "left", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this.x;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
|
||||||
|
this.x = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The x coordinate of the rightmost point of the Ellipse. Changing the right property of an Ellipse object has no effect on the x property, but does adjust the width.
|
||||||
|
* @name Phaser.Ellipse#right
|
||||||
|
* @property {number} right - Gets or sets the value of the rightmost point of the ellipse.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Ellipse.prototype, "right", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this.x + this.width;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
|
||||||
|
if (value < this.x)
|
||||||
|
{
|
||||||
|
this.width = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.width = this.x + width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The top of the Ellipse. The same as its y property.
|
||||||
|
* @name Phaser.Ellipse#top
|
||||||
|
* @property {number} top - Gets or sets the top of the ellipse.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Ellipse.prototype, "top", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this.y;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
this.y = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sum of the y and height properties. Changing the bottom property of an Ellipse doesn't adjust the y property, but does change the height.
|
||||||
|
* @name Phaser.Ellipse#bottom
|
||||||
|
* @property {number} bottom - Gets or sets the bottom of the ellipse.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Ellipse.prototype, "bottom", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this.y + this.height;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
|
||||||
|
if (value < this.y)
|
||||||
|
{
|
||||||
|
this.height = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.height = this.y + value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether or not this Ellipse object is empty. Will return a value of true if the Ellipse objects dimensions are less than or equal to 0; otherwise false.
|
||||||
|
* If set to true it will reset all of the Ellipse objects properties to 0. An Ellipse object is empty if its width or height is less than or equal to 0.
|
||||||
|
* @name Phaser.Ellipse#empty
|
||||||
|
* @property {boolean} empty - Gets or sets the empty state of the ellipse.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Ellipse.prototype, "empty", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return (this.width === 0 || this.height === 0);
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
|
||||||
|
if (value === true)
|
||||||
|
{
|
||||||
|
this.setTo(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the given x/y coordinates are within the Ellipse object.
|
||||||
|
* @method Phaser.Ellipse.contains
|
||||||
|
* @param {Phaser.Ellipse} a - The Ellipse to be checked.
|
||||||
|
* @param {number} x - The X value of the coordinate to test.
|
||||||
|
* @param {number} y - The Y value of the coordinate to test.
|
||||||
|
* @return {boolean} True if the coordinates are within this ellipse, otherwise false.
|
||||||
|
*/
|
||||||
|
Phaser.Ellipse.contains = function (a, x, y) {
|
||||||
|
|
||||||
|
if (a.width <= 0 || a.height <= 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalize the coords to an ellipse with center 0,0 and a radius of 0.5
|
||||||
|
var normx = ((x - a.x) / a.width) - 0.5;
|
||||||
|
var normy = ((y - a.y) / a.height) - 0.5;
|
||||||
|
|
||||||
|
normx *= normx;
|
||||||
|
normy *= normy;
|
||||||
|
|
||||||
|
return (normx + normy < 0.25);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the framing rectangle of the ellipse as a Phaser.Rectangle object.
|
||||||
|
*
|
||||||
|
* @method getBounds
|
||||||
|
* @return {Phaser.Rectangle} The framing rectangle
|
||||||
|
*/
|
||||||
|
Phaser.Ellipse.prototype.getBounds = function() {
|
||||||
|
|
||||||
|
return new Phaser.Rectangle(this.x, this.y, this.width, this.height);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Because PIXI uses its own Ellipse, we'll replace it with ours to avoid duplicating code or confusion.
|
||||||
|
PIXI.Ellipse = Phaser.Ellipse;
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:33 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,632 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: gameobjects/Events.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: gameobjects/Events.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Phaser.Events
|
||||||
|
*
|
||||||
|
* @classdesc The Events component is a collection of events fired by the parent game object.
|
||||||
|
*
|
||||||
|
* For example to tell when a Sprite has been added to a new group:
|
||||||
|
*
|
||||||
|
* ```sprite.events.onAddedToGroup.add(yourFunction, this);```
|
||||||
|
*
|
||||||
|
* Where `yourFunction` is the function you want called when this event occurs.
|
||||||
|
*
|
||||||
|
* Note that the Input related events only exist if the Sprite has had `inputEnabled` set to `true`.
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
*
|
||||||
|
* @param {Phaser.Sprite} sprite - A reference to Description.
|
||||||
|
*/
|
||||||
|
Phaser.Events = function (sprite) {
|
||||||
|
|
||||||
|
this.parent = sprite;
|
||||||
|
|
||||||
|
this.onAddedToGroup = new Phaser.Signal();
|
||||||
|
this.onRemovedFromGroup = new Phaser.Signal();
|
||||||
|
this.onKilled = new Phaser.Signal();
|
||||||
|
this.onRevived = new Phaser.Signal();
|
||||||
|
this.onOutOfBounds = new Phaser.Signal();
|
||||||
|
|
||||||
|
this.onInputOver = null;
|
||||||
|
this.onInputOut = null;
|
||||||
|
this.onInputDown = null;
|
||||||
|
this.onInputUp = null;
|
||||||
|
this.onDragStart = null;
|
||||||
|
this.onDragStop = null;
|
||||||
|
|
||||||
|
this.onAnimationStart = null;
|
||||||
|
this.onAnimationComplete = null;
|
||||||
|
this.onAnimationLoop = null;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.Events.prototype = {
|
||||||
|
|
||||||
|
destroy: function () {
|
||||||
|
|
||||||
|
this.parent = null;
|
||||||
|
this.onAddedToGroup.dispose();
|
||||||
|
this.onRemovedFromGroup.dispose();
|
||||||
|
this.onKilled.dispose();
|
||||||
|
this.onRevived.dispose();
|
||||||
|
this.onOutOfBounds.dispose();
|
||||||
|
|
||||||
|
if (this.onInputOver)
|
||||||
|
{
|
||||||
|
this.onInputOver.dispose();
|
||||||
|
this.onInputOut.dispose();
|
||||||
|
this.onInputDown.dispose();
|
||||||
|
this.onInputUp.dispose();
|
||||||
|
this.onDragStart.dispose();
|
||||||
|
this.onDragStop.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.onAnimationStart)
|
||||||
|
{
|
||||||
|
this.onAnimationStart.dispose();
|
||||||
|
this.onAnimationComplete.dispose();
|
||||||
|
this.onAnimationLoop.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.Events.prototype.constructor = Phaser.Events;
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,718 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: core/Filter.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: core/Filter.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a base Filter template to use for any Phaser filter development.
|
||||||
|
*
|
||||||
|
* @class Phaser.Filter
|
||||||
|
* @classdesc Phaser - Filter
|
||||||
|
* @constructor
|
||||||
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
* @param {Object} uniforms - Uniform mappings object
|
||||||
|
* @param {Array} fragmentSrc - The fragment shader code.
|
||||||
|
*/
|
||||||
|
Phaser.Filter = function (game, uniforms, fragmentSrc) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
*/
|
||||||
|
this.game = game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} type - The const type of this object, either Phaser.WEBGL_FILTER or Phaser.CANVAS_FILTER.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.type = Phaser.WEBGL_FILTER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of passes - some filters contain a few steps this array simply stores the steps in a linear fashion.
|
||||||
|
* For example the blur filter has two passes blurX and blurY.
|
||||||
|
* @property {array} passes - An array of filter objects.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this.passes = [this];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {array} shaders - Array an array of shaders.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this.shaders = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {boolean} dirty - Internal PIXI var.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.dirty = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} padding - Internal PIXI var.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.padding = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {object} uniforms - Default uniform mappings.
|
||||||
|
*/
|
||||||
|
this.uniforms = {
|
||||||
|
|
||||||
|
time: { type: '1f', value: 0 },
|
||||||
|
resolution: { type: '2f', value: { x: 256, y: 256 }},
|
||||||
|
mouse: { type: '2f', value: { x: 0.0, y: 0.0 }}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {array} fragmentSrc - The fragment shader code.
|
||||||
|
*/
|
||||||
|
this.fragmentSrc = fragmentSrc || [];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.Filter.prototype = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be over-ridden.
|
||||||
|
* @method Phaser.Filter#init
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
// This should be over-ridden. Will receive a variable number of arguments.
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the resolution uniforms on the filter.
|
||||||
|
* @method Phaser.Filter#setResolution
|
||||||
|
* @param {number} width - The width of the display.
|
||||||
|
* @param {number} height - The height of the display.
|
||||||
|
*/
|
||||||
|
setResolution: function (width, height) {
|
||||||
|
|
||||||
|
this.uniforms.resolution.value.x = width;
|
||||||
|
this.uniforms.resolution.value.y = height;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the filter.
|
||||||
|
* @method Phaser.Filter#update
|
||||||
|
* @param {Phaser.Pointer} [pointer] - A Pointer object to use for the filter. The coordinates are mapped to the mouse uniform.
|
||||||
|
*/
|
||||||
|
update: function (pointer) {
|
||||||
|
|
||||||
|
if (typeof pointer !== 'undefined')
|
||||||
|
{
|
||||||
|
if (pointer.x > 0)
|
||||||
|
{
|
||||||
|
this.uniforms.mouse.x = pointer.x.toFixed(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pointer.y > 0)
|
||||||
|
{
|
||||||
|
this.uniforms.mouse.y = pointer.y.toFixed(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.uniforms.time.value = this.game.time.totalElapsedSeconds();
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear down this Filter and null out references
|
||||||
|
* @method Phaser.Filter#destroy
|
||||||
|
*/
|
||||||
|
destroy: function () {
|
||||||
|
|
||||||
|
this.game = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.Filter.prototype.constructor = Phaser.Filter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Phaser.Filter#width
|
||||||
|
* @property {number} width - The width (resolution uniform)
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Filter.prototype, 'width', {
|
||||||
|
|
||||||
|
get: function() {
|
||||||
|
return this.uniforms.resolution.value.x;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(value) {
|
||||||
|
this.uniforms.resolution.value.x = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Phaser.Filter#height
|
||||||
|
* @property {number} height - The height (resolution uniform)
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Filter.prototype, 'height', {
|
||||||
|
|
||||||
|
get: function() {
|
||||||
|
return this.uniforms.resolution.value.y;
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(value) {
|
||||||
|
this.uniforms.resolution.value.y = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,737 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: animation/Frame.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: animation/Frame.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Frame is a single frame of an animation and is part of a FrameData collection.
|
||||||
|
*
|
||||||
|
* @class Phaser.Frame
|
||||||
|
* @constructor
|
||||||
|
* @param {number} index - The index of this Frame within the FrameData set it is being added to.
|
||||||
|
* @param {number} x - X position of the frame within the texture image.
|
||||||
|
* @param {number} y - Y position of the frame within the texture image.
|
||||||
|
* @param {number} width - Width of the frame within the texture image.
|
||||||
|
* @param {number} height - Height of the frame within the texture image.
|
||||||
|
* @param {string} name - The name of the frame. In Texture Atlas data this is usually set to the filename.
|
||||||
|
* @param {string} uuid - Internal UUID key.
|
||||||
|
*/
|
||||||
|
Phaser.Frame = function (index, x, y, width, height, name, uuid) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} index - The index of this Frame within the FrameData set it is being added to.
|
||||||
|
*/
|
||||||
|
this.index = index;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} x - X position within the image to cut from.
|
||||||
|
*/
|
||||||
|
this.x = x;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} y - Y position within the image to cut from.
|
||||||
|
*/
|
||||||
|
this.y = y;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} width - Width of the frame.
|
||||||
|
*/
|
||||||
|
this.width = width;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} height - Height of the frame.
|
||||||
|
*/
|
||||||
|
this.height = height;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {string} name - Useful for Texture Atlas files (is set to the filename value).
|
||||||
|
*/
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {string} uuid - A link to the PIXI.TextureCache entry.
|
||||||
|
*/
|
||||||
|
this.uuid = uuid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} centerX - Center X position within the image to cut from.
|
||||||
|
*/
|
||||||
|
this.centerX = Math.floor(width / 2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} centerY - Center Y position within the image to cut from.
|
||||||
|
*/
|
||||||
|
this.centerY = Math.floor(height / 2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} distance - The distance from the top left to the bottom-right of this Frame.
|
||||||
|
*/
|
||||||
|
this.distance = Phaser.Math.distance(0, 0, width, height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {boolean} rotated - Rotated? (not yet implemented)
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.rotated = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {string} rotationDirection - Either 'cw' or 'ccw', rotation is always 90 degrees.
|
||||||
|
* @default 'cw'
|
||||||
|
*/
|
||||||
|
this.rotationDirection = 'cw';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {boolean} trimmed - Was it trimmed when packed?
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.trimmed = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} sourceSizeW - Width of the original sprite.
|
||||||
|
*/
|
||||||
|
this.sourceSizeW = width;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} sourceSizeH - Height of the original sprite.
|
||||||
|
*/
|
||||||
|
this.sourceSizeH = height;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} spriteSourceSizeX - X position of the trimmed sprite inside original sprite.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.spriteSourceSizeX = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} spriteSourceSizeY - Y position of the trimmed sprite inside original sprite.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.spriteSourceSizeY = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} spriteSourceSizeW - Width of the trimmed sprite.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.spriteSourceSizeW = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} spriteSourceSizeH - Height of the trimmed sprite.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.spriteSourceSizeH = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.Frame.prototype = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the frame was trimmed when added to the Texture Atlas this records the trim and source data.
|
||||||
|
*
|
||||||
|
* @method Phaser.Frame#setTrim
|
||||||
|
* @param {boolean} trimmed - If this frame was trimmed or not.
|
||||||
|
* @param {number} actualWidth - The width of the frame before being trimmed.
|
||||||
|
* @param {number} actualHeight - The height of the frame before being trimmed.
|
||||||
|
* @param {number} destX - The destination X position of the trimmed frame for display.
|
||||||
|
* @param {number} destY - The destination Y position of the trimmed frame for display.
|
||||||
|
* @param {number} destWidth - The destination width of the trimmed frame for display.
|
||||||
|
* @param {number} destHeight - The destination height of the trimmed frame for display.
|
||||||
|
*/
|
||||||
|
setTrim: function (trimmed, actualWidth, actualHeight, destX, destY, destWidth, destHeight) {
|
||||||
|
|
||||||
|
this.trimmed = trimmed;
|
||||||
|
|
||||||
|
if (trimmed)
|
||||||
|
{
|
||||||
|
this.width = actualWidth;
|
||||||
|
this.height = actualHeight;
|
||||||
|
this.sourceSizeW = actualWidth;
|
||||||
|
this.sourceSizeH = actualHeight;
|
||||||
|
this.centerX = Math.floor(actualWidth / 2);
|
||||||
|
this.centerY = Math.floor(actualHeight / 2);
|
||||||
|
this.spriteSourceSizeX = destX;
|
||||||
|
this.spriteSourceSizeY = destY;
|
||||||
|
this.spriteSourceSizeW = destWidth;
|
||||||
|
this.spriteSourceSizeH = destHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a Rectangle set to the dimensions of this Frame.
|
||||||
|
*
|
||||||
|
* @method Phaser.Frame#getRect
|
||||||
|
* @param {Phaser.Rectangle} [out] - A rectangle to copy the frame dimensions to.
|
||||||
|
* @return {Phaser.Rectangle} A rectangle.
|
||||||
|
*/
|
||||||
|
getRect: function (out) {
|
||||||
|
|
||||||
|
if (typeof out === 'undefined')
|
||||||
|
{
|
||||||
|
out = new Phaser.Rectangle(this.x, this.y, this.width, this.height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
out.setTo(this.x, this.y, this.width, this.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.Frame.prototype.constructor = Phaser.Frame;
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,792 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: animation/FrameData.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: animation/FrameData.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FrameData is a container for Frame objects, which are the internal representation of animation data in Phaser.
|
||||||
|
*
|
||||||
|
* @class Phaser.FrameData
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
Phaser.FrameData = function () {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Array} _frames - Local array of frames.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._frames = [];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Array} _frameNames - Local array of frame names for name to index conversions.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._frameNames = [];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.FrameData.prototype = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new Frame to this FrameData collection. Typically called by the Animation.Parser and not directly.
|
||||||
|
*
|
||||||
|
* @method Phaser.FrameData#addFrame
|
||||||
|
* @param {Phaser.Frame} frame - The frame to add to this FrameData set.
|
||||||
|
* @return {Phaser.Frame} The frame that was just added.
|
||||||
|
*/
|
||||||
|
addFrame: function (frame) {
|
||||||
|
|
||||||
|
frame.index = this._frames.length;
|
||||||
|
|
||||||
|
this._frames.push(frame);
|
||||||
|
|
||||||
|
if (frame.name !== '')
|
||||||
|
{
|
||||||
|
this._frameNames[frame.name] = frame.index;
|
||||||
|
}
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Frame by its numerical index.
|
||||||
|
*
|
||||||
|
* @method Phaser.FrameData#getFrame
|
||||||
|
* @param {number} index - The index of the frame you want to get.
|
||||||
|
* @return {Phaser.Frame} The frame, if found.
|
||||||
|
*/
|
||||||
|
getFrame: function (index) {
|
||||||
|
|
||||||
|
if (index > this._frames.length)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._frames[index];
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a Frame by its frame name.
|
||||||
|
*
|
||||||
|
* @method Phaser.FrameData#getFrameByName
|
||||||
|
* @param {string} name - The name of the frame you want to get.
|
||||||
|
* @return {Phaser.Frame} The frame, if found.
|
||||||
|
*/
|
||||||
|
getFrameByName: function (name) {
|
||||||
|
|
||||||
|
if (typeof this._frameNames[name] === 'number')
|
||||||
|
{
|
||||||
|
return this._frames[this._frameNames[name]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if there is a Frame with the given name.
|
||||||
|
*
|
||||||
|
* @method Phaser.FrameData#checkFrameName
|
||||||
|
* @param {string} name - The name of the frame you want to check.
|
||||||
|
* @return {boolean} True if the frame is found, otherwise false.
|
||||||
|
*/
|
||||||
|
checkFrameName: function (name) {
|
||||||
|
|
||||||
|
if (this._frameNames[name] == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a range of frames based on the given start and end frame indexes and returns them in an Array.
|
||||||
|
*
|
||||||
|
* @method Phaser.FrameData#getFrameRange
|
||||||
|
* @param {number} start - The starting frame index.
|
||||||
|
* @param {number} end - The ending frame index.
|
||||||
|
* @param {Array} [output] - If given the results will be appended to the end of this array otherwise a new array will be created.
|
||||||
|
* @return {Array} An array of Frames between the start and end index values, or an empty array if none were found.
|
||||||
|
*/
|
||||||
|
getFrameRange: function (start, end, output) {
|
||||||
|
|
||||||
|
if (typeof output === "undefined") { output = []; }
|
||||||
|
|
||||||
|
for (var i = start; i <= end; i++)
|
||||||
|
{
|
||||||
|
output.push(this._frames[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all of the Frames in this FrameData set where the frame index is found in the input array.
|
||||||
|
* The frames are returned in the output array, or if none is provided in a new Array object.
|
||||||
|
*
|
||||||
|
* @method Phaser.FrameData#getFrames
|
||||||
|
* @param {Array} frames - An Array containing the indexes of the frames to retrieve. If the array is empty then all frames in the FrameData are returned.
|
||||||
|
* @param {boolean} [useNumericIndex=true] - Are the given frames using numeric indexes (default) or strings? (false)
|
||||||
|
* @param {Array} [output] - If given the results will be appended to the end of this array otherwise a new array will be created.
|
||||||
|
* @return {Array} An array of all Frames in this FrameData set matching the given names or IDs.
|
||||||
|
*/
|
||||||
|
getFrames: function (frames, useNumericIndex, output) {
|
||||||
|
|
||||||
|
if (typeof useNumericIndex === "undefined") { useNumericIndex = true; }
|
||||||
|
if (typeof output === "undefined") { output = []; }
|
||||||
|
|
||||||
|
if (typeof frames === "undefined" || frames.length === 0)
|
||||||
|
{
|
||||||
|
// No input array, so we loop through all frames
|
||||||
|
for (var i = 0; i < this._frames.length; i++)
|
||||||
|
{
|
||||||
|
// We only need the indexes
|
||||||
|
output.push(this._frames[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Input array given, loop through that instead
|
||||||
|
for (var i = 0, len = frames.length; i < len; i++)
|
||||||
|
{
|
||||||
|
// Does the input array contain names or indexes?
|
||||||
|
if (useNumericIndex)
|
||||||
|
{
|
||||||
|
// The actual frame
|
||||||
|
output.push(this.getFrame(frames[i]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The actual frame
|
||||||
|
output.push(this.getFrameByName(frames[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all of the Frame indexes in this FrameData set.
|
||||||
|
* The frames indexes are returned in the output array, or if none is provided in a new Array object.
|
||||||
|
*
|
||||||
|
* @method Phaser.FrameData#getFrameIndexes
|
||||||
|
* @param {Array} frames - An Array containing the indexes of the frames to retrieve. If the array is empty then all frames in the FrameData are returned.
|
||||||
|
* @param {boolean} [useNumericIndex=true] - Are the given frames using numeric indexes (default) or strings? (false)
|
||||||
|
* @param {Array} [output] - If given the results will be appended to the end of this array otherwise a new array will be created.
|
||||||
|
* @return {Array} An array of all Frame indexes matching the given names or IDs.
|
||||||
|
*/
|
||||||
|
getFrameIndexes: function (frames, useNumericIndex, output) {
|
||||||
|
|
||||||
|
if (typeof useNumericIndex === "undefined") { useNumericIndex = true; }
|
||||||
|
if (typeof output === "undefined") { output = []; }
|
||||||
|
|
||||||
|
if (typeof frames === "undefined" || frames.length === 0)
|
||||||
|
{
|
||||||
|
// No frames array, so we loop through all frames
|
||||||
|
for (var i = 0, len = this._frames.length; i < len; i++)
|
||||||
|
{
|
||||||
|
output.push(this._frames[i].index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Input array given, loop through that instead
|
||||||
|
for (var i = 0, len = frames.length; i < len; i++)
|
||||||
|
{
|
||||||
|
// Does the frames array contain names or indexes?
|
||||||
|
if (useNumericIndex)
|
||||||
|
{
|
||||||
|
output.push(frames[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.getFrameByName(frames[i]))
|
||||||
|
{
|
||||||
|
output.push(this.getFrameByName(frames[i]).index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.FrameData.prototype.constructor = Phaser.FrameData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Phaser.FrameData#total
|
||||||
|
* @property {number} total - The total number of frames in this FrameData set.
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.FrameData.prototype, "total", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
return this._frames.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,913 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: gameobjects/GameObjectCreator.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: gameobjects/GameObjectCreator.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Game Object Creator is a quick way to create all of the different sorts of core objects that Phaser uses, but not add them to the game world.
|
||||||
|
* Use the GameObjectFactory to create and add the objects into the world.
|
||||||
|
*
|
||||||
|
* @class Phaser.GameObjectCreator
|
||||||
|
* @constructor
|
||||||
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
*/
|
||||||
|
Phaser.GameObjectCreator = function (game) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Game} game - A reference to the currently running Game.
|
||||||
|
*/
|
||||||
|
this.game = game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.World} world - A reference to the game world.
|
||||||
|
*/
|
||||||
|
this.world = this.game.world;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.GameObjectCreator.prototype = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new `Image` object. An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
|
||||||
|
* It can still rotate, scale, crop and receive input events. This makes it perfect for logos, backgrounds, simple buttons and other non-Sprite graphics.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#image
|
||||||
|
* @param {number} x - X position of the image.
|
||||||
|
* @param {number} y - Y position of the image.
|
||||||
|
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
|
||||||
|
* @param {string|number} [frame] - If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
|
||||||
|
* @returns {Phaser.Sprite} the newly created sprite object.
|
||||||
|
*/
|
||||||
|
image: function (x, y, key, frame) {
|
||||||
|
|
||||||
|
return new Phaser.Image(this.game, x, y, key, frame);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Sprite with specific position and sprite sheet key.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#sprite
|
||||||
|
* @param {number} x - X position of the new sprite.
|
||||||
|
* @param {number} y - Y position of the new sprite.
|
||||||
|
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
|
||||||
|
* @param {string|number} [frame] - If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
|
||||||
|
* @returns {Phaser.Sprite} the newly created sprite object.
|
||||||
|
*/
|
||||||
|
sprite: function (x, y, key, frame) {
|
||||||
|
|
||||||
|
return new Phaser.Sprite(this.game, x, y, key, frame);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#tween
|
||||||
|
* @param {object} obj - Object the tween will be run on.
|
||||||
|
* @return {Phaser.Tween} Description.
|
||||||
|
*/
|
||||||
|
tween: function (obj) {
|
||||||
|
|
||||||
|
return this.game.tweens.create(obj);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#group
|
||||||
|
* @param {any} [parent] - The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default.
|
||||||
|
* @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
|
||||||
|
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
|
||||||
|
* @return {Phaser.Group} The newly created group.
|
||||||
|
*/
|
||||||
|
group: function (parent, name, addToStage) {
|
||||||
|
|
||||||
|
if (typeof name === 'undefined') { name = 'group'; }
|
||||||
|
if (typeof addToStage === 'undefined') { addToStage = false; }
|
||||||
|
|
||||||
|
return new Phaser.Group(this.game, parent, name, addToStage);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#spriteBatch
|
||||||
|
* @param {any} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
|
||||||
|
* @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
|
||||||
|
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
|
||||||
|
* @return {Phaser.Group} The newly created group.
|
||||||
|
*/
|
||||||
|
spriteBatch: function (parent, name, addToStage) {
|
||||||
|
|
||||||
|
if (typeof name === 'undefined') { name = 'group'; }
|
||||||
|
if (typeof addToStage === 'undefined') { addToStage = false; }
|
||||||
|
|
||||||
|
return new Phaser.SpriteBatch(this.game, parent, name, addToStage);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Sound object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#audio
|
||||||
|
* @param {string} key - The Game.cache key of the sound that this object will use.
|
||||||
|
* @param {number} [volume=1] - The volume at which the sound will be played.
|
||||||
|
* @param {boolean} [loop=false] - Whether or not the sound will loop.
|
||||||
|
* @param {boolean} [connect=true] - Controls if the created Sound object will connect to the master gainNode of the SoundManager when running under WebAudio.
|
||||||
|
* @return {Phaser.Sound} The newly created text object.
|
||||||
|
*/
|
||||||
|
audio: function (key, volume, loop, connect) {
|
||||||
|
|
||||||
|
return this.game.sound.add(key, volume, loop, connect);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Sound object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#sound
|
||||||
|
* @param {string} key - The Game.cache key of the sound that this object will use.
|
||||||
|
* @param {number} [volume=1] - The volume at which the sound will be played.
|
||||||
|
* @param {boolean} [loop=false] - Whether or not the sound will loop.
|
||||||
|
* @param {boolean} [connect=true] - Controls if the created Sound object will connect to the master gainNode of the SoundManager when running under WebAudio.
|
||||||
|
* @return {Phaser.Sound} The newly created text object.
|
||||||
|
*/
|
||||||
|
sound: function (key, volume, loop, connect) {
|
||||||
|
|
||||||
|
return this.game.sound.add(key, volume, loop, connect);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new TileSprite object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#tileSprite
|
||||||
|
* @param {number} x - The x coordinate (in world space) to position the TileSprite at.
|
||||||
|
* @param {number} y - The y coordinate (in world space) to position the TileSprite at.
|
||||||
|
* @param {number} width - The width of the TileSprite.
|
||||||
|
* @param {number} height - The height of the TileSprite.
|
||||||
|
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
|
||||||
|
* @param {string|number} frame - If this TileSprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
|
||||||
|
* @return {Phaser.TileSprite} The newly created tileSprite object.
|
||||||
|
*/
|
||||||
|
tileSprite: function (x, y, width, height, key, frame) {
|
||||||
|
|
||||||
|
return new Phaser.TileSprite(this.game, x, y, width, height, key, frame);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Text object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#text
|
||||||
|
* @param {number} x - X position of the new text object.
|
||||||
|
* @param {number} y - Y position of the new text object.
|
||||||
|
* @param {string} text - The actual text that will be written.
|
||||||
|
* @param {object} style - The style object containing style attributes like font, font size , etc.
|
||||||
|
* @return {Phaser.Text} The newly created text object.
|
||||||
|
*/
|
||||||
|
text: function (x, y, text, style, group) {
|
||||||
|
|
||||||
|
return new Phaser.Text(this.game, x, y, text, style);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Button object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#button
|
||||||
|
* @param {number} [x] X position of the new button object.
|
||||||
|
* @param {number} [y] Y position of the new button object.
|
||||||
|
* @param {string} [key] The image key as defined in the Game.Cache to use as the texture for this button.
|
||||||
|
* @param {function} [callback] The function to call when this button is pressed
|
||||||
|
* @param {object} [callbackContext] The context in which the callback will be called (usually 'this')
|
||||||
|
* @param {string|number} [overFrame] This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
|
||||||
|
* @param {string|number} [outFrame] This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
|
||||||
|
* @param {string|number} [downFrame] This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
|
||||||
|
* @param {string|number} [upFrame] This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name.
|
||||||
|
* @return {Phaser.Button} The newly created button object.
|
||||||
|
*/
|
||||||
|
button: function (x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame, group) {
|
||||||
|
|
||||||
|
return new Phaser.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Graphics object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#graphics
|
||||||
|
* @param {number} x - X position of the new graphics object.
|
||||||
|
* @param {number} y - Y position of the new graphics object.
|
||||||
|
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||||
|
* @return {Phaser.Graphics} The newly created graphics object.
|
||||||
|
*/
|
||||||
|
graphics: function (x, y, group) {
|
||||||
|
|
||||||
|
return new Phaser.Graphics(this.game, x, y);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emitter is a lightweight particle emitter. It can be used for one-time explosions or for
|
||||||
|
* continuous effects like rain and fire. All it really does is launch Particle objects out
|
||||||
|
* at set intervals, and fixes their positions and velocities accorindgly.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#emitter
|
||||||
|
* @param {number} [x=0] - The x coordinate within the Emitter that the particles are emitted from.
|
||||||
|
* @param {number} [y=0] - The y coordinate within the Emitter that the particles are emitted from.
|
||||||
|
* @param {number} [maxParticles=50] - The total number of particles in this emitter.
|
||||||
|
* @return {Phaser.Emitter} The newly created emitter object.
|
||||||
|
*/
|
||||||
|
emitter: function (x, y, maxParticles) {
|
||||||
|
|
||||||
|
return new Phaser.Particles.Arcade.Emitter(this.game, x, y, maxParticles);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new BitmapFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
|
||||||
|
* The texture can be asssigned or one or multiple images/sprites, but note that the text the BitmapFont uses will be shared across them all,
|
||||||
|
* i.e. if you need each Image to have different text in it, then you need to create multiple BitmapFont objects.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#bitmapFont
|
||||||
|
* @param {string} font - The key of the image in the Game.Cache that the BitmapFont will use.
|
||||||
|
* @param {number} characterWidth - The width of each character in the font set.
|
||||||
|
* @param {number} characterHeight - The height of each character in the font set.
|
||||||
|
* @param {string} chars - The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.
|
||||||
|
* @param {number} charsPerRow - The number of characters per row in the font set.
|
||||||
|
* @param {number} [xSpacing=0] - If the characters in the font set have horizontal spacing between them set the required amount here.
|
||||||
|
* @param {number} [ySpacing=0] - If the characters in the font set have vertical spacing between them set the required amount here.
|
||||||
|
* @param {number} [xOffset=0] - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
|
||||||
|
* @param {number} [yOffset=0] - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
|
||||||
|
* @return {Phaser.BitmapFont} The newly created BitmapFont texture which can be applied to an Image or Sprite.
|
||||||
|
*/
|
||||||
|
bitmapFont: function (font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
|
||||||
|
|
||||||
|
return new Phaser.BitmapFont(this.game, font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new BitmapText object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#bitmapText
|
||||||
|
* @param {number} x - X position of the new bitmapText object.
|
||||||
|
* @param {number} y - Y position of the new bitmapText object.
|
||||||
|
* @param {string} font - The key of the BitmapText font as stored in Game.Cache.
|
||||||
|
* @param {string} [text] - The actual text that will be rendered. Can be set later via BitmapText.text.
|
||||||
|
* @param {number} [size] - The size the font will be rendered in, in pixels.
|
||||||
|
* @return {Phaser.BitmapText} The newly created bitmapText object.
|
||||||
|
*/
|
||||||
|
bitmapText: function (x, y, font, text, size, group) {
|
||||||
|
|
||||||
|
return new Phaser.BitmapText(this.game, x, y, font, text, size);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Tilemap object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#tilemap
|
||||||
|
* @param {string} key - Asset key for the JSON or CSV map data in the cache.
|
||||||
|
* @param {object|string} tilesets - An object mapping Cache.tileset keys with the tileset names in the JSON file. If a string is provided that will be used.
|
||||||
|
* @return {Phaser.Tilemap} The newly created tilemap object.
|
||||||
|
*/
|
||||||
|
tilemap: function (key, tilesets) {
|
||||||
|
|
||||||
|
return new Phaser.Tilemap(this.game, key, tilesets);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A dynamic initially blank canvas to which images can be drawn.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#renderTexture
|
||||||
|
* @param {number} [width=100] - the width of the RenderTexture.
|
||||||
|
* @param {number} [height=100] - the height of the RenderTexture.
|
||||||
|
* @param {string} [key=''] - Asset key for the RenderTexture when stored in the Cache (see addToCache parameter).
|
||||||
|
* @param {boolean} [addToCache=false] - Should this RenderTexture be added to the Game.Cache? If so you can retrieve it with Cache.getTexture(key)
|
||||||
|
* @return {Phaser.RenderTexture} The newly created RenderTexture object.
|
||||||
|
*/
|
||||||
|
renderTexture: function (width, height, key, addToCache) {
|
||||||
|
|
||||||
|
if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); }
|
||||||
|
if (typeof addToCache === 'undefined') { addToCache = false; }
|
||||||
|
|
||||||
|
var texture = new Phaser.RenderTexture(this.game, width, height, key);
|
||||||
|
|
||||||
|
if (addToCache)
|
||||||
|
{
|
||||||
|
this.game.cache.addRenderTexture(key, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
return texture;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#bitmapData
|
||||||
|
* @param {number} [width=100] - The width of the BitmapData in pixels.
|
||||||
|
* @param {number} [height=100] - The height of the BitmapData in pixels.
|
||||||
|
* @param {string} [key=''] - Asset key for the BitmapData when stored in the Cache (see addToCache parameter).
|
||||||
|
* @param {boolean} [addToCache=false] - Should this BitmapData be added to the Game.Cache? If so you can retrieve it with Cache.getBitmapData(key)
|
||||||
|
* @return {Phaser.BitmapData} The newly created BitmapData object.
|
||||||
|
*/
|
||||||
|
bitmapData: function (width, height, addToCache) {
|
||||||
|
|
||||||
|
if (typeof addToCache === 'undefined') { addToCache = false; }
|
||||||
|
if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); }
|
||||||
|
|
||||||
|
var texture = new Phaser.BitmapData(this.game, key, width, height);
|
||||||
|
|
||||||
|
if (addToCache)
|
||||||
|
{
|
||||||
|
this.game.cache.addBitmapData(key, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
return texture;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A WebGL shader/filter that can be applied to Sprites.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectCreator#filter
|
||||||
|
* @param {string} filter - The name of the filter you wish to create, for example HueRotate or SineWave.
|
||||||
|
* @param {any} - Whatever parameters are needed to be passed to the filter init function.
|
||||||
|
* @return {Phaser.Filter} The newly created Phaser.Filter object.
|
||||||
|
*/
|
||||||
|
filter: function (filter) {
|
||||||
|
|
||||||
|
var args = Array.prototype.splice.call(arguments, 1);
|
||||||
|
|
||||||
|
var filter = new Phaser.Filter[filter](this.game);
|
||||||
|
|
||||||
|
filter.init.apply(filter, args);
|
||||||
|
|
||||||
|
return filter;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.GameObjectCreator.prototype.constructor = Phaser.GameObjectCreator;
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,944 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: gameobjects/GameObjectFactory.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: gameobjects/GameObjectFactory.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Game Object Factory is a quick way to create all of the different sorts of core objects that Phaser uses.
|
||||||
|
*
|
||||||
|
* @class Phaser.GameObjectFactory
|
||||||
|
* @constructor
|
||||||
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
*/
|
||||||
|
Phaser.GameObjectFactory = function (game) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Game} game - A reference to the currently running Game.
|
||||||
|
*/
|
||||||
|
this.game = game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.World} world - A reference to the game world.
|
||||||
|
*/
|
||||||
|
this.world = this.game.world;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.GameObjectFactory.prototype = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an existing object to the game world.
|
||||||
|
* @method Phaser.GameObjectFactory#existing
|
||||||
|
* @param {*} object - An instance of Phaser.Sprite, Phaser.Button or any other display object..
|
||||||
|
* @return {*} The child that was added to the Group.
|
||||||
|
*/
|
||||||
|
existing: function (object) {
|
||||||
|
|
||||||
|
return this.world.add(object);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new `Image` object. An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
|
||||||
|
* It can still rotate, scale, crop and receive input events. This makes it perfect for logos, backgrounds, simple buttons and other non-Sprite graphics.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#image
|
||||||
|
* @param {number} x - X position of the image.
|
||||||
|
* @param {number} y - Y position of the image.
|
||||||
|
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
|
||||||
|
* @param {string|number} [frame] - If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
|
||||||
|
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||||
|
* @returns {Phaser.Sprite} the newly created sprite object.
|
||||||
|
*/
|
||||||
|
image: function (x, y, key, frame, group) {
|
||||||
|
|
||||||
|
if (typeof group === 'undefined') { group = this.world; }
|
||||||
|
|
||||||
|
return group.add(new Phaser.Image(this.game, x, y, key, frame));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Sprite with specific position and sprite sheet key.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#sprite
|
||||||
|
* @param {number} x - X position of the new sprite.
|
||||||
|
* @param {number} y - Y position of the new sprite.
|
||||||
|
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
|
||||||
|
* @param {string|number} [frame] - If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
|
||||||
|
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||||
|
* @returns {Phaser.Sprite} the newly created sprite object.
|
||||||
|
*/
|
||||||
|
sprite: function (x, y, key, frame, group) {
|
||||||
|
|
||||||
|
if (typeof group === 'undefined') { group = this.world; }
|
||||||
|
|
||||||
|
return group.create(x, y, key, frame);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#tween
|
||||||
|
* @param {object} obj - Object the tween will be run on.
|
||||||
|
* @return {Phaser.Tween} The newly created Phaser.Tween object.
|
||||||
|
*/
|
||||||
|
tween: function (obj) {
|
||||||
|
|
||||||
|
return this.game.tweens.create(obj);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#group
|
||||||
|
* @param {any} [parent] - The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default.
|
||||||
|
* @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
|
||||||
|
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
|
||||||
|
* @return {Phaser.Group} The newly created group.
|
||||||
|
*/
|
||||||
|
group: function (parent, name, addToStage) {
|
||||||
|
|
||||||
|
if (typeof name === 'undefined') { name = 'group'; }
|
||||||
|
if (typeof addToStage === 'undefined') { addToStage = false; }
|
||||||
|
|
||||||
|
return new Phaser.Group(this.game, parent, name, addToStage);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#spriteBatch
|
||||||
|
* @param {any} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
|
||||||
|
* @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
|
||||||
|
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
|
||||||
|
* @return {Phaser.Group} The newly created group.
|
||||||
|
*/
|
||||||
|
spriteBatch: function (parent, name, addToStage) {
|
||||||
|
|
||||||
|
if (typeof name === 'undefined') { name = 'group'; }
|
||||||
|
if (typeof addToStage === 'undefined') { addToStage = false; }
|
||||||
|
|
||||||
|
return new Phaser.SpriteBatch(this.game, parent, name, addToStage);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Sound object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#audio
|
||||||
|
* @param {string} key - The Game.cache key of the sound that this object will use.
|
||||||
|
* @param {number} [volume=1] - The volume at which the sound will be played.
|
||||||
|
* @param {boolean} [loop=false] - Whether or not the sound will loop.
|
||||||
|
* @param {boolean} [connect=true] - Controls if the created Sound object will connect to the master gainNode of the SoundManager when running under WebAudio.
|
||||||
|
* @return {Phaser.Sound} The newly created text object.
|
||||||
|
*/
|
||||||
|
audio: function (key, volume, loop, connect) {
|
||||||
|
|
||||||
|
return this.game.sound.add(key, volume, loop, connect);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Sound object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#sound
|
||||||
|
* @param {string} key - The Game.cache key of the sound that this object will use.
|
||||||
|
* @param {number} [volume=1] - The volume at which the sound will be played.
|
||||||
|
* @param {boolean} [loop=false] - Whether or not the sound will loop.
|
||||||
|
* @param {boolean} [connect=true] - Controls if the created Sound object will connect to the master gainNode of the SoundManager when running under WebAudio.
|
||||||
|
* @return {Phaser.Sound} The newly created text object.
|
||||||
|
*/
|
||||||
|
sound: function (key, volume, loop, connect) {
|
||||||
|
|
||||||
|
return this.game.sound.add(key, volume, loop, connect);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new TileSprite object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#tileSprite
|
||||||
|
* @param {number} x - The x coordinate (in world space) to position the TileSprite at.
|
||||||
|
* @param {number} y - The y coordinate (in world space) to position the TileSprite at.
|
||||||
|
* @param {number} width - The width of the TileSprite.
|
||||||
|
* @param {number} height - The height of the TileSprite.
|
||||||
|
* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
|
||||||
|
* @param {string|number} frame - If this TileSprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
|
||||||
|
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||||
|
* @return {Phaser.TileSprite} The newly created tileSprite object.
|
||||||
|
*/
|
||||||
|
tileSprite: function (x, y, width, height, key, frame, group) {
|
||||||
|
|
||||||
|
if (typeof group === 'undefined') { group = this.world; }
|
||||||
|
|
||||||
|
return group.add(new Phaser.TileSprite(this.game, x, y, width, height, key, frame));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Text object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#text
|
||||||
|
* @param {number} x - X position of the new text object.
|
||||||
|
* @param {number} y - Y position of the new text object.
|
||||||
|
* @param {string} text - The actual text that will be written.
|
||||||
|
* @param {object} style - The style object containing style attributes like font, font size , etc.
|
||||||
|
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||||
|
* @return {Phaser.Text} The newly created text object.
|
||||||
|
*/
|
||||||
|
text: function (x, y, text, style, group) {
|
||||||
|
|
||||||
|
if (typeof group === 'undefined') { group = this.world; }
|
||||||
|
|
||||||
|
return group.add(new Phaser.Text(this.game, x, y, text, style));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Button object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#button
|
||||||
|
* @param {number} [x] X position of the new button object.
|
||||||
|
* @param {number} [y] Y position of the new button object.
|
||||||
|
* @param {string} [key] The image key as defined in the Game.Cache to use as the texture for this button.
|
||||||
|
* @param {function} [callback] The function to call when this button is pressed
|
||||||
|
* @param {object} [callbackContext] The context in which the callback will be called (usually 'this')
|
||||||
|
* @param {string|number} [overFrame] This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
|
||||||
|
* @param {string|number} [outFrame] This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
|
||||||
|
* @param {string|number} [downFrame] This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
|
||||||
|
* @param {string|number} [upFrame] This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name.
|
||||||
|
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||||
|
* @return {Phaser.Button} The newly created button object.
|
||||||
|
*/
|
||||||
|
button: function (x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame, group) {
|
||||||
|
|
||||||
|
if (typeof group === 'undefined') { group = this.world; }
|
||||||
|
|
||||||
|
return group.add(new Phaser.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Graphics object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#graphics
|
||||||
|
* @param {number} x - X position of the new graphics object.
|
||||||
|
* @param {number} y - Y position of the new graphics object.
|
||||||
|
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||||
|
* @return {Phaser.Graphics} The newly created graphics object.
|
||||||
|
*/
|
||||||
|
graphics: function (x, y, group) {
|
||||||
|
|
||||||
|
if (typeof group === 'undefined') { group = this.world; }
|
||||||
|
|
||||||
|
return group.add(new Phaser.Graphics(this.game, x, y));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emitter is a lightweight particle emitter. It can be used for one-time explosions or for
|
||||||
|
* continuous effects like rain and fire. All it really does is launch Particle objects out
|
||||||
|
* at set intervals, and fixes their positions and velocities accorindgly.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#emitter
|
||||||
|
* @param {number} [x=0] - The x coordinate within the Emitter that the particles are emitted from.
|
||||||
|
* @param {number} [y=0] - The y coordinate within the Emitter that the particles are emitted from.
|
||||||
|
* @param {number} [maxParticles=50] - The total number of particles in this emitter.
|
||||||
|
* @return {Phaser.Emitter} The newly created emitter object.
|
||||||
|
*/
|
||||||
|
emitter: function (x, y, maxParticles) {
|
||||||
|
|
||||||
|
return this.game.particles.add(new Phaser.Particles.Arcade.Emitter(this.game, x, y, maxParticles));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new BitmapFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
|
||||||
|
* The texture can be asssigned or one or multiple images/sprites, but note that the text the BitmapFont uses will be shared across them all,
|
||||||
|
* i.e. if you need each Image to have different text in it, then you need to create multiple BitmapFont objects.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#bitmapFont
|
||||||
|
* @param {string} font - The key of the image in the Game.Cache that the BitmapFont will use.
|
||||||
|
* @param {number} characterWidth - The width of each character in the font set.
|
||||||
|
* @param {number} characterHeight - The height of each character in the font set.
|
||||||
|
* @param {string} chars - The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.
|
||||||
|
* @param {number} charsPerRow - The number of characters per row in the font set.
|
||||||
|
* @param {number} [xSpacing=0] - If the characters in the font set have horizontal spacing between them set the required amount here.
|
||||||
|
* @param {number} [ySpacing=0] - If the characters in the font set have vertical spacing between them set the required amount here.
|
||||||
|
* @param {number} [xOffset=0] - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
|
||||||
|
* @param {number} [yOffset=0] - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
|
||||||
|
* @return {Phaser.BitmapFont} The newly created BitmapFont texture which can be applied to an Image or Sprite.
|
||||||
|
*/
|
||||||
|
bitmapFont: function (font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
|
||||||
|
|
||||||
|
return new Phaser.BitmapFont(this.game, font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new BitmapText object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#bitmapText
|
||||||
|
* @param {number} x - X position of the new bitmapText object.
|
||||||
|
* @param {number} y - Y position of the new bitmapText object.
|
||||||
|
* @param {string} font - The key of the BitmapText font as stored in Game.Cache.
|
||||||
|
* @param {string} [text] - The actual text that will be rendered. Can be set later via BitmapText.text.
|
||||||
|
* @param {number} [size] - The size the font will be rendered in, in pixels.
|
||||||
|
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
|
||||||
|
* @return {Phaser.BitmapText} The newly created bitmapText object.
|
||||||
|
*/
|
||||||
|
bitmapText: function (x, y, font, text, size, group) {
|
||||||
|
|
||||||
|
if (typeof group === 'undefined') { group = this.world; }
|
||||||
|
|
||||||
|
return group.add(new Phaser.BitmapText(this.game, x, y, font, text, size));
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Tilemap object.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#tilemap
|
||||||
|
* @param {string} key - Asset key for the JSON or CSV map data in the cache.
|
||||||
|
* @param {object|string} tilesets - An object mapping Cache.tileset keys with the tileset names in the JSON file. If a string is provided that will be used.
|
||||||
|
* @return {Phaser.Tilemap} The newly created tilemap object.
|
||||||
|
*/
|
||||||
|
tilemap: function (key, tilesets) {
|
||||||
|
|
||||||
|
return new Phaser.Tilemap(this.game, key, tilesets);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A dynamic initially blank canvas to which images can be drawn.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#renderTexture
|
||||||
|
* @param {number} [width=100] - the width of the RenderTexture.
|
||||||
|
* @param {number} [height=100] - the height of the RenderTexture.
|
||||||
|
* @param {string} [key=''] - Asset key for the RenderTexture when stored in the Cache (see addToCache parameter).
|
||||||
|
* @param {boolean} [addToCache=false] - Should this RenderTexture be added to the Game.Cache? If so you can retrieve it with Cache.getTexture(key)
|
||||||
|
* @return {Phaser.RenderTexture} The newly created RenderTexture object.
|
||||||
|
*/
|
||||||
|
renderTexture: function (width, height, key, addToCache) {
|
||||||
|
|
||||||
|
if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); }
|
||||||
|
if (typeof addToCache === 'undefined') { addToCache = false; }
|
||||||
|
|
||||||
|
var texture = new Phaser.RenderTexture(this.game, width, height, key);
|
||||||
|
|
||||||
|
if (addToCache)
|
||||||
|
{
|
||||||
|
this.game.cache.addRenderTexture(key, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
return texture;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#bitmapData
|
||||||
|
* @param {number} [width=100] - The width of the BitmapData in pixels.
|
||||||
|
* @param {number} [height=100] - The height of the BitmapData in pixels.
|
||||||
|
* @param {string} [key=''] - Asset key for the BitmapData when stored in the Cache (see addToCache parameter).
|
||||||
|
* @param {boolean} [addToCache=false] - Should this BitmapData be added to the Game.Cache? If so you can retrieve it with Cache.getBitmapData(key)
|
||||||
|
* @return {Phaser.BitmapData} The newly created BitmapData object.
|
||||||
|
*/
|
||||||
|
bitmapData: function (width, height, addToCache) {
|
||||||
|
|
||||||
|
if (typeof addToCache === 'undefined') { addToCache = false; }
|
||||||
|
if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); }
|
||||||
|
|
||||||
|
var texture = new Phaser.BitmapData(this.game, key, width, height);
|
||||||
|
|
||||||
|
if (addToCache)
|
||||||
|
{
|
||||||
|
this.game.cache.addBitmapData(key, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
return texture;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A WebGL shader/filter that can be applied to Sprites.
|
||||||
|
*
|
||||||
|
* @method Phaser.GameObjectFactory#filter
|
||||||
|
* @param {string} filter - The name of the filter you wish to create, for example HueRotate or SineWave.
|
||||||
|
* @param {any} - Whatever parameters are needed to be passed to the filter init function.
|
||||||
|
* @return {Phaser.Filter} The newly created Phaser.Filter object.
|
||||||
|
*/
|
||||||
|
filter: function (filter) {
|
||||||
|
|
||||||
|
var args = Array.prototype.splice.call(arguments, 1);
|
||||||
|
|
||||||
|
var filter = new Phaser.Filter[filter](this.game);
|
||||||
|
|
||||||
|
filter.init.apply(filter, args);
|
||||||
|
|
||||||
|
return filter;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.GameObjectFactory.prototype.constructor = Phaser.GameObjectFactory;
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,728 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: input/GamepadButton.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: input/GamepadButton.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author @karlmacklin <tacklemcclean@gmail.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Phaser.GamepadButton
|
||||||
|
* @classdesc If you need more fine-grained control over the handling of specific buttons you can create and use Phaser.GamepadButton objects.
|
||||||
|
* @constructor
|
||||||
|
* @param {Phaser.Game} game - Current game instance.
|
||||||
|
* @param {number} buttoncode - The button code this GamepadButton is responsible for.
|
||||||
|
*/
|
||||||
|
Phaser.GamepadButton = function (game, buttoncode) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Game} game - A reference to the currently running game.
|
||||||
|
*/
|
||||||
|
this.game = game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {boolean} isDown - The "down" state of the button.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.isDown = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {boolean} isUp - The "up" state of the button.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.isUp = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} timeDown - The timestamp when the button was last pressed down.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.timeDown = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the button is down this value holds the duration of that button press and is constantly updated.
|
||||||
|
* If the button is up it holds the duration of the previous down session.
|
||||||
|
* @property {number} duration - The number of milliseconds this button has been held down for.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.duration = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} timeUp - The timestamp when the button was last released.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.timeUp = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} repeats - If a button is held down this holds down the number of times the button has 'repeated'.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.repeats = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} value - Button value. Mainly useful for checking analog buttons (like shoulder triggers)
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.value = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} buttonCode - The buttoncode of this button.
|
||||||
|
*/
|
||||||
|
this.buttonCode = buttoncode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Signal} onDown - This Signal is dispatched every time this GamepadButton is pressed down. It is only dispatched once (until the button is released again).
|
||||||
|
*/
|
||||||
|
this.onDown = new Phaser.Signal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Signal} onUp - This Signal is dispatched every time this GamepadButton is pressed down. It is only dispatched once (until the button is released again).
|
||||||
|
*/
|
||||||
|
this.onUp = new Phaser.Signal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Signal} onFloat - This Signal is dispatched every time this GamepadButton changes floating value (between (but not exactly) 0 and 1)
|
||||||
|
*/
|
||||||
|
this.onFloat = new Phaser.Signal();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.GamepadButton.prototype = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called automatically by Phaser.SinglePad.
|
||||||
|
* @method Phaser.GamepadButton#processButtonDown
|
||||||
|
* @param {Object} value - Button value
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
processButtonDown: function (value) {
|
||||||
|
|
||||||
|
if (this.isDown)
|
||||||
|
{
|
||||||
|
this.duration = this.game.time.now - this.timeDown;
|
||||||
|
this.repeats++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.isDown = true;
|
||||||
|
this.isUp = false;
|
||||||
|
this.timeDown = this.game.time.now;
|
||||||
|
this.duration = 0;
|
||||||
|
this.repeats = 0;
|
||||||
|
this.value = value;
|
||||||
|
|
||||||
|
this.onDown.dispatch(this, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called automatically by Phaser.SinglePad.
|
||||||
|
* @method Phaser.GamepadButton#processButtonUp
|
||||||
|
* @param {Object} value - Button value
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
processButtonUp: function (value) {
|
||||||
|
|
||||||
|
this.isDown = false;
|
||||||
|
this.isUp = true;
|
||||||
|
this.timeUp = this.game.time.now;
|
||||||
|
this.value = value;
|
||||||
|
|
||||||
|
this.onUp.dispatch(this, value);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called automatically by Phaser.Gamepad.
|
||||||
|
* @method Phaser.GamepadButton#processButtonFloat
|
||||||
|
* @param {Object} value - Button value
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
processButtonFloat: function (value) {
|
||||||
|
|
||||||
|
this.value = value;
|
||||||
|
this.onFloat.dispatch(this, value);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the "just pressed" state of this button. Just pressed is considered true if the button was pressed down within the duration given (default 250ms).
|
||||||
|
* @method Phaser.GamepadButton#justPressed
|
||||||
|
* @param {number} [duration=250] - The duration below which the button is considered as being just pressed.
|
||||||
|
* @return {boolean} True if the button is just pressed otherwise false.
|
||||||
|
*/
|
||||||
|
justPressed: function (duration) {
|
||||||
|
|
||||||
|
if (typeof duration === "undefined") { duration = 250; }
|
||||||
|
|
||||||
|
return (this.isDown && this.duration < duration);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the "just released" state of this button. Just released is considered as being true if the button was released within the duration given (default 250ms).
|
||||||
|
* @method Phaser.GamepadButton#justPressed
|
||||||
|
* @param {number} [duration=250] - The duration below which the button is considered as being just released.
|
||||||
|
* @return {boolean} True if the button is just pressed otherwise false.
|
||||||
|
*/
|
||||||
|
justReleased: function (duration) {
|
||||||
|
|
||||||
|
if (typeof duration === "undefined") { duration = 250; }
|
||||||
|
|
||||||
|
return (this.isDown === false && (this.game.time.now - this.timeUp < duration));
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.GamepadButton.prototype.constructor = Phaser.GamepadButton;
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,777 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Phaser Source: gameobjects/Graphics.js</title>
|
||||||
|
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||||||
|
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<a class="brand" href="index.html">Phaser</a>
|
||||||
|
<ul class="nav">
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.html">Phaser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Animation.html">Animation</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapFont.html">BitmapFont</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Button.html">Button</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Cache.html">Cache</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Camera.html">Camera</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Circle.html">Circle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Color.html">Color</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Device.html">Device</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.html">Easing</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Back.html">Back</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Bounce.html">Bounce</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Circular.html">Circular</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Cubic.html">Cubic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Elastic.html">Elastic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Exponential.html">Exponential</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Linear.html">Linear</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quartic.html">Quartic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Quintic.html">Quintic</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Events.html">Events</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Filter.html">Filter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Frame.html">Frame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Game.html">Game</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Group.html">Group</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Image.html">Image</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Input.html">Input</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Key.html">Key</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Line.html">Line</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Loader.html">Loader</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Math.html">Math</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Net.html">Net</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.html">Particles</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.html">Physics</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Body.html">Body</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.CollisionGroup.html">CollisionGroup</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.ContactMaterial.html">ContactMaterial</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.InversePointProxy.html">InversePointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Material.html">Material</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.PointProxy.html">PointProxy</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.Spring.html">Spring</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Physics.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Point.html">Point</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Signal.html">Signal</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sound.html">Sound</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Stage.html">Stage</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StageScaleMode.html">StageScaleMode</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.State.html">State</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Text.html">Text</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tile.html">Tile</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Time.html">Time</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Timer.html">Timer</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Touch.html">Touch</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Tween.html">Tween</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.html">Utils</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="Phaser.World.html">World</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="SignalBinding.html">SignalBinding</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
|
||||||
|
class="caret"></b></a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu ">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#canUseNewCanvasBlendModes">canUseNewCanvasBlendModes</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getBounds">getBounds</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#getNextPowerOfTwo">getNextPowerOfTwo</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hex2rgb">hex2rgb</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#hitTest">hitTest</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="global.html#rgb2hex">rgb2hex</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="page-title">Source: gameobjects/Graphics.js</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<article>
|
||||||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2014 Photon Storm Ltd.
|
||||||
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new `Graphics` object.
|
||||||
|
*
|
||||||
|
* @class Phaser.Graphics
|
||||||
|
* @constructor
|
||||||
|
*
|
||||||
|
* @param {Phaser.Game} game Current game instance.
|
||||||
|
* @param {number} x - X position of the new graphics object.
|
||||||
|
* @param {number} y - Y position of the new graphics object.
|
||||||
|
*/
|
||||||
|
Phaser.Graphics = function (game, x, y) {
|
||||||
|
|
||||||
|
x = x || 0;
|
||||||
|
y = y || 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Game} game - A reference to the currently running Game.
|
||||||
|
*/
|
||||||
|
this.game = game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {boolean} exists - If exists = false then the Text isn't updated by the core game loop.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.exists = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {string} name - The user defined name given to this object.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.name = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} type - The const type of this object.
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
this.type = Phaser.GRAPHICS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Point} world - The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.
|
||||||
|
*/
|
||||||
|
this.world = new Phaser.Point(x, y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.
|
||||||
|
*/
|
||||||
|
this.cameraOffset = new Phaser.Point();
|
||||||
|
|
||||||
|
PIXI.Graphics.call(this);
|
||||||
|
|
||||||
|
this.position.set(x, y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A small internal cache:
|
||||||
|
* 0 = previous position.x
|
||||||
|
* 1 = previous position.y
|
||||||
|
* 2 = previous rotation
|
||||||
|
* 3 = renderID
|
||||||
|
* 4 = fresh? (0 = no, 1 = yes)
|
||||||
|
* 5 = outOfBoundsFired (0 = no, 1 = yes)
|
||||||
|
* 6 = exists (0 = no, 1 = yes)
|
||||||
|
* 7 = fixed to camera (0 = no, 1 = yes)
|
||||||
|
* @property {Int16Array} _cache
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Phaser.Graphics.prototype = Object.create(PIXI.Graphics.prototype);
|
||||||
|
Phaser.Graphics.prototype.constructor = Phaser.Graphics;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically called by World.preUpdate.
|
||||||
|
* @method Phaser.Graphics.prototype.preUpdate
|
||||||
|
*/
|
||||||
|
Phaser.Graphics.prototype.preUpdate = function () {
|
||||||
|
|
||||||
|
this._cache[0] = this.world.x;
|
||||||
|
this._cache[1] = this.world.y;
|
||||||
|
this._cache[2] = this.rotation;
|
||||||
|
|
||||||
|
if (!this.exists || !this.parent.exists)
|
||||||
|
{
|
||||||
|
this.renderOrderID = -1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.autoCull)
|
||||||
|
{
|
||||||
|
// Won't get rendered but will still get its transform updated
|
||||||
|
this.renderable = this.game.world.camera.screenView.intersects(this.getBounds());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]);
|
||||||
|
|
||||||
|
if (this.visible)
|
||||||
|
{
|
||||||
|
this._cache[3] = this.game.world.currentRenderOrderID++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override and use this function in your own custom objects to handle any update requirements you may have.
|
||||||
|
*
|
||||||
|
* @method Phaser.Graphics#update
|
||||||
|
* @memberof Phaser.Graphics
|
||||||
|
*/
|
||||||
|
Phaser.Graphics.prototype.update = function() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically called by World.postUpdate.
|
||||||
|
* @method Phaser.Graphics.prototype.postUpdate
|
||||||
|
*/
|
||||||
|
Phaser.Graphics.prototype.postUpdate = function () {
|
||||||
|
|
||||||
|
// Fixed to Camera?
|
||||||
|
if (this._cache[7] === 1)
|
||||||
|
{
|
||||||
|
this.position.x = this.game.camera.view.x + this.cameraOffset.x;
|
||||||
|
this.position.y = this.game.camera.view.y + this.cameraOffset.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy this Graphics instance.
|
||||||
|
*
|
||||||
|
* @method Phaser.Graphics.prototype.destroy
|
||||||
|
*/
|
||||||
|
Phaser.Graphics.prototype.destroy = function() {
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
|
||||||
|
if (this.parent)
|
||||||
|
{
|
||||||
|
this.parent.remove(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.exists = false;
|
||||||
|
this.visible = false;
|
||||||
|
|
||||||
|
this.game = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled
|
||||||
|
*
|
||||||
|
* @method Phaser.Graphics.prototype.drawPolygon
|
||||||
|
*/
|
||||||
|
Phaser.Graphics.prototype.drawPolygon = function (poly) {
|
||||||
|
|
||||||
|
this.moveTo(poly.points[0].x, poly.points[0].y);
|
||||||
|
|
||||||
|
for (var i = 1; i < poly.points.length; i += 1)
|
||||||
|
{
|
||||||
|
this.lineTo(poly.points[i].x, poly.points[i].y);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lineTo(poly.points[0].x, poly.points[0].y);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the rotation of the Graphics, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
|
||||||
|
* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.
|
||||||
|
* If you wish to work in radians instead of degrees use the property Sprite.rotation instead.
|
||||||
|
* @name Phaser.Graphics#angle
|
||||||
|
* @property {number} angle - Gets or sets the angle of rotation in degrees.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Graphics.prototype, 'angle', {
|
||||||
|
|
||||||
|
get: function() {
|
||||||
|
return Phaser.Math.radToDeg(this.rotation);
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function(value) {
|
||||||
|
this.rotation = Phaser.Math.degToRad(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An Graphics that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Graphics.cameraOffset.
|
||||||
|
* Note that the cameraOffset values are in addition to any parent in the display list.
|
||||||
|
* So if this Graphics was in a Group that has x: 200, then this will be added to the cameraOffset.x
|
||||||
|
*
|
||||||
|
* @name Phaser.Graphics#fixedToCamera
|
||||||
|
* @property {boolean} fixedToCamera - Set to true to fix this Graphics to the Camera at its current world coordinates.
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Phaser.Graphics.prototype, "fixedToCamera", {
|
||||||
|
|
||||||
|
get: function () {
|
||||||
|
|
||||||
|
return !!this._cache[7];
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (value) {
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
this._cache[7] = 1;
|
||||||
|
this.cameraOffset.set(this.x, this.y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this._cache[7] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</pre>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="copyright">
|
||||||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||||||
|
</span>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<span class="jsdoc-message">
|
||||||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||||
|
on Mon Feb 24 2014 12:11:34 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br clear="both">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="scripts/sunlight.js"></script>
|
||||||
|
<script src="scripts/sunlight.javascript.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.doclinks.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
|
||||||
|
<script src="scripts/sunlight-plugin.menu.js"></script>
|
||||||
|
<script src="scripts/jquery.min.js"></script>
|
||||||
|
<script src="scripts/jquery.scrollTo.js"></script>
|
||||||
|
<script src="scripts/jquery.localScroll.js"></script>
|
||||||
|
<script src="scripts/bootstrap-dropdown.js"></script>
|
||||||
|
<script src="scripts/toc.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$( function () {
|
||||||
|
$( "#toc" ).toc( {
|
||||||
|
selectors : "h1,h2,h3,h4",
|
||||||
|
showAndHide : false,
|
||||||
|
scrollTo : 60
|
||||||
|
} );
|
||||||
|
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
|
||||||
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
||||||
|
|
||||||
|
} );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||