Setup
Environment
- Cargo 1.51+
- Rust 1.51+
- Node.js 14+
- Pnpm 8+
Install
Misakura has many package name, so you can choose one you like:
bash
pnpm install misakura
pnpm install avgjs
Structure
my-visual-novel
public
Static files and misakura scripts filesaudio
music
Music filessound
Sound effect filesvoice
Characters voice files
fonts
Font filesimages
background
Background imagesfigure
Character images
scripts
Misakura scripts filesvideos
Video filesmisakura.svg
Logo file
src
TypeScript source codestyles
index.tsx
Loading file of the dommain.ts
Entry file of the game
src-tauri
Rust source codeicons
Icon filessrc
Rust source codetauri.conf.json
Configuration file of the Rust codeCargo.toml
Package information
package.json
Package informationindex.html
HTML template fileREADME.md
Readme file.gitignore
Git ignore filetsconfig.json
TypeScript configuration file
Visual Studio Code Extension
Search for Misakura Script
in the Extensions tab of Visual Studio Code.That will get syntax highlighting for Misakura scripts.
Coding
src/main.ts:
typescript
import Misakura from 'misakura'
import * as styles from './styles'
function main() {
const ctx = new Misakura({ entry: 'complex', styles })
ctx.start()
return ctx
}
export default main
src/index.tsx:
tsx
/* @refresh reload */
import { render } from 'solid-js/web'
import './styles/index.css'
import main from './main'
function App() {
return <>{main()}</>
}
const root = document.getElementById('root')
render(() => <App />, root as HTMLElement)
src-tauri/src/main.rs:
rust
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust and love of Misakura!", name)
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Write Scripts
public/scripts/main.mrs: