New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

cengine

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cengine

JavaScript Canvas Engine

latest
Source
npmnpm
Version
0.1.13
Version published
Maintainers
1
Created
Source

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.

Keywords

js

FAQs

Package last updated on 19 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts