Skip to main content

Simple utility to remap Panda3D events

Project description

Build Status Package Versions Panda3D Versions License

Panda3D Event Mapper

A simple utility to remap Panda3D events.

Features

  • Remap events
  • Configure via PRC variables or an API
  • Handle keyboards, mice, and gamepads

Installation

Use pip to install the panda3d-eventmapper package:

pip install panda3d-eventmapper

Example

import sys

from direct.showbase.ShowBase import ShowBase
import panda3d.core as p3d

import eventmapper


p3d.load_prc_file_data(
    '',
    'event-map-item-quit escape q\n'
    'event-map-item-move-forward raw-w\n'
    'event-map-item-move-backward raw-s\n'
    'event-map-item-move-left raw-a\n'
    'event-map-item-move-right raw-d\n'
)


class GameApp(ShowBase):
    def __init__(self):
        super().__init__()

        self.eventmapper = eventmapper.EventMapper()
        self.accept('quit', sys.exit)
        self.accept('move-forward', print, ['move forward'])
        self.accept('move-backward', print, ['move backward'])
        self.accept('move-left', print, ['move left'])
        self.accept('move-right', print, ['move right'])

GameApp().run()

Running Tests

First install panda3d-simplepbr in editable mode along with test extras:

pip install -e .[test]

Then run the test suite with pytest:

pytest

Building Wheels

Install build:

pip install --upgrade build

and run:

python -m build

License

BSD

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

panda3d-eventmapper-0.3.0.tar.gz (5.2 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page