{"_id":"2dgameinputs","_rev":"2-d3f34f521fcf8bcf315047b57be4b55d","name":"2dgameinputs","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"2dgameinputs","version":"1.0.0","type":"module","description":"a 2d game input handler","main":"InputHandler.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/alphayo-the-developer/INPUTHANDLER.git"},"author":{"name":"alphayo"},"license":"ISC","bugs":{"url":"https://github.com/alphayo-the-developer/INPUTHANDLER/issues"},"homepage":"https://github.com/alphayo-the-developer/INPUTHANDLER#readme","gitHead":"99b1aa450bd9b40241bd7e4e039f5bb7f3e54389","_id":"2dgameinputs@1.0.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-DQAR9sCFecJ8ojns5gqOmlq9mil3LMoze3yHMl2Fvm3tGLcmrxY27krlG9dGpZtUf7H/eokt+Jw9KZnt7ShuAg==","shasum":"c85575205d58cf6d114a670f54b04ea494f2e88d","tarball":"https://registry.npmjs.org/2dgameinputs/-/2dgameinputs-1.0.0.tgz","fileCount":2,"unpackedSize":12140,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDHCPPb3rVmI91qlv+DRWOdXE8Swz0Oli7UbXOhMEK1FAIhAJqk9e9NNLKg9+12vGjfEWTbekxcNjfc9QlUZFtcGeR2"}]},"_npmUser":{"name":"alphayothedeveloper","email":"alphayothedeveloper@gmail.com"},"directories":{},"maintainers":[{"name":"alphayothedeveloper","email":"alphayothedeveloper@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2dgameinputs_1.0.0_1712608166589_0.7144819101271553"},"_hasShrinkwrap":false},"1.1.0":{"name":"2dgameinputs","version":"1.1.0","type":"module","description":"a 2d game input handler","main":"InputHandler.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/alphayo-the-developer/INPUTHANDLER.git"},"author":{"name":"alphayo"},"license":"ISC","bugs":{"url":"https://github.com/alphayo-the-developer/INPUTHANDLER/issues"},"homepage":"https://github.com/alphayo-the-developer/INPUTHANDLER#readme","gitHead":"99b1aa450bd9b40241bd7e4e039f5bb7f3e54389","_id":"2dgameinputs@1.1.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-4/gziz8vhP2aSId3nJI6qhGHsA9vYr+Jror0XIkw0a7mjCLOXU3sZNHRJlD8+DvJ/+tNn/I+384PqAz9vaMv+A==","shasum":"2221c22d33e19b7dc97daf072582d461f793476d","tarball":"https://registry.npmjs.org/2dgameinputs/-/2dgameinputs-1.1.0.tgz","fileCount":3,"unpackedSize":24185,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDi761t4WcG4Dj0olD6z0bH/9Nh4egT2f1yrFzivZeAQIgTy4TRBIH8mAthEu0Hn9DftEJLAfR7GAf4jbWElEHHRY="}]},"_npmUser":{"name":"alphayothedeveloper","email":"alphayothedeveloper@gmail.com"},"directories":{},"maintainers":[{"name":"alphayothedeveloper","email":"alphayothedeveloper@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2dgameinputs_1.1.0_1712608229294_0.6083673123881232"},"_hasShrinkwrap":false},"1.2.0":{"name":"2dgameinputs","version":"1.2.0","type":"module","description":"a 2d game input handler","main":"InputHandler.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/alphayo-the-developer/INPUTHANDLER.git"},"author":{"name":"alphayo"},"license":"ISC","bugs":{"url":"https://github.com/alphayo-the-developer/INPUTHANDLER/issues"},"homepage":"https://github.com/alphayo-the-developer/INPUTHANDLER#readme","gitHead":"99b1aa450bd9b40241bd7e4e039f5bb7f3e54389","_id":"2dgameinputs@1.2.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-o5j4SVbYgTXjW+gghIGn/OJaXR02SX+5/jj+A8YXj4UqoQCpgtjlis39K/yTsSBN+Yd4Did0H8TYR5TPKUzqLw==","shasum":"5620596a5e9b236691b2702bd7b48b41aeae1829","tarball":"https://registry.npmjs.org/2dgameinputs/-/2dgameinputs-1.2.0.tgz","fileCount":3,"unpackedSize":24384,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDCGjMUefL3M8X4F4O9dVgNDBgSNGlDc5oRBcqytX5i3wIhAOctUIwAcKT3RehmQuWQPJ1yiNyRf6tmHIV1bof/JhgI"}]},"_npmUser":{"name":"alphayothedeveloper","email":"alphayothedeveloper@gmail.com"},"directories":{},"maintainers":[{"name":"alphayothedeveloper","email":"alphayothedeveloper@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2dgameinputs_1.2.0_1712609051421_0.7997537669442538"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-08T20:29:26.588Z","1.0.0":"2024-04-08T20:29:26.731Z","modified":"2024-04-08T20:44:11.729Z","1.1.0":"2024-04-08T20:30:29.444Z","1.2.0":"2024-04-08T20:44:11.561Z"},"maintainers":[{"name":"alphayothedeveloper","email":"alphayothedeveloper@gmail.com"}],"description":"a 2d game input handler","homepage":"https://github.com/alphayo-the-developer/INPUTHANDLER#readme","repository":{"type":"git","url":"git+https://github.com/alphayo-the-developer/INPUTHANDLER.git"},"author":{"name":"alphayo"},"bugs":{"url":"https://github.com/alphayo-the-developer/INPUTHANDLER/issues"},"license":"ISC","readme":"\r\n<a name=\"readme-top\"></a>\r\n\r\n[![MIT License][license-shield]][license-url]\r\n[![LinkedIn][linkedin-shield]][linkedin-url]\r\n\r\n\r\n\r\n<!-- PROJECT LOGO -->\r\n\r\n\r\n\r\n\r\n<!-- TABLE OF CONTENTS -->\r\n<!-- <details>\r\n  <summary>Table of Contents</summary>\r\n  <ol>\r\n    <li>\r\n      <a href=\"#about-the-project\">About The Project</a>\r\n      <ul>\r\n        <li><a href=\"#built-with\">Built With</a></li>\r\n      </ul>\r\n    </li>\r\n    <li>\r\n      <a href=\"#getting-started\">Getting Started</a>\r\n      <ul>\r\n        <li><a href=\"#prerequisites\">Prerequisites</a></li>\r\n        <li><a href=\"#installation\">Installation</a></li>\r\n      </ul>\r\n    </li>\r\n    <li><a href=\"#usage\">Usage</a></li>\r\n    <li><a href=\"#roadmap\">Roadmap</a></li>\r\n    <li><a href=\"#contributing\">Contributing</a></li>\r\n    <li><a href=\"#license\">License</a></li>\r\n    <li><a href=\"#contact\">Contact</a></li>\r\n    <li><a href=\"#acknowledgments\">Acknowledgments</a></li>\r\n  </ol>\r\n</details>\r\n -->\r\n\r\n\r\n<!-- ABOUT THE PROJECT -->\r\n## About The Project\r\n<!-- \r\n[![Product Name Screen Shot][product-screenshot]](https://example.com) -->\r\n\r\n![Markdown Logo](https://i.ibb.co/VxKrDtC/touch.jpg)\r\n<!-- \r\nThere are many great README templates available on GitHub; however, I didn't find one that really suited my needs so I created this enhanced one. I want to create a README template so amazing that it'll be the last one you ever need -- I think this is it.\r\n\r\nHere's why:\r\n* Your time should be focused on creating something amazing. A project that solves a problem and helps others\r\n* You shouldn't be doing the same tasks over and over like creating a README from scratch\r\n* You should implement DRY principles to the rest of your life :smile:\r\n\r\nOf course, no one template will serve all projects since your needs may be different. So I'll be adding more in the near future. You may also suggest changes by forking this repo and creating a pull request or opening an issue. Thanks to all the people have contributed to expanding this template!\r\n\r\nUse the `BLANK_README.md` to get started.\r\n\r\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\r\n -->\r\n\r\nWhen you want to quckly add Game Inputs in your javascript game.\r\n\r\nIt supports the following inputs :\r\n\r\n* Keyboard press\r\n* Button touch\r\n* TouchScreen swipes\r\n* Virtual Joystick\r\n\r\n\r\n\r\n\r\n\r\n<!-- ### Built With\r\n\r\nThis section should list any major frameworks/libraries used to bootstrap your project. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.\r\n\r\n* [![Next][Next.js]][Next-url]\r\n* [![React][React.js]][React-url]\r\n* [![Vue][Vue.js]][Vue-url]\r\n* [![Angular][Angular.io]][Angular-url]\r\n* [![Svelte][Svelte.dev]][Svelte-url]\r\n* [![Laravel][Laravel.com]][Laravel-url]\r\n* [![Bootstrap][Bootstrap.com]][Bootstrap-url]\r\n* [![JQuery][JQuery.com]][JQuery-url]\r\n\r\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\r\n -->\r\n\r\n\r\n<!-- GETTING STARTED -->\r\n## Getting Started\r\n\r\nUse the following url to download the library from a CDN.\r\n\r\n ```sh\r\n  https://unpkg.com/2dgameinputs/InputHandler.js\r\n  ```\r\n\r\n<!-- ### Prerequisites\r\n\r\nThis is an example of how to list things you need to use the software and how to install them.\r\n* npm\r\n  ```sh\r\n  npm install npm@latest -g\r\n  ``` -->\r\n<!-- \r\n### Installation\r\n\r\n_Below is an example of how you can instruct your audience on installing and setting up your app. This template doesn't rely on any external dependencies or services._\r\n\r\n1. Get a free API Key at [https://example.com](https://example.com)\r\n2. Clone the repo\r\n   ```sh\r\n   git clone https://github.com/your_username_/Project-Name.git\r\n   ```\r\n3. Install NPM packages\r\n   ```sh\r\n   npm install\r\n   ```\r\n4. Enter your API in `config.js`\r\n   ```js\r\n   const API_KEY = 'ENTER YOUR API';\r\n   ```\r\n\r\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\r\n -->\r\n\r\n\r\n<!-- USAGE EXAMPLES -->\r\n## Usage :\r\n\r\n\r\n\r\n### 1. joystick\r\n- import the JOYSTICK class\r\n```sh\r\n  import { JOYSTICK } from \"https://unpkg.com/2dgameinputs/InputHandler.js\";\r\n  ```\r\n- create an instance of the JOYSTIC class.\r\n```sh\r\n  var joystick = new JOYSTICK();\r\n  ```\r\n- The instance has a 'controller' property which has a 'value' property.  \r\n\r\n  ```sh\r\n  console.log(joystick.controller.value);\r\n  ```\r\n- This property is a vector with an 'x'and 'y' , each with a value ranging from -1 to 1.\r\n\r\n\r\n  ```sh\r\n\r\n    \"x\": 0,\r\n    \"y\": 0\r\n\r\n  ```\r\n\r\n  ### example:\r\n    move player to the right and left.\r\n\r\n    ```sh\r\n    function gameLoop(){\r\n      if( joystick.controller.value.x > 0){\r\n        player.position.x++\r\n      }\r\n\r\n      if( joystick.controller.value.x < 0){\r\n        player.position.x--\r\n      }\r\n    }\r\n\r\n    ```\r\n\r\n\r\n\r\n### 2. button\r\n- import the BUTTON class\r\n```sh\r\n  import { BUTTON } from \"https://unpkg.com/2dgameinputs/InputHandler.js\";\r\n  ```\r\n- create an instance of the BUTTON class that takes an element id as its  only parameter.\r\n```sh\r\n  var hitbtn = new BUTTON('btn');\r\n  ```\r\n- The instance has a 'pressed' property that is a boolean value.  \r\n\r\n  ```sh\r\n  console.log(hitbtn);\r\n  ```\r\n- This property is TRUE when the element is pressed and FALSE otherwise.\r\n\r\n\r\n\r\n  ### example:\r\n  a jump button\r\n\r\n    ```sh\r\n    function gameLoop(){\r\n      if( hitbtn){\r\n        player.position.y++\r\n      }\r\n\r\n    }\r\n\r\n    ```\r\n\r\n\r\n\r\n\r\n\r\n### 3. keyboard press\r\n- import the INPUTHANDLER class\r\n```sh\r\n  import { INPUTHANDLER } from \"https://unpkg.com/2dgameinputs/InputHandler.js\";\r\n  ```\r\n- create an instance of the INPUTHANDLER class.\r\n```sh\r\n  const inputHandler = new INPUTHANDLER();\r\n  ```\r\n- The instance has a 'addkeys' method that accepts a string (HTML keys)  .  \r\n\r\n  ```sh\r\n  inputHandler.addkeys('a')\r\n  inputHandler.addkeys('d')\r\n  ```\r\n- The instance has a 'getKey' method that returns a boolean value.  \r\n\r\n  ```sh\r\n  let a = inputHandler.getKey('a');\r\n\r\n  let d = inputHandler.getKey('d');\r\n  ```\r\n\r\n  ### example:\r\n    move player to the right and left.\r\n\r\n    ```sh\r\n    function gameLoop(){\r\n      if( d){\r\n        player.position.x++\r\n      }\r\n\r\n      if( a){\r\n        player.position.x--\r\n      }\r\n    }\r\n\r\n    ```\r\n\r\n\r\n\r\n### 3. touchscreen swipe\r\n- import the SWIPE class\r\n```sh\r\n  import { SWIPE } from \"https://unpkg.com/2dgameinputs/InputHandler.js\";\r\n  ```\r\n- create an instance of the SWIPE class.\r\n```sh\r\n  var swipe = new SWIPE();\r\n  ```\r\n- The instance has four methods that each  returns a boolean value .  \r\n\r\n  ```sh\r\n  let swipeDown = swipe.swipeDown()\r\n  let swiperight = swipe.swipeRight()\r\n  let swipeleft = swipe.swipeLeft()\r\n  let swipeup = swipe.swipeUp()\r\n  ```\r\n\r\n  ### example:\r\n    move player to the right and left.\r\n\r\n    ```sh\r\n    function gameLoop(){\r\n      if( swiperight){\r\n        player.position.x++\r\n      }\r\n\r\n      if(swipeleft){\r\n        player.position.x--\r\n      }\r\n    }\r\n\r\n    ```\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<!-- Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.\r\n\r\n_For more examples, please refer to the [Documentation](https://example.com)_ -->\r\n\r\n<!-- <p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p> -->\r\n\r\n\r\n\r\n<!-- ROADMAP -->\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<!-- ## Roadmap\r\n\r\n- [x] Add Topdown movement\r\n- [x] Add back to top links\r\n- [ ] Add Additional Templates w/ Examples\r\n- [ ] Add \"components\" document to easily copy & paste sections of the readme\r\n- [ ] Multi-language Support\r\n    - [ ] Chinese\r\n    - [ ] Spanish -->\r\n\r\n<!-- See the [open issues](https://github.com/othneildrew/Best-README-Template/issues) for a full list of proposed features (and known issues). -->\r\n\r\n<!-- <p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p> -->\r\n\r\n\r\n\r\n<!-- CONTRIBUTING -->\r\n<!-- ## Contributing\r\n\r\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\r\n\r\nIf you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag \"enhancement\".\r\nDon't forget to give the project a star! Thanks again!\r\n\r\n1. Fork the Project\r\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\r\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\r\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\r\n5. Open a Pull Request\r\n\r\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p> -->\r\n\r\n\r\n\r\n<!-- LICENSE -->\r\n## License\r\n\r\nDistributed under the MIT License. See `LICENSE.txt` for more information.\r\n\r\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\r\n\r\n\r\n\r\n<!-- CONTACT -->\r\n## Contact\r\n\r\n<!-- Your Name - [@your_twitter](https://twitter.com/your_username)  -->\r\n## email:\r\n- alphayothedeveloper@gmail.com\r\n## website:\r\n- https://alphayo-the-developer.github.io/\r\n\r\n<!-- Project Link: [https://github.com/your_username/repo_name](https://github.com/your_username/repo_name) -->\r\n\r\n<!-- <p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p> -->\r\n\r\n\r\n\r\n<!-- ACKNOWLEDGMENTS -->\r\n<!-- ## Acknowledgments\r\n\r\nUse this space to list resources you find helpful and would like to give credit to. I've included a few of my favorites to kick things off!\r\n\r\n* [Choose an Open Source License](https://choosealicense.com)\r\n* [GitHub Emoji Cheat Sheet](https://www.webpagefx.com/tools/emoji-cheat-sheet)\r\n* [Malven's Flexbox Cheatsheet](https://flexbox.malven.co/)\r\n* [Malven's Grid Cheatsheet](https://grid.malven.co/)\r\n* [Img Shields](https://shields.io)\r\n* [GitHub Pages](https://pages.github.com)\r\n* [Font Awesome](https://fontawesome.com)\r\n* [React Icons](https://react-icons.github.io/react-icons/search) -->\r\n\r\n<p align=\"right\">(<a href=\"#readme-top\">back to top</a>)</p>\r\n\r\n\r\n\r\n<!-- MARKDOWN LINKS & IMAGES -->\r\n<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->\r\n[contributors-shield]: https://img.shields.io/github/contributors/othneildrew/Best-README-Template.svg?style=for-the-badge\r\n[contributors-url]: https://github.com/othneildrew/Best-README-Template/graphs/contributors\r\n[forks-shield]: https://img.shields.io/github/forks/othneildrew/Best-README-Template.svg?style=for-the-badge\r\n[forks-url]: https://github.com/othneildrew/Best-README-Template/network/members\r\n[stars-shield]: https://img.shields.io/github/stars/othneildrew/Best-README-Template.svg?style=for-the-badge\r\n[stars-url]: https://github.com/othneildrew/Best-README-Template/stargazers\r\n[issues-shield]: https://img.shields.io/github/issues/othneildrew/Best-README-Template.svg?style=for-the-badge\r\n[issues-url]: https://github.com/othneildrew/Best-README-Template/issues\r\n[license-shield]: https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=for-the-badge\r\n[license-url]: https://github.com/othneildrew/Best-README-Template/blob/master/LICENSE.txt\r\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555\r\n[linkedin-url]: https://www.linkedin.com/in/alphayo-ken-70030820a/\r\n[product-screenshot]: https://ibb.co/9hMz2N4\r\n[Next.js]: https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white\r\n[Next-url]: https://nextjs.org/\r\n[React.js]: https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB\r\n[React-url]: https://reactjs.org/\r\n[Vue.js]: https://img.shields.io/badge/Vue.js-35495E?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D\r\n[Vue-url]: https://vuejs.org/\r\n[Angular.io]: https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white\r\n[Angular-url]: https://angular.io/\r\n[Svelte.dev]: https://img.shields.io/badge/Svelte-4A4A55?style=for-the-badge&logo=svelte&logoColor=FF3E00\r\n[Svelte-url]: https://svelte.dev/\r\n[Laravel.com]: https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white\r\n[Laravel-url]: https://laravel.com\r\n[Bootstrap.com]: https://img.shields.io/badge/Bootstrap-563D7C?style=for-the-badge&logo=bootstrap&logoColor=white\r\n[Bootstrap-url]: https://getbootstrap.com\r\n[JQuery.com]: https://img.shields.io/badge/jQuery-0769AD?style=for-the-badge&logo=jquery&logoColor=white\r\n[JQuery-url]: https://jquery.com ","readmeFilename":"README.md"}