Jump to content

I need to create some responsive UI for my game. Puxi JS is not working for me?


JayDawg
 Share

Recommended Posts

Hello Friends,

 

I am trying to create a responsive UI, one that can fit a phone screen portrait or landscape.

I came across this library https://github.com/pixijs/pixi-ui/blob/master/README.md, but I can't get it to work because I am using Pixi V6?

This is my code and I get alot of the following errors.

Should I just use vanilla pixi instead? 

import * as PIXI from 'pixi.js';
import * as PUXI from 'puxi.js';
 
const app = new PIXI.Application({ });
 
const uxStage = new PUXI.Stage({
width: 512,
height: 512,
});
 
app.stage.addChild(uxStage);
 
uxStage.addChild(new PUXI.Button({
text: "Hello world!"
}));
 
uxStage.addChild(new PUXI.Text({
value: "Click me!"
}).setPadding(4, 6) // horizontal/vertical padding
.setBackground(0xffaabb) // background color (can use a PIXI.Graphics too)
.setBackgroundAlpha(.5) // alpha for background
.setElevation(2) // drop-shadow on background!
);

Screen Shot 2022-02-09 at 1.18.36 PM.png

Screen Shot 2022-02-09 at 1.20.27 PM.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...