RGC Chart
A library for parsing and writing charts for various rhythm games. It supports cross-platform usage including Web and Node.js environments via WebAssembly (WASM).
Table of Contents
Rust Usage
Installation
Add this to your Cargo.toml:
[]
= "0.0.6"
Or run:
API Reference
Parsing Charts
use parse;
use Chart;
// Parse an osu! chart from string
let osu_chart = from_osu.expect;
// Parse a Stepmania chart from string
let sm_chart = from_sm.expect;
// Parse a Quaver chart from string
let qua_chart = from_qua.expect;
Writing Charts
use parse;
use write;
use Chart;
let chart: Chart = from_osu.expect;
// Write to to osu! format
let osu_string = to_osu;
// Write to Stepmania format
let sm_string = to_sm;
// Write to Quaver format
let qua_string = to_qua;
Chart Structure
The Chart struct contains all the relevant chart information:
The Metadata struct contains all the metadata related information about a specific chart, a lot of all of these can be empty:
The ChartInfo struct contains all the gameplay information about a specific chart:
The TimingPoints struct contains all the timing information such as bpm changes and sv:
The HitObjects struct contains all the hitobject information.
hitobject information is stored in rows:
JavaScript/TypeScript Usage
Installation
For Node.js:
For web projects:
or
npm install rgc-chart-browser
then use as an ES module
API Reference
Initialization
// For ES modules
import * as rgcChart from 'rgc-chart'; // or if not on node use the path to rgc_chart.js
// or alternatively
const rgcChart = await import
// For CommonJS
const rgcChart = require;
you may need to do await rgcChart.default() after importing if you've imported it in a script tag (with type="module") or you get an error like Uncaught TypeError: Cannot read properties of undefined (reading '__wbindgen_malloc')
Parsing Charts
// Parse an osu! chart from string
const chart = rgcChart.;
// Parse a Stepmania chart from string
const chart = rgcChart.;
// Parse a Quaver chart from string
const chart = rgcChart.;
Writing Charts
// write to osu! format
const osuString = rgcChart.;
// write to Stepmania format
const smString = rgcChart.;
// write to Quaver format
const quaString = rgcChart.;
TypeScript Types
The core chart library is written in Rust, but most types in the WASM bindings are generated for TypeScript.
Building
Rust Library
WASM Bindings
- Install wasm-pack:
[!IMPORTANT]
It's really recommended to have wasm-opt installed and added to path for the wasm build.
- Build the package:
- This will build it for both node and browser and the output will be in
dist-webanddist-nodedirectory.
License
RGC uses the MIT License for all its sibiling projects. See LICENSE for more information