用户界面(UI)JavaScript框架
Vue UI
如何将 Pixi’VN 与 Vue 集成,包括设置、模板和 UI 示例。 创建一个 Vue 视觉小说或叙事驱动的游戏。
什么是 Vue? Vue 是一个用于构建用户界面的渐进式框架。 它被设计为可以渐进式采用,并能轻松地在库与全功能框架之间扩展。
您可以在 Vue 网站 上了解更多关于 Vue 的信息。
如何将 Pixi’VN 添加到 Vue 应用程序
Templates
我正在寻找可以帮助我开发 Vue 模板的人。 您是否有空帮忙?如果您有兴趣或有空帮忙,欢迎在下方聊天区留言!
如果您有兴趣或有空帮忙,欢迎在下方聊天区留言!
首先,您需要一个 Vue 应用程序,并安装 pixi-vn。 建议使用 Vite 创建一个新的 Vue 应用程序。
现在你可以用下面的代码替换以下文件的内容:
import {
canvas,
Container,
Game,
RotateTicker,
showImage,
} from "@drincs/pixi-vn";
import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
createApp(App).mount("#app");
const body = document.body;
if (!body) {
throw new Error("body element not found");
}
Game.init(body, {
height: 1080,
width: 1920,
backgroundColor: "#303030",
})
.then(
() => {
// Pixi.JS UI Layer
canvas.layers.add("ui", new Container());
showImage(
"juliette",
"https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-icon.webp?alt=media&token=cbcdd613-12e4-48b5-b7b3-16443b4e125e",
{ xAlign: 0.9, yAlign: 0.1, anchor: 0.5 },
);
canvas.tickers.add("juliette", new RotateTicker({ speed: 1 }));
// Vue setup
const app = document.getElementById("app");
if (!app) {
throw new Error("app element not found");
}
const htmlLayer = canvas.htmlLayers.add("ui", app, {
position: "absolute",
pointerEvents: "none",
});
if (!htmlLayer) {
throw new Error("htmlLayer not found");
}
createApp(App).mount(htmlLayer);
},
);