Version 3.0.1

Added keyboard images
Updated readme
Possibly fixed upload button crash
This commit is contained in:
FlamedDogo99 2024-06-08 00:10:03 -06:00
parent 24c963440a
commit 0045f5a01d
53 changed files with 62 additions and 25 deletions

View File

@ -1,28 +1,65 @@
# Eagler Mobile
# <img src="images/icon128.png" alt="Eagler Mobile Logo" align="right" width="128px"></img>Eagler Mobile
## A userscript that allows eaglercraft to run on mobile devices
To-do
- [ ] Cancel button for file upload
- [ ] Styling for file upload
- [ ] Back button for Kiwi browser?
- [ ] Gamepad support
- [ ] Seperate pointerlock fix, file upload fix, touch screen controls, and gamepad controls
- [ ] Custom settings menu for mobile button placement, and mouse sensitivity for gamepad and touch events
- [ ] Dynamic enable and disable of pointerlock fix, file upload fix, touch screen controls, and gamepad controls
Implemented
- [x] Fake pointerlock API (tricks the client into loading)
- [x] Fake fullscreen API (so that selecting full screen doesn't crash the client)
- [x] Custom upload button for files (because safari is a pain with button clicks)
- [x] Fake mousemove events (Allows touch and drag to simulate mouse movement)
- [x] Fake cursor scroll events (Allows scrolling through hotbar and in menus)
- [x] On-screen controls (Movement, block placement/removal/picking, inventory, item dropping, keyboard, and exiting keys)
- [x] Styling for html, body, and canvas (So that the canvas doesn't ignore the navigation bars for viewport sizing)
- [x] Strafe buttons when holding forward
- [x] Crouch lock on hold
- [x] Re-orginize button layout
- [x] Redo the display button functions
- [x] Sprint button (sperate from double tapping forward)
- [x] Android-friendly keyboard capture
![](https://img.shields.io/badge/Github-v3.0.1-blue?style=flat-square&logo=github&logoColor=white&label=GitHub&color=181717)
[![](https://img.shields.io/github/license/FlamedDogo99/EaglerMobile?style=flat-square)](https://github.com/FlamedDogo99/EaglerMobile/blob/master/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 configirable through the EaglerCraft client.
<div align="center">
![Eagler Mobile Screenshot](images/preview.png)
</div>
## Installation
The easiest way to use Eagler Mobile is to use a userscript application such as Greasemonkey. That being said, because Eagler Mobile is plain JavaScript you can easily deploy it in other ways as well. For instance we've included `eaglermobile.ef.js` which can be run as a mod on [EaglerForge](https://github.com/eaglerforge/EaglerForge).
If you want to download the source, no building is required. The best way to download the source is with Git:
```sh
git clone https://github.com/ScratchAddons/ScratchAddons.git
```
## Contributing
### Suggestions and bug reports
If you found a bug or have a suggestion [create an issue]([https://github.com/ScratchAddons/ScratchAddons/issues/new/choose](https://github.com/FlamedDogo99/EaglerMobile/issues/new/choose)) after checking for duplicates.
### 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.
#### Addons
- `addons-l10n`: Translation for addon strings (one file per addon).
- `addon-api`: Implementation of the `addon.*` JavaScript APIs.
- `addons`: Each addon has its own directory, which must include an addon manifest file named `addon.json`.
- `libraries`: Third-party libraries and other utilities, some of which are used by addons.
## License
Scratch Addons is licensed under the terms of the [Apache License, Version 2.0]([https://github.com/ScratchAddons/ScratchAddons/blob/master/LICENSE](https://github.com/FlamedDogo99/EaglerMobile/blob/main/LICENSE)).
## 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

BIN
images/attack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

BIN
images/attack_pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

BIN
images/backButton.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/backPressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/buttonPressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/chat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
images/chatPressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/compass.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/compassPressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/crouch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/crouchLock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
images/crouchPressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/down.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

BIN
images/down_pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

BIN
images/drop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/dropPressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/interact_pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

BIN
images/inventory.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/inventoryPressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/jumpButton.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/keyboard.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/keyboardPressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

BIN
images/left_pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

BIN
images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
images/logo128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
images/pauseButton.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
images/pausePressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/perspective5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
images/place.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

BIN
images/right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

BIN
images/right_pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

BIN
images/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/scrollLeft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/scrollRight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/select.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/selectPressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/sprint.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

BIN
images/sprint_pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

BIN
images/strafeLeft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/strafeRight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/up.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

BIN
images/up_pressed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B