A userscript that allows EaglerCraft to run on mobile browsers
Go to file
FlamedDogo af4f94ae7a
Merge pull request #17 from FlamedDogo99/input-fix
Fixes for Android keyboard input, and mobile selection
2024-06-15 19:25:23 -06:00
.github Update CONTRIBUTING.md 2024-06-15 13:50:24 -06:00
images Added social.png 2024-06-08 11:28:25 -06:00
.gitignore Updated 2024-05-26 15:21:04 -06:00
eaglermobile-ef.js Fixed input handling 2024-06-08 07:45:11 -06:00
eaglermobile.user.js Fixed formatting issues 2024-06-15 19:22:49 -06:00
LICENSE Initial commit 2024-05-26 15:11:24 -06:00
README.md Fixed badge issue? 2024-06-15 18:59:37 -06:00

Eagler Mobile LogoEagler Mobile

Releases Eaglercraft.com License

About

Eagler Mobile brings new functionality and benefits for the EaglerCraft web client by providing mobile-friendly touch controls, keyboard access, and other settings configurable through the EaglerCraft client.

Eagler Mobile Screenshot

Installation

The easiest way to use Eagler Mobile is to use a userscript application such as Greasemonkey, however since Eagler Mobile is plain JavaScript you can easily deploy it in other ways as well. As an example we've included eaglermobile.ef.js which can be run as a mod on EaglerForge.

See more examples
  1. Self hosted

If you are hosting the EaglerCraft client on your own server, you can include the mobile script in the index.html folder as a script.

<script type="text/javascript" src="yourDirectory/eaglermobile.user.js"></script>

  1. Other userscript applications

Non-mobile browsers:

  • Chrome, FireFox, Safari, Edge, Opera Next, Microsoft Edge: Tampermonkey

iOS:

Android:


If you want to download the source, no building is required. The best way to download the source is with Git:

git clone https://github.com/FlamedDogo99/EaglerMobile.git

Contributing

Suggestions and bug reports

If you found a bug or have a suggestion create an issue after checking for duplicates.

Code

Before contributing code, please read our contributing guidelines.

Features and documentation

Fake API's

  • Pointerlock methods such as Element.prototype.requestPointerLock, document.pointerLockElement, and document.exitPointerLock are replaced with vanilla JavaScript that mimics pointerlock functionality. This allows the EaglerCraft client to load.
  • Fullscreen methods such as Element.prototype.requestFullscreen, document.fullscreenElement, and document.exitFullscreen are replaced with vanilla JavaScript that mimics fullscreen functionality. This fixes a crash due with viewport dimensions.

Keyboard Events

  • The EaglerCraft client captures keypress through a keydown event listener. Because Android devices currently have an issue with keydown and keyup events, Eagler Mobile dynamically toggles between capturing keydown and input events. The state is saved in window.keyboardFix, and is toggled if a faulty keyboard event is detected.
  • To dispatch keyboard events, Eagler Mobile requires the use of the keyEvent function, in order to maintain functionality for input event listeners. For example, typing an uppercase h in the chat is as simple as:
    keyEvent("shift", "keydown"); 
    keyEvent("h", "keydown");
    

Mobile controls

  • Eagler Mobile controls can either be shown in-game or in-menu. When creating a an element you can achieve this simply by either adding the inGame or inMenu class.
  • Simple gesture controls such as scrolling, single pressing, and long pressing have been implemented, however there are currently no functions provided to easily bring this functionality to other elements.

File uploads

  • On MacOS and iOS safari, the EaglerCraft client's implementation of triggering the file selection dialog does not work. A rudimentary fix has been added for now.

License

Eagler Mobile is licensed under the terms of the Apache License, Version 2.0.

Intended future features

  • Gamepad support: Mapping gamepad inputs to keyEvent, wheelEvent and mouseEvent functions, and implenting a controllable fake cursor for menus.
  • File upload improvements: Adding a cancel button and improving the styling
  • Dynamic enable and disable of features: Seperating gamepad controls, touch controls, pointerlock fix, and upload fix into seperate functions which can be enabled and disabled by the user