• Stars
    star
    134
  • Rank 270,967 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Javascript implementation of the Pico-8 fantasy console

JSGS is an experimental (WIP) javascript implementation of the Pico-8 fantasy console.

Demos

What's implemented?

  • Graphics api, font
  • Math api
  • Ram / Ram api
  • Reading cartridges, running lua code

What's missing / Quirks

  • Sound (Help needed)
  • sspr function
  • Cursor
  • stat function
  • Not 100% compatible with Pico-8's Lua flavor.
    • No shorthand assignments
    • all() is not implemented (help needed)

Extra features

  • Multiple screen (canvas) support
  • CRT Filter (optional)
  • On screen / Touch controller (very naΓ¬ve now)
  • Custom color palette

How to use?

It's not yet packaged to be used by importing into your project. For now, the only way to run your cartridges is manually editing the cartridge url in src/index.js file. For cloning/installing/running the project, see "Development" section below.

Classes / Options

JSGS

The JSGS class is the class which we use for creating pico-8 machine instances.

const machine = new JSGS({
  os: new OS(), // an "OS" instance
  devices: {
    controller: new KeyboardController(), // a "Controller" instance
    ram: new Ram(0x8000), // a "Ram" instance
    cartridge: "http://example.com/cartridge.p8.png", // url to a p8.png cartridge
    screen: [new Screen({ size: 128 })], // An array of "Screen" instances
  },
});
Ram
// instantiate a 32kb ram
const ram = new Ram(0x8000);
Screen / CRTScreen
const screen = new Screen({
  size: 128, // a px size (number)
  palette: Screen.greenPalette // And array of 16 hex colors. Defaults to pico-8 palette
});

// Screen with crt filter
const crtScreen = new CRTScreen({
  size: 128,
});

// Mount to dom
screen.mountCanvas(element);
crtScreen.mountCanvas(element);

Development

Requirements

For development, you will need Node.js >=6.0.0 and NPM(comes bundled with Node.js) installed on your environment.

Install

Clone the project and install dependencies:

$ git clone https://github.com/burakcan/jsgs.git
$ cd jsgs
$ npm install

Start & watch

$ npm run start-dev

Now you can browse the app at http://localhost:4000

Build for production

$ npm run build

More Repositories

1

mb

Exception-free nested nullable attribute accessor
JavaScript
265
star
2

react-snowstorm

A Snow Effect component for React.
JavaScript
224
star
3

redux-shared-worker

A higher order Redux store that runs the actual store in a SharedWorker or WebWorker.
JavaScript
71
star
4

Headhunter-Savar

71
star
5

Kangaroo

A simple bookmarks manager built with react and backbone with flux architechure.
JavaScript
47
star
6

tweet-storm

JavaScript
40
star
7

muuvie

A simple movie search app using omdb api
JavaScript
37
star
8

glitchyglitch-client

Source code for glitchyglitch.com's client application.
JavaScript
11
star
9

elm-weather

Elm
10
star
10

threedify

Automatically creates 3d views of webpages
CSS
7
star
11

fffonts

A Google fonts viewer written in elm
Elm
6
star
12

Ore

Stateful Stores that tuned for high performance by utilizing Immutablejs and internal emit loop, for your Flux applications.
JavaScript
5
star
13

rc-tracker

RC Inventory&Log management app
JavaScript
4
star
14

elm-pad

Elm
4
star
15

storaj

A simple localstorage helper that written in Coffeescript
CoffeeScript
4
star
16

hnReader

Hacker news reader app for mac
CoffeeScript
3
star
17

nvim-config

neovim config
Lua
3
star
18

duolove

Lua
3
star
19

simpubl

Simple publish/subscribe implementation with javascript
JavaScript
2
star
20

electronic

JavaScript
2
star
21

elm-flow-webpack-example

A minimal example of using elm with webpack and flow typed javascript
JavaScript
2
star
22

To-do-List

CSS
2
star
23

cutting-edge-react

React + Redux + Webpack counter example.
JavaScript
2
star
24

edf-parser

An edf parser defined in Kaitai Struct
C++
2
star
25

multi-axis-slider

A multi axis slider implementation
2
star
26

dotfiles

My dotfiles.
Shell
1
star
27

SAP1

JavaScript
1
star
28

dewpoint_calculator

TypeScript
1
star
29

create-next-auth-app

Create a Next.js app with authentication using NextAuth.js
TypeScript
1
star