npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

peekpoke

v1.0.0

Published

Tiny minimal retro fantasy console having only two commands: peek and poke.

Downloads

4

Readme

PEEKPOKE

Tiny minimum retro fantasy console having only two commands: peek and poke.

Sample game 'BOMB SNAKE'

BOMB SNAKE

Games for PEEKPOKE can be written in simple JavaScript code. PEEKPOKE games run in the browser of any PC or mobile device.

Memory map

memory_map

You can draw pixels or text by writing a number to a specific address in memory (poke), or get the input status of a key by reading a number from the address (peek).

Getting started

Download docs/getting_started/index.html and write your game code in the <script> element. Open index.html in a browser and play the game.

Use with npm

% npm i peekpoke

The peekpoke library must be imported and initialized.

import "peekpoke";
initPeekpoke({ setup, loop, enableSplashScreen: false });

function setup() { ... }

function loop() { ... }

Sample snippets

Draw a pixel

// Draw a red pixel at (x, y).
poke(ADDRESS_VIDEO + x + y * VIDEO_WIDTH, COLOR_RED);

Draw a text

// Draw a 'A' text at (x, y).
poke(ADDRESS_TEXT + x + y * TEXT_WIDTH, "A",charCodeAt(0));

Set text color

// Make the text color green.
poke(ADDRESS_TEXT_COLOR + x + y * TEXT_WIDTH, COLOR_GREEN);

Set text background color

// Make the text background color blue.
poke(ADDRESS_TEXT_BACKGROUND + x + y * TEXT_WIDTH, COLOR_BLUE);

Check keystroke state

// Check if the up key is pressed.
if (peek(ADDRESS_KEY + KEY_UP) & KEY_STATE_IS_PRESSED) ...
// Check if the left key is just pressed.
if (peek(ADDRESS_KEY + KEY_LEFT) & KEY_STATE_IS_JUST_PRESSED) ...
// Check if the X key is just released.
if (peek(ADDRESS_KEY + KEY_X) & KEY_STATE_IS_JUST_RELEASED) ...

Buzzer

// Buzzer at 500 (50 x 10) Hz.
poke(ADDRESS_BUZZER, 50);
// Stop buzzer.
poke(ADDRESS_BUZZER, 0);

Other sample games