thneed-gfx
TypeScript icon, indicating that this package has built-in type declarations

0.1.47 • Public • Published

thneed-gfx

A pure JS / Canvas Graphics and GUI lib, for simple apps and 2d games.

getting started

create a new surface, add a single button, draw it

import {COMMAND_ACTION, CanvasSurface, ActionButton} from "thneed-gfx"

let surface = new CanvasSurface(200,200, 1.0);
let button = new ActionButton()
button.set_caption('Greetings Earthling');
button.on(COMMAND_ACTION, () => {
    button.set_caption("you clicked on me")
})
let root = new LayerView()
root.add(button)
surface.set_root(root)
surface.start()

Use surface.start() to start with no repaint strategy. Use surface.start_input() to start with repainting after every key board and mouse event Use surface.start_game() to start with repainting at the default framerate (60fps for browser)

Readme

Keywords

none

Package Sidebar

Install

npm i thneed-gfx

Weekly Downloads

46

Version

0.1.47

License

none

Unpacked Size

2.54 MB

Total Files

39

Last publish

Collaborators

  • joshmarinacci