mistercar-input-devices


Namemistercar-input-devices JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/PypayaTech/mistercar-input-devices
SummaryRead and emulate keyboard, mouse, and gamepad
upload_time2024-11-13 23:02:18
maintainerNone
docs_urlNone
authorPypayaTech
requires_python<4.0,>=3.10
licenseMIT
keywords input reading input emulation gui automation keyboard mouse gamepad
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🎮 mistercar-input-devices

A cross-platform Python package for capturing and emulating keyboard, mouse, and gamepad inputs.

## 🌟 Features

- ⌨ī¸ Keyboard input capture and emulation
- 🖱ī¸ Mouse input capture and emulation
- 🕹ī¸ Gamepad input capture and emulation
- đŸ–Ĩī¸ Cross-platform support (Windows, macOS, Linux)

## 🚀 Installation

You can install mistercar-input-devices using pip:

```bash
pip install mistercar-input-devices
```

### 📋 Prerequisites

- Python 3.10 or higher

#### Windows-specific setup

1. Disable driver signature enforcement. This is necessary for installing unsigned drivers. Follow the instructions in this guide: [How to disable driver signature enforcement on Windows 10](https://medium.com/@pypaya_tech/unlock-your-windows-a-guide-to-disabling-driver-signature-enforcement-342103d51997)

2. Open a command prompt as an administrator.

3. Navigate to the appropriate directory:
   - For 64-bit systems: `cd path\to\mistercar_input_devices\backend\windows\platform_specific\pyxinput\ScpVBus-x64`
   - For 32-bit systems: `cd path\to\mistercar_input_devices\backend\windows\platform_specific\pyxinput\ScpVBus-x86`

4. Run the following command:
   ```
   devcon.exe install ScpVBus.inf Root\ScpVBus
   ```

## đŸŽ¯ Usage

Here are some basic examples of how to use mistercar-input-devices:

### ⌨ī¸ Keyboard

```python
from mistercar_input_devices.input_readers.keyboard_reader import global_keyboard_reader
from mistercar_input_devices.input_emulators.keyboard_emulator import global_keyboard_emulator

# Check if a key is pressed
if global_keyboard_reader.get_key_state('A'):
    print("A key is pressed")

# Press a key
global_keyboard_emulator.emulate_key('B', 1)  # Press
global_keyboard_emulator.emulate_key('B', 0)  # Release
```

### 🖱ī¸ Mouse

```python
from mistercar_input_devices.input_readers.mouse_reader import global_mouse_reader
from mistercar_input_devices.input_emulators.mouse_emulator import global_mouse_emulator

# Read mouse position
x, y = global_mouse_reader.get_cursor_position()
print(f"Mouse position: {x}, {y}")

# Move mouse
global_mouse_emulator.move_cursor_to(100, 100)

# Click
global_mouse_emulator.left_click()
```

### 🕹ī¸ Gamepad

```python
from mistercar_input_devices.input_readers.gamepad_reader import global_gamepad_reader
from mistercar_input_devices.input_emulators.gamepad_emulator import global_gamepad_emulator

# Read gamepad state
gamepad_state = global_gamepad_reader.get_control_state('AxisLx')
print(f"Left stick X-axis: {gamepad_state}")

# Emulate gamepad input
global_gamepad_emulator.emulate_control('AxisLx', 0.5)  # Move left stick halfway to the right
```

## 🚀 Examples

Check out the `examples` directory for comprehensive demonstrations of the library's capabilities. We provide three example scripts:

1. `keyboard_example.py`: Demonstrates keyboard input reading and emulation.
2. `mouse_example.py`: Shows mouse input reading and emulation.
3. `gamepad_example.py`: Illustrates gamepad input reading and emulation.

## 📊 Implementation status

The current implementation status of mistercar-input-devices across different platforms:

| Feature | Windows | Linux | macOS |
|---------|---------|-------|-------|
| Keyboard Reader | ✅ | ❌ | ❌ |
| Keyboard Emulator | ✅ | ✅ | ✅ |
| Mouse Reader | ✅ | ❌ | ❌ |
| Mouse Emulator | ✅ | ✅ | ✅ |
| Gamepad Reader | ✅ | ❌ | ❌ |
| Gamepad Emulator | ✅ | ❌ | ❌ |

Legend:
- ✅ Fully implemented
- ⚠ī¸ Partially implemented or needs testing
- ❌ Not yet implemented

### Notes on implementation

- Windows: Custom low-level implementation for all features, ensuring reliability in various contexts, including video games.
- Linux and macOS: 
  - Keyboard and Mouse emulation use PyAutoGUI, which works well in most contexts but may have limitations in some video games.
  - Keyboard and Mouse reading functionality is not yet implemented.
  - Gamepad functionality is not yet implemented.

### Roadmap

- Implement keyboard and mouse reading functionality for Linux and macOS platforms.
- Implement gamepad support for Linux and macOS.
- Enhance cross-platform compatibility and consistency.
- Explore options for more reliable input methods in game contexts for Linux and macOS.

We welcome contributions to help improve and extend the library's functionality across all supported platforms!

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🙏 Acknowledgments

Special thanks to the creators of these libraries and projects that have been instrumental in the development of mistercar-input-devices:

- [PYXInput](https://github.com/bayangan1991/PYXInput): For gamepad reading and emulation implementation on Windows.
- [pygta5](https://github.com/Sentdex/pygta5): For inspiration from the self-driving car GTA V project and the `keys.py` file, which was particularly helpful for implementing keyboard emulation on Windows.
- [PyAutoGUI](https://pypi.org/project/PyAutoGUI/): For providing cross-platform keyboard and mouse emulation capabilities, especially utilized in our Linux and macOS implementations.

We are grateful for the open-source community and these projects that have made our work possible.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PypayaTech/mistercar-input-devices",
    "name": "mistercar-input-devices",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "input reading, input emulation, GUI automation, keyboard, mouse, gamepad",
    "author": "PypayaTech",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/a3/7b/8feb02b544081a7285b6283236efb7256a621bb7a77826c5adf6554ad9dc/mistercar_input_devices-0.2.1.tar.gz",
    "platform": null,
    "description": "# \ud83c\udfae mistercar-input-devices\n\nA cross-platform Python package for capturing and emulating keyboard, mouse, and gamepad inputs.\n\n## \ud83c\udf1f Features\n\n- \u2328\ufe0f Keyboard input capture and emulation\n- \ud83d\uddb1\ufe0f Mouse input capture and emulation\n- \ud83d\udd79\ufe0f Gamepad input capture and emulation\n- \ud83d\udda5\ufe0f Cross-platform support (Windows, macOS, Linux)\n\n## \ud83d\ude80 Installation\n\nYou can install mistercar-input-devices using pip:\n\n```bash\npip install mistercar-input-devices\n```\n\n### \ud83d\udccb Prerequisites\n\n- Python 3.10 or higher\n\n#### Windows-specific setup\n\n1. Disable driver signature enforcement. This is necessary for installing unsigned drivers. Follow the instructions in this guide: [How to disable driver signature enforcement on Windows 10](https://medium.com/@pypaya_tech/unlock-your-windows-a-guide-to-disabling-driver-signature-enforcement-342103d51997)\n\n2. Open a command prompt as an administrator.\n\n3. Navigate to the appropriate directory:\n   - For 64-bit systems: `cd path\\to\\mistercar_input_devices\\backend\\windows\\platform_specific\\pyxinput\\ScpVBus-x64`\n   - For 32-bit systems: `cd path\\to\\mistercar_input_devices\\backend\\windows\\platform_specific\\pyxinput\\ScpVBus-x86`\n\n4. Run the following command:\n   ```\n   devcon.exe install ScpVBus.inf Root\\ScpVBus\n   ```\n\n## \ud83c\udfaf Usage\n\nHere are some basic examples of how to use mistercar-input-devices:\n\n### \u2328\ufe0f Keyboard\n\n```python\nfrom mistercar_input_devices.input_readers.keyboard_reader import global_keyboard_reader\nfrom mistercar_input_devices.input_emulators.keyboard_emulator import global_keyboard_emulator\n\n# Check if a key is pressed\nif global_keyboard_reader.get_key_state('A'):\n    print(\"A key is pressed\")\n\n# Press a key\nglobal_keyboard_emulator.emulate_key('B', 1)  # Press\nglobal_keyboard_emulator.emulate_key('B', 0)  # Release\n```\n\n### \ud83d\uddb1\ufe0f Mouse\n\n```python\nfrom mistercar_input_devices.input_readers.mouse_reader import global_mouse_reader\nfrom mistercar_input_devices.input_emulators.mouse_emulator import global_mouse_emulator\n\n# Read mouse position\nx, y = global_mouse_reader.get_cursor_position()\nprint(f\"Mouse position: {x}, {y}\")\n\n# Move mouse\nglobal_mouse_emulator.move_cursor_to(100, 100)\n\n# Click\nglobal_mouse_emulator.left_click()\n```\n\n### \ud83d\udd79\ufe0f Gamepad\n\n```python\nfrom mistercar_input_devices.input_readers.gamepad_reader import global_gamepad_reader\nfrom mistercar_input_devices.input_emulators.gamepad_emulator import global_gamepad_emulator\n\n# Read gamepad state\ngamepad_state = global_gamepad_reader.get_control_state('AxisLx')\nprint(f\"Left stick X-axis: {gamepad_state}\")\n\n# Emulate gamepad input\nglobal_gamepad_emulator.emulate_control('AxisLx', 0.5)  # Move left stick halfway to the right\n```\n\n## \ud83d\ude80 Examples\n\nCheck out the `examples` directory for comprehensive demonstrations of the library's capabilities. We provide three example scripts:\n\n1. `keyboard_example.py`: Demonstrates keyboard input reading and emulation.\n2. `mouse_example.py`: Shows mouse input reading and emulation.\n3. `gamepad_example.py`: Illustrates gamepad input reading and emulation.\n\n## \ud83d\udcca Implementation status\n\nThe current implementation status of mistercar-input-devices across different platforms:\n\n| Feature | Windows | Linux | macOS |\n|---------|---------|-------|-------|\n| Keyboard Reader | \u2705 | \u274c | \u274c |\n| Keyboard Emulator | \u2705 | \u2705 | \u2705 |\n| Mouse Reader | \u2705 | \u274c | \u274c |\n| Mouse Emulator | \u2705 | \u2705 | \u2705 |\n| Gamepad Reader | \u2705 | \u274c | \u274c |\n| Gamepad Emulator | \u2705 | \u274c | \u274c |\n\nLegend:\n- \u2705 Fully implemented\n- \u26a0\ufe0f Partially implemented or needs testing\n- \u274c Not yet implemented\n\n### Notes on implementation\n\n- Windows: Custom low-level implementation for all features, ensuring reliability in various contexts, including video games.\n- Linux and macOS: \n  - Keyboard and Mouse emulation use PyAutoGUI, which works well in most contexts but may have limitations in some video games.\n  - Keyboard and Mouse reading functionality is not yet implemented.\n  - Gamepad functionality is not yet implemented.\n\n### Roadmap\n\n- Implement keyboard and mouse reading functionality for Linux and macOS platforms.\n- Implement gamepad support for Linux and macOS.\n- Enhance cross-platform compatibility and consistency.\n- Explore options for more reliable input methods in game contexts for Linux and macOS.\n\nWe welcome contributions to help improve and extend the library's functionality across all supported platforms!\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\ude4f Acknowledgments\n\nSpecial thanks to the creators of these libraries and projects that have been instrumental in the development of mistercar-input-devices:\n\n- [PYXInput](https://github.com/bayangan1991/PYXInput): For gamepad reading and emulation implementation on Windows.\n- [pygta5](https://github.com/Sentdex/pygta5): For inspiration from the self-driving car GTA V project and the `keys.py` file, which was particularly helpful for implementing keyboard emulation on Windows.\n- [PyAutoGUI](https://pypi.org/project/PyAutoGUI/): For providing cross-platform keyboard and mouse emulation capabilities, especially utilized in our Linux and macOS implementations.\n\nWe are grateful for the open-source community and these projects that have made our work possible.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Read and emulate keyboard, mouse, and gamepad",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/PypayaTech/mistercar-input-devices",
        "Repository": "https://github.com/PypayaTech/mistercar-input-devices"
    },
    "split_keywords": [
        "input reading",
        " input emulation",
        " gui automation",
        " keyboard",
        " mouse",
        " gamepad"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fe2e91fb2c71f149a2ccd26c74679c7d07d5fcbda75a129fa11fc9c73aae2182",
                "md5": "ae065c37c301dcfcadfe670ef3d8f551",
                "sha256": "d2b1d9ccdd48658ec60e30af497fe9ce37a1fcffd0e16730d555449676f54433"
            },
            "downloads": -1,
            "filename": "mistercar_input_devices-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ae065c37c301dcfcadfe670ef3d8f551",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 5459179,
            "upload_time": "2024-11-13T23:02:03",
            "upload_time_iso_8601": "2024-11-13T23:02:03.998372Z",
            "url": "https://files.pythonhosted.org/packages/fe/2e/91fb2c71f149a2ccd26c74679c7d07d5fcbda75a129fa11fc9c73aae2182/mistercar_input_devices-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a37b8feb02b544081a7285b6283236efb7256a621bb7a77826c5adf6554ad9dc",
                "md5": "b9e4f07d615f51bcbb2d73e11fa11df2",
                "sha256": "c5c8ba943491f631b6f860d8322c134876259bf08fcab6e87403478fea376f2f"
            },
            "downloads": -1,
            "filename": "mistercar_input_devices-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b9e4f07d615f51bcbb2d73e11fa11df2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 5429494,
            "upload_time": "2024-11-13T23:02:18",
            "upload_time_iso_8601": "2024-11-13T23:02:18.330947Z",
            "url": "https://files.pythonhosted.org/packages/a3/7b/8feb02b544081a7285b6283236efb7256a621bb7a77826c5adf6554ad9dc/mistercar_input_devices-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-13 23:02:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PypayaTech",
    "github_project": "mistercar-input-devices",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mistercar-input-devices"
}
        
Elapsed time: 0.39539s