### Project Setup and Start Commands
Source: https://pixi-vn.com/nqtr/make-point-and-click
Commands to install dependencies and start the project using Bun.
```bash
bun install
bun start
```
--------------------------------
### Getting Started with Pixi.js
Source: https://pixi-vn.com/start/interface
A basic JavaScript example demonstrating how to initialize Pixi.js and get a reference to the root element.
```javascript
const root = document.getElementById("root");
if (!root) {
throw new Error("root element not found");
}
const htmlLayer = new PIXI.Application({
view: document.getElementById("root"),
width: 800,
height: 600,
backgroundColor: 0x1099bb,
// useCanvas: false,
});
```
--------------------------------
### Install with Bun
Source: https://pixi-vn.com/start
Install Pixi-VN using Bun.
```bash
bun add @drincs/pixi-vn
```
--------------------------------
### Example Usage of start()
Source: https://pixi-vn.com/jsdoc/pixi-vn/index/namespaces/Game/functions/start
This is an example of how to start the game with a specific label. The function clears existing game data and begins narration from the provided label.
```typescript
start("myLabel");
// or
start(myLabelInstance);
```
--------------------------------
### Starting the Game
Source: https://pixi-vn.com/jsdoc/pixi-vn/index/namespaces/Game/functions/start
This example shows how to initialize and start the Pixi-VN game engine.
```javascript
import { Game } from "pixi-vn";
Game.init({
// Configuration options here
});
Game.start();
```
--------------------------------
### Starting a quest
Source: https://pixi-vn.com/nqtr/make-point-and-click
Example of how to start a quest by calling the 'start' function on the quest object.
```ink
== start ==
# start quest aliceQuest
```
--------------------------------
### Vue.js Project Setup with Vite
Source: https://pixi-vn.com/start/interface-vue
This snippet shows how to create a new Vue.js project using the create-vue starter, which is powered by Vite. It also includes an example of an anchor tag linking to the Vue.js quick start guide.
```bash
npm create vue@latest
# or
yarn create vue@latest
# or
pnpm create vue@latest
create-vue, the official Vue + Vite starter
```
--------------------------------
### Installation using npm
Source: https://pixi-vn.com/nqtr
Command to install the NQTR package using npm.
```bash
npm install @pixi-vn/nqtr
```
--------------------------------
### Basic Pixi.js Setup
Source: https://pixi-vn.com/start
This snippet shows a basic setup for a Pixi.js application, including initializing the Pixi application and handling errors.
```javascript
Game.addOnError((error, props) => {
console.error(`Error occurred, error);
});
Game.onNavigate((path) => {
navigateTo(path));
});
```
--------------------------------
### Get Layer Example
Source: https://pixi-vn.com/jsdoc/pixi-vn/index/interfaces/CanvasManagerInterface
Example of how to get a layer by its label.
```typescript
const uiLayer = canvas.getLayer("ui");
```
--------------------------------
### Installation using yarn
Source: https://pixi-vn.com/nqtr
Command to install the NQTR package using yarn.
```bash
yarn add @pixi-vn/nqtr
```
--------------------------------
### Start Label Example
Source: https://pixi-vn.com/start/labels-flow
An example of how to define and use a 'start' label in Pixi-VN.
```typescript
import { narration, newLabel } from "@drincs/pixi-vn";
export const startLabel = newLabel("start", [
async (props) => {
narration.call(label2, props);
},
]);
```
--------------------------------
### Start Example
Source: https://pixi-vn.com/ink/labels
A basic example demonstrating how to start a conversation with a label in Ink.
```ink
"Hello citizen."
~ reputation += 1
-=>
* Insult
"Hey you!"
~ reputation -= 1
-=>
```
--------------------------------
### Initialize a new project with Pixi’VN templates
Source: https://pixi-vn.com/start
Use this command to initialize a new project with the Pixi’VN templates.
```bash
npm create pixi-vn@latest
```
```bash
pnpm create pixi-vn@latest
```
```bash
yarn create pixi-vn@latest
```
```bash
bun create pixi-vn@latest
```
--------------------------------
### Installation using pnpm
Source: https://pixi-vn.com/nqtr
Command to install the NQTR package using pnpm.
```bash
pnpm add @pixi-vn/nqtr
```
--------------------------------
### Start Label Example
Source: https://pixi-vn.com/ink/functions
An example of a start label in Ink that navigates to the main menu.
```ink
=== start ===
Navigate to main menu screen
~ navigate("/")
-> DONE
```
--------------------------------
### Example Usage
Source: https://pixi-vn.com/jsdoc/pixi-vn/index/namespaces/RegisteredCanvasComponents/functions/get
This example demonstrates how to retrieve a canvas component using the `get` function.
```javascript
import { RegisteredCanvasComponents } from "pixi-vn";
// Assuming 'myComponent' is a registered component name
const component = RegisteredCanvasComponents.get("myComponent");
if (component) {
console.log("Component found:", component);
} else {
console.log("Component not found.");
}
```
--------------------------------
### Install Pixi.VN
Source: https://pixi-vn.com/start
Commands to install the Pixi.VN package using different package managers.
```bash
npm install @drincs/pixi-vn
```
```bash
pnpm add @drincs/pixi-vn
```
```bash
yarn add @drincs/pixi-vn
```
```bash
bun add @drincs/pixi-vn
```
--------------------------------
### Ink Start Example
Source: https://pixi-vn.com/ink/temp-storage
An example of how to start an Ink story, including basic syntax and variable declaration.
```ink
1e:["$","p",null,{"children":["You can use any type that ",["$","em",null,{"children":["$","strong",null,{"children":"ink"}]}]," supports: integer, floating point, boolean, or string."]}]
2d:Tbcd,"}]self.__next_f.push([1,""}]
```
--------------------------------
### Install NQTR with npm
Source: https://pixi-vn.com/nqtr
Command to install the NQTR package using npm.
```bash
npm install @drincs/nqtr
```
--------------------------------
### Quest Start Example
Source: https://pixi-vn.com/nqtr/quest
Example of how to start a quest, likely in a game or interactive narrative context. It includes a comment indicating the quest ID and a line to mark the quest as started.
```ink
=== start ===
// {aliceQuest} the id of the quest
+ {aliceQuest_started} Quest started
- =>
```
--------------------------------
### Example
Source: https://pixi-vn.com/jsdoc/pixi-vn/index/interfaces/ApplicationOptions
Demonstrates how to use the autoStart option for initializing the application.
```typescript
// Auto-start (default behavior)
await app.init({ autoStart: true });
// Manual start
await app.init({ autoStart: false });
app.start(); // Start when ready
```
--------------------------------
### Initialize Game
Source: https://pixi-vn.com/start
Example of initializing the Pixi-VN game engine and starting the game.
```typescript
import { Game } from "@drincs/pixi-vn";
const body = document.body;
if (!body) {
throw new Error("body element not found");
}
Game.init(body, {
height: 1080,
width: 1920,
backgroundColor: "#303030",
}).then(() => {
// ...
Game.start("start", {});
});
// read more here: https://pixi-vn.com/start/other-narrative-features.html#how-manage-the-end-of-the-game
Game.onEnd(async (props) => {
Game.clear();
// navigate to main menu
});
Game.addOnError((error, props) => {
console.error(`Error occurred`, error);
});
Game.onNavigate((path) => navigateTo(path));
```
--------------------------------
### get() Function Example
Source: https://pixi-vn.com/jsdoc/pixi-vn/index/namespaces/RegisteredCharacters/functions/get
Example of how to retrieve a character by its ID using the get() function.
```typescript
const liam = RegisteredCharacters.get('liam');
```
--------------------------------
### Initialize PixiVN
Source: https://pixi-vn.com/start
This code snippet shows how to initialize PixiVN using an import map.
```html