⚠️ Oops! This page doesn't appear to define a type called _.
Edit

Reprocessing

The Run Function

This is how all of your programs start. At minimum you need a setup function, but it also doesn't make much sense to not have a draw function.

let run = ( ~setup: glEnvT => 'a, ~?screen: option(string), ~?draw: option(('a, glEnvT) => 'a), ~?mouseMove: option(('a, glEnvT) => 'a), ~?mouseDragged: option(('a, glEnvT) => 'a), ~?mouseDown: option(('a, glEnvT) => 'a), ~?mouseUp: option(('a, glEnvT) => 'a), ~?keyPressed: option(('a, glEnvT) => 'a), ~?keyReleased: option(('a, glEnvT) => 'a), ~?keyTyped: option(('a, glEnvT) => 'a), unit ) => unit

Hot reloading

Put the following in an indexhot.re

Reprocessing.hotreload("./index.re")

let hotreload = (~?screen: option(string), string) => bool

Misc helpers

The following modules are included here as a psuedo namespacing function. It is common to open Reprocessing and then access them as Draw.rect, etc.

Handling Multiple Canvases

(only supported on web target)

let setScreenId = string => unit

Set the ID that will be used by subsequent calls to run() that don't have an explicitly-passed ~screen.

If a canvas exists on the document with the given ID, then that canvas will be used. Otherwise a canvas will be created & appended to the body.

Reprocessing.setScreenId("my-fancy-id");
/* This will render to the canvas with id "my-fancy-id" */
Reprocessing.run(~setup, ~draw, ());

let clearScreenId = unit => unit

let playPause = (string, bool) => option(bool)

Play/pause the screen specified by the given ID. If you pass true, it will try to play it, otherwise pause.

The return value indicates the status:

  • None: no screen found
  • Some(true): the screen is (now/still) playing
  • Some(false): the screen is (now/still) paused

Calling this function will not necessarily change the state. Inspect the result to determine success.

include Reprocessing_Types.TypesT