0.1.13 • Published 5 years ago

cengine v0.1.13

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

cEngine.js

Lightweight JavaScript canvas engine with plugin capability.

Features

  • small core engine with
    • start()
    • stop()
    • step(count)
    • clear()
    • destroy()
  • plugin support
  • predefined plugins
    • fill
    • filter
    • file
    • frameRate
    • input
    • stats

Usage

Basic

<script src="cEnginen.js"></script>
<script>

  cEngine.create({
    step: (context) => {
      context.fillStyle = 'red'
      context.fillRect(10, 10, 10, 10)
    }
  }).step() 

</script>

Tiny game with input plugin

<script src="cEngine.js"></script>
<script src="cEngine.input.js"></script>
<script>
    
  let player = {
        x: 0,
        y: 0
      },
      engine = cEngine.create({
        autoClear: true,
        plugins: {
            input: cEngine.input.create()
        },
        step: (context) => {
          if (engine.plugins.input.keys.W) player.y--
          if (engine.plugins.input.keys.A) player.x--
          if (engine.plugins.input.keys.S) player.y++
          if (engine.plugins.input.keys.D) player.x++

          context.fillStyle = 'red'
          context.fillRect(player.x, player.y, 10, 10)
        }
      })

  engine.start()
      
</script>

Examples

Browse them on http://renmuell.github.io/cEngine/

License

The MIT license. See LICENSE file.

0.1.13

5 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago