Coder Social home page Coder Social logo

snake-render-engine's Introduction

Main Coverage Status

Snake Render Engine

Snake Render Engine is a 2D render engine which wraps WebGL with a functional API, analogous to the well-known React UI library. It also supports JSX syntax and is Component based.

Here is a minimal example that highlights how to run it:

// In order to define components we need to import SRE
import SRE, { initRenderer, initWithRenderer, Rect } from "snake-render-engine";

// Get the host canvas where the engine will run
const canvas = document.getElementById("canvas");
const height = canvas.height;
const width = canvas.width;

const gl = canvas.getContext("webgl");

const render = initRenderer({ gl, width, height });
const run = initWithRenderer(canvas, render);

// Define a Scene Node that renders a simple rect and logs click events
const Scene = () => (
  <Rect x={320} y={200} z={0} width={640} height={100} onClick={console.log} />
);

// Start it
run(<Scene />);

Demos

Demos are available here

Getting started

Installation

  • npm i nps -g (Optional: if not wanted, replace nps with npx nps in the commands below instead.)
  • npm i

Running Locally

  • nps demo - Serve demo locally to port 1234
  • nps test - Run the tests

Testing

  • nps test

Contributing

Active Development

SRE is an actively developed work-in-progress tool. Please reach out on Github if you want to collaborate on this project!

snake-render-engine's People

Contributors

aboeglin avatar brekk avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

snake-render-engine's Issues

Optimization ideas

Use workers

Partial vtree update

Only re-compute parts of the tree that actually have changed since the last iteration.

ROADMAP

v1

  • State for Nodes
  • Event handling
  • Add color to primitives
  • Transform Node
  • Name for the project
  • Error messages
  • Warnings for DEV env

Required:

  • Contribution guide
  • Demo up to date that actually shows something
  • Api documentation ( state, lifecycles, props, ... )
  • Comment on current limitations ( No Fragment support, limited Sprite, ... )
  • Add auto deploy of new versions to npm

v2

  • Context
  • Circle
  • Line
  • ( particle-system ) - Probably more for v2.
  • Camera
  • ( Light ) - Not that important for 2D.
  • Finish Sprite - Add sprite sheet options.
  • AnimatedSprite
  • Document installation, contribution, usage
  • Update and fix clock
  • More TBD ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.