0.1.7 • Published 4 years ago

@mcrowe/regame v0.1.7

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Regame

A React-inspired 2d game engine for Typescript.

TODO

  • More test coverage
  • Efficient rendering by automatically skipping models outside the frame
  • Use JSX for rendering?
  • Allow nested models?

Usage

npm install @mcrowe/regame --save

import * as Regame from '@mcrowe/regame'

const canvas = document.getElementById('game')

interface IState {
  x: number;
}

function camera(state: IState): Regame.Camera {
  return { center: { x: 0, y: 0 }, width: 100 }
}

function render(state: IState): Regame.Scene {
  return [Regame.Circle({ center: { x: state.x, y: 300 }, radius: 20 })]
}

function update(state: IState, dt: number): void {
  state.x += 0.1 * dt
}

const initialState: IState = { x: 0 }

Regame.makeGame < IState > (canvas, update, render, camera, initialState)

Development

Install npm modules:

npm install

Run tests:

npm test

Build:

npm run build

Publish to npm:

  1. Update the version in package.json

  2. Build using npm run build

  3. Publish using npm publish --access=public

0.1.7

4 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago