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

love.js

v11.4.1

Published

Tooling to support the Emscripten port of LÖVE.

Downloads

188

Readme

Love.js for LÖVE v11.4

Basically trying to adapt love.js to the latest and greatest versions of LÖVE and Emscripten.

Demos

Quickstart

love.js game.love game -c

Build a game with the compatibility version.

Installation

Install the package from npm; no need to download this repo:

npm i love.js

or globally:

npm -g i love.js

Usage

npx love.js [options] <input> <output>

or

love.js [options] <input> <output>

or (on Windows cmd and Powershell, according to https://github.com/Davidobot/love.js/issues/48)

npx love.js.cmd [options] <input> <output>

<input> can either be a folder or a .love file. <output> is a folder that will hold debug and release web pages.

You can also replace love.js in the above command with index.js (or node index.js on Windows) directly if the numpy install is giving you problems.

Options:

-h, --help            output usage information
-V, --version         output the version number
-t, --title <string>  specify game name
-m, --memory [bytes]  how much memory your game will require [16777216]
-c, --compatibility   specify flag to use compatibility version

Test it

  1. Run a web server (while cd-ed into the <output> folder):
  • eg: python -m http.server 8000
  1. Open localhost:8000 in the browser of your choice.

Notes

  1. Compatibility version (-c) should work with most browsers. The difference is that pthreads aren't used. This results in dodgy audio.
  2. The normal version works in the latest Chrome and should work with the latest Firefox version.

The normal version can throw Uncaught ReferenceError: SharedArrayBuffer is not defined. Fix is discussed here. TL;DR Enable the following HTML reponse headers on the website you're hosting your project on:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

If you want to publish your game on one of the game hosting platforms, like itch.io for example:

  • if they include these headers, use the standard version
  • if they don't, use the compatibility mode instead (-c)

On itch.io, they are disabled by default, but they provide experimental support for it. Read more about this here.

  1. Memory is now dynamically resized even with pthreads thanks to this. Still needs a large-enough initial memory until I figure out how to properly wait for the memory to be sized-up before initialising all the file-system stuff (pointers here).
  2. Shaders work (check out 3D demo), but require stricter type-checking. The OpenGL ES Shading Language is type safe. There are no implicit conversions between types (source). So something like
vec4 effect(vec4 color, Image tex, vec2 texture_coords, vec2 screen_coords)
{
    vec4 texturecolor = Texel(tex, texture_coords);
    return texturecolor * color / 2;
}

won't work, but changing line 4 to the code below will make everything run just fine:

return texturecolor * color / 2.0;
  1. If you use love.mouse.setGrabbed or love.mouse.setRelative, the user needs to click on the canvas to "lock" the mouse.

  2. Use love.filesystem.getInfo(file_name) before trying to read a potentially non-existent file.

  3. If you use a depth buffer, add the following line: t.window.depth = 16 to your config.lua file to make sure normals aren't inverted in Firefox.

Building

MacOS / Linux

Clone the megasource and love and then run build_lovejs.sh (with minor changes for file paths).

That should just work™. Make sure you have CMake installed, clone emsdk and edit build_lovejs.sh to point to the right paths.

Set up emsdk with the following settings:

./emsdk install 2.0.0
./emsdk activate 2.0.0

Note, using v:2.0.0 is important as newer versions have depreciated getMemory

Windows

Clone the megasource and love and then run build_lovejs.bat (with minor changes for file paths) in PowerShell.

Make sure you have CMake and Make (e.g. through chocolatey), and that you have the latest Visual Studio build bundles installed. Clone emsdk and edit build_lovejs.bat to point to the right paths.