Brew-js Switch

From GameBrew
Brew.js
Brewjsnx.png
General
AuthorXorTroll
TypeDevelopments
Version1.0
LicenseMixed
Last Updated2018/07/02
Links
Download
Website
Source
Support Author

C++ high-level JavaScript API for Nintendo 3DS/Switch.

Current content:

  • Brew.js API: C++ libraries to execute JavaScript within any C++ application or program (stable, some not working stuff, modules are WIP).
  • Brew.js interpreter: a GUI front-end for executing JavaScript. (still undeveloped).
  • Brew.js link: a PC client and Homebrew server to interpretate JavaScript code, like in Node.js CLI. (only Switch, and still very WIP).

Each platform has different exclusive modules (for instance ctr/sf2d for 3DS, nx/pegaswitch for Switch...).

The current state of the project is unreleased. Latest release is 1.0 (outdated).

User guide

To use the interpreter:

  • Just copy the .nro to your SD card (sdmc:/switch/).
  • Brew.js searches for projects at sdmc:/switch/Brew.js. Some examples are included.

Screenshots

brewjsnx2.png

brewjsnx3.png

Media

[Nintendo Switch] Brew.js - Keyboard loading example (XorTroll)

Compatibility

All the tests have been done with a 5.0.2 Switch.

Changelog

v1.0 2018/07/02

  • UI improved:
    • New dark blue theme, all graphics updated.
    • Main font changed from Tahoma to Roboto.
    • Use ZL and ZR to move between project blocks.
    • Use D-pad or joysticks to move between projects.
    • Select projects by A button or touching them.
    • Use L or R to display help.
    • Use + or - to exit to hbmenu.
  • Brand, new remade API: (read documentation).
    • Modules must be called by require function, Node-style.
    • Graphics module gfx replaced by sdl, now using SDL2 rendering.
    • System module device replaced by nx.
    • Global vars __dirname and __filename added (only if the source is loaded from a file).
    • Some Node modules were partially added: fs, os, path, process (more will be added).
    • New modules have been added, to port some basic C and C++ elements, which are stdio and stdlib.
    • Within sdl module, audio support has been added because SDL2 supports audio: MP3, OGG, FLAC and WAV files can be played.
    • More specific API stuff can be checked within the documentation.
  • Projects have also been changed:
    • Now projects are identified by folders which have a package.json file inside, like Node and NPM do.
    • Those JSON files should have this attributes: name (the project's name), version (the project's version), description (the project's description) and main (the entry source file to load, doesn't need to be *.js anymore).
    • If the project doesn't have the JSON file, it won't be shown in the interpreter.
  • Can I use Brew.js API on my C/C++ homebrew app? Yes!
    • Brew.js API's C++ core has been completely remade, so it can now be embedded with other C/C++ projects.
    • IMPORTANT: You must have it's JS libraries stored somewhere, so that Brew.js accesses them. In this interpreter's case, they're stored inside RomFS ("romfs:/Lib").
    • Brew.js API searches there by default, so I recommend storing them there. Don't worry about RomFS, when Brew.js API is initialized it automatically enabled RomFS support, and disables it when it's exited.
    • Brew.js API doesn't need a documentation, as it's main header ("Brew.js/Brew.js.h") only has 4 functions: Brew::Init(string Path), which initializes Brew.js API with given library path ("romfs:/Lib" by default); Brew::Exit(), which exits Brew.js API's services, Brew::Evaluate(string Source), which evaluates JS source and returns the result as a string; and Brew::EvaluateFile(string Path), which does the same as the previous function but from a source file, adding __dirname and __filename global vars. Enjoy embedding Brew.js API.
  • Yay, new examples!
    • There are some new examples, as always, but this time there are even more. (audio player, simple notepad...)
    • Obviously, all the examples have been updated to be useful with the new API.

v0.3 2019/05/28

  • The UI has been improved, and it doesn't require those attached files from the 0.2 release.
  • All the graphic system has been updated, adding lots of features. Too many functions and elements to talk about... Now games can be easily made using Brew.js API.
  • Now the result of an execution is not just saved, now it's also displayed in the screen. (it might give some problems due to large results).
  • The examples have been updated according to this version's API, and some new examples were added. Wow! A PONG example to see how graphics work! (despite it's very poor).

v0.2 2019/05/20

  • New UI! No more console, now beautiful backgrounds.
  • Some new functions and vars added, check the API guide. (README.md file)
  • Console printing has been disabled due to problems with graphics.
  • Result saving! When a project's execution finishes, it's output is saved to a log file.
    • If it gets an error while executing, the project exists and the error's output is saved to the log file.
  • Three new examples were added, and the Hello World one was updated according to the new API.

v0.1 2019/05/19

  • You can check the documentation given in the rar file for API info.
  • Enjoy scripting.

External links

Advertising: