Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glassonion1/bitbox
BitBox is a fun, free 2D game framework for making HTML games for desktop and mobile web browsers, supporting Canvas rendering.
https://github.com/glassonion1/bitbox
2d-game canvas game game-engine pixel react typescript
Last synced: 29 days ago
JSON representation
BitBox is a fun, free 2D game framework for making HTML games for desktop and mobile web browsers, supporting Canvas rendering.
- Host: GitHub
- URL: https://github.com/glassonion1/bitbox
- Owner: glassonion1
- License: mit
- Created: 2024-05-03T04:58:28.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-12T04:33:27.000Z (6 months ago)
- Last Synced: 2024-05-12T16:25:17.600Z (6 months ago)
- Topics: 2d-game, canvas, game, game-engine, pixel, react, typescript
- Language: TypeScript
- Homepage:
- Size: 61.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BitBox - 2D pixel game framework
BitBox is a fun, free 2D game framework for making HTML games for desktop and mobile web browsers, supporting Canvas rendering.## Install
pnpm
```
pnpm add @bitbox-js/core
```## Usage
```js
mport { State, Renderer, useCanvas } from '@bitbox-js/core'export class GameState implements State {
// Game logic here
update(delta: number, key: string) {
// ...
}
}export class GameRenderer implements Renderer {
// BitBox calculates and sets this value
blockWidth = 0
state: GameState
constructor(state: GameState) {
this.state = state
}
// Rendering logic here
draw(ctx: CanvasRenderingContext2D) {
// ...
}
}const Page = () => {
const state = new GameState()
const renderer = new GameRenderer(state)
const { canvasRef, togglePausing } = useCanvas(100, 50, renderer)return (
)
}export default Page
```## Example code
These examples can be browsed on the stackblitz.
[bitbox-sample](https://stackblitz.com/edit/bitbox-sample)## Use case
- [Elementary cellular automaton](https://9revolution9.com/games/eca/)
- [Tetrimimus](https://9revolution9.com/games/tetrimimus/)
- [Pac-Boy](https://9revolution9.com/games/pac-boy/)