├── LICENSE ├── README.md ├── index.html ├── stats.js └── texture.jpg /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 Jake Gordon and contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Javascript Tetris 2 | ================= 3 | 4 | An HTML5 Tetris Game 5 | 6 | * [play the game](https://jakesgordon.com/games/tetris/) 7 | * read a [blog article](https://jakesgordon.com/writing/javascript-tetris/) 8 | * view the [source](https://github.com/jakesgordon/javascript-tetris) 9 | 10 | >> _*SUPPORTED BROWSERS*: Chrome, Firefox, Safari, Opera and IE9+_ 11 | 12 | FUTURE 13 | ====== 14 | 15 | * menu 16 | * animation and fx 17 | * levels 18 | * high scores 19 | * touch support 20 | * music and sound fx 21 | 22 | 23 | License 24 | ======= 25 | 26 | [MIT](http://en.wikipedia.org/wiki/MIT_License) license. 27 | 28 | 29 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Javascript Tetris 5 | 25 | 26 | 27 | 28 | 29 |
30 | 36 | 37 | Sorry, this example cannot be run because your browser does not support the <canvas> element 38 | 39 |
40 | 41 | 42 | 447 | 448 | 449 | 450 | -------------------------------------------------------------------------------- /stats.js: -------------------------------------------------------------------------------- 1 | // stats.js r6 - http://github.com/mrdoob/stats.js 2 | var Stats=function(){function s(a,g,d){var f,c,e;for(c=0;c<30;c++)for(f=0;f<73;f++)e=(f+c*74)*4,a[e]=a[e+4],a[e+1]=a[e+5],a[e+2]=a[e+6];for(c=0;c<30;c++)e=(73+c*74)*4,c'+n+" MS ("+z+"-"+A+")";o.putImageData(B,0,0);F=j;if(j> 9 | v+1E3){l=Math.round(u*1E3/(j-v));w=Math.min(w,l);x=Math.max(x,l);s(y.data,Math.min(30,30-l/100*30),"fps");d.innerHTML=''+l+" FPS ("+w+"-"+x+")";m.putImageData(y,0,0);if(t==3)p=performance.memory.usedJSHeapSize*9.54E-7,C=Math.min(C,p),D=Math.max(D,p),s(E.data,Math.min(30,30-p/2),"mb"),i.innerHTML=''+Math.round(p)+" MB ("+Math.round(C)+"-"+Math.round(D)+")",q.putImageData(E,0,0);v=j;u=0}}}}; 10 | 11 | -------------------------------------------------------------------------------- /texture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jakesgordon/javascript-tetris/e5c0c42f7dac0f3514a55eff656c6e22e95d68ed/texture.jpg --------------------------------------------------------------------------------