Merge branch 'master' into gh-pages
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
## Contributing
|
||||
Changes and improvements are more than welcome! Feel free to fork and open a pull request. Please make your changes in a specifically made branch and request to pull on `master`! If you can, please make sure the game fully works before sending the PR, as that will help speed up the process.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Gabriele Cirulli
|
||||
|
||||
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,6 +1,16 @@
|
||||
# 2048
|
||||
A small clone of [1024](https://play.google.com/store/apps/details?id=com.veewo.a1024), based on [Saming's 2048](saming.fr/p/2048/) (also a clone).
|
||||
A small clone of [1024](https://play.google.com/store/apps/details?id=com.veewo.a1024), based on [Saming's 2048](http://saming.fr/p/2048/) (also a clone).
|
||||
|
||||
Made just for fun. [Play it here!](http://gabrielecirulli.github.io/2048/)
|
||||
|
||||
[](http://pictures.gabrielecirulli.com/2048-20140309-234100.png)
|
||||
|
||||
That screenshot is fake by, the way. I never reached 2048 :smile:
|
||||
|
||||
## Contributing
|
||||
Changes and improvements are more than welcome! Feel free to fork and open a pull request. Please make your changes in a specifically made branch and request to pull on `master`! If you can, please make sure the game fully works before sending the PR, as that will help speed up the process.
|
||||
|
||||
You can find the same information in the [contributing guide.](https://github.com/gabrielecirulli/2048/blob/master/CONTRIBUTING.md)
|
||||
|
||||
## License
|
||||
2048 is licensed under the [MIT license.](https://github.com/gabrielecirulli/2048/blob/master/LICENSE.txt)
|
||||
|
||||
@@ -6,12 +6,17 @@
|
||||
|
||||
<link href="style/main.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<script src="js/hammer.min.js"></script>
|
||||
<script src="js/keyboard_input_manager.js"></script>
|
||||
<script src="js/html_actuator.js"></script>
|
||||
<script src="js/grid.js"></script>
|
||||
<script src="js/tile.js"></script>
|
||||
<script src="js/game_manager.js"></script>
|
||||
<script src="js/application.js"></script>
|
||||
|
||||
<meta name="HandheldFriendly" content="True">
|
||||
<meta name="MobileOptimized" content="320">
|
||||
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0, maximum-scale=1, user-scalable=no">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
+9
File diff suppressed because one or more lines are too long
@@ -47,6 +47,23 @@ KeyboardInputManager.prototype.listen = function () {
|
||||
|
||||
var retry = document.getElementsByClassName("retry-button")[0];
|
||||
retry.addEventListener("click", this.restart.bind(this));
|
||||
|
||||
// Listen to swipe events
|
||||
var gestures = [Hammer.DIRECTION_UP, Hammer.DIRECTION_RIGHT,
|
||||
Hammer.DIRECTION_DOWN, Hammer.DIRECTION_LEFT];
|
||||
|
||||
var gameContainer = document.getElementsByClassName("game-container")[0];
|
||||
var handler = Hammer(gameContainer, {
|
||||
drag_block_horizontal: true,
|
||||
drag_block_vertical: true
|
||||
});
|
||||
|
||||
handler.on("swipe", function (event) {
|
||||
event.gesture.preventDefault();
|
||||
mapped = gestures.indexOf(event.gesture.direction);
|
||||
|
||||
if (mapped !== -1) self.emit("move", mapped);
|
||||
});
|
||||
};
|
||||
|
||||
KeyboardInputManager.prototype.restart = function (event) {
|
||||
|
||||
Reference in New Issue
Block a user