Izzimach / om-react-pixi

Bindings for om to let you control pixi sprites from clojurescript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

om-react-pixi

Interactive example

Bindings for Om to let you create and control Pixi.js sprites from ClojureScript.

A simple example displaying text on a 400px by 300px canvas:

(defn simplestage [cursor]
  (om/component
   (pixi/stage #js {:width 400 :height 300}
    (pixi/text #js {:x 100 :y 100 :text "argh!"}))))

How to Include and Use

The latest version is 0.5.0. In your project.clj include this dependency:

[org.clojars.haussman/om-react-pixi "0.5.0"]

This will also include react-pixi which itself includes react 0.13.1.

Standard components are in the omreactpixi.core namespace. There are also abbreviated forms that are based on the forms used by om-tools which are located in omreactpixi.abbrev.

In either case you may want to pull in the functions using the :as form:

            [omreactpixi.abbrev :as pixi]

so that you can refer to components using (for example) pixi/stage or pixi/sprite.

Provided Forms

Includes the standard items from Pixi.js:

  • Stage
  • Sprite
  • SpriteBatch
  • TilingSprite
  • Text
  • BitmapText
  • DisplayObjectContainer

Running the examples

Build the examples using cljsbuild

lein cljsbuild once

The examples can be driven by figwheel, allowing you to edit the interactive example source and auto-reload

lein figwheel interactive

Running Tests

Tests are run inside slimerjs.

npm install slimerjs
lein cljsbuild test

About

Bindings for om to let you control pixi sprites from clojurescript.

License:Other


Languages

Language:Clojure 89.3%Language:HTML 10.7%