New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

raylib

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raylib

Node.js bindings for raylib.

  • 0.7.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29
decreased by-19.44%
Maintainers
1
Weekly downloads
 
Created
Source

node-raylib Logo

node-raylib npm version Tests

Node.js bindings for raylib, a simple and easy-to-use library to enjoy videogames programming (www.raylib.com).

Dependencies

Usage

  1. Create a new Node.js project:

    mkdir myexample
    cd myexample
    npm init
    
  2. Add raylib to your package.json dependencies:

    npm install raylib --save
    
  3. Create a index.js JavaScript file, like core_basic_window.js:

    const r = require('raylib')
    
    const screenWidth = 800
    const screenHeight = 450
    r.InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
    r.SetTargetFPS(60)
    
    while (!r.WindowShouldClose()) {
        r.BeginDrawing();
        r.ClearBackground(r.RAYWHITE)
        r.DrawText("Congrats! You created your first window!", 190, 200, 20, r.LIGHTGRAY)
        r.EndDrawing()
    }
    r.CloseWindow()        // Close window and OpenGL context
    
  4. Run index.js through Node.js:

    node index.js
    

Check for more examples organized by raylib modules.

CLI

The project also comes with a node-raylib command-line tool to run node-raylib files directly:

# Unix
./node-raylib core_basic_window.js

# Windows
node-raylib.exe core_basic_window.js

The CLI can be installed with the packaged releases, or globally through npm:

npm install raylib --global
node-raylib --version

Development

The following are a few notes and resources when developing node-raylib...

Testing

node-addon-api is used to construct the bindings. Feel free to read through src/addons.cc for an understanding on how methods are defined. A lot is missing from the project, so feel free to get involved in the issue queue and submit pull requests. Run the following to run tests...

git clone https://github.com/RobLoach/node-raylib.git
cd node-raylib
git submodule update --init
npm it

TypeScript Definitions

To rebuild index.d.ts, run the following commands:

npm i -g dts-gen yargs RobLoach/node-raylib
dts-gen -m raylib -f index.d.ts -o

Package

To build the packaged releases, use the following command:

npm run pkg

License

node-raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check LICENSE for further details.

Copyright (c) 2019 Rob Loach (@RobLoach)

Keywords

FAQs

Package last updated on 17 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc