Skip to content

⚙️ A Webpack Loader for Reaper files.

License

Notifications You must be signed in to change notification settings

theatrejs/loader-reaper

Repository files navigation

Copyright License Bundle Size (Gzipped) NPM Version

Reaper Webpack Loader

⚙️ A Webpack Loader for Reaper files.

Installation

⚠️ This loader needs you to have Reaper installed.

npm install @theatrejs/loader-reaper --save-dev

Webpack Configuration

{
    'module': {
        'rules': [
            ...
            {
                'test': /\.rpp$/,
                'use': [
                    {
                        'loader': '@theatrejs/loader-reaper',
                        'options': {
                            'reaper': '<path-to-reaper>' // The path to the Reaper executable.
                        }
                    }
                ]
            }
            ...
        ]
    }
}

Quick Start

⚠️ This example does not include the preloading of assets.

import {Actor, Sound} from '@theatrejs/theatrejs';

import soundBreathe from './breathe.rpp';

class Hero extends Actor {
    onCreate() {
        this.addSound(
            new Sound({
                $audio: soundBreathe
            })
        );
    }
}

With Preloading

import {FACTORIES, Sound} from '@theatrejs/theatrejs';

import soundBreathe from './breathe.rpp';

class Hero extends FACTORIES.ActorWithPreloadables([FACTORIES.PreloadableSound(soundBreathe)]) {
    onCreate() {
        this.addSound(
            new Sound({
                $audio: soundBreathe
            })
        );
    }
}