GithubHelp home page GithubHelp logo

jcyuan / fairygui-pixijs Goto Github PK

View Code? Open in Web Editor NEW
128.0 16.0 32.0 1.37 MB

A flexible UI lib for PixiJS engine.

Home Page: http://en.fairygui.com

License: MIT License

TypeScript 100.00%
gui pixijs ui ui-components ui-editor

fairygui-pixijs's Introduction

* Please be noticed that this project won't be maintained any longer because our projects are changed to Phaser3, I'm sorry.

What is this?

  • This is an UILib based on PixiJS to build game GUI.
  • Download editor here: http://en.fairygui.com/product/
  • Editor supports a few of game engines include Unity3D, PixiJS, ActionScript, Starling etc. Learn more.
  • The developers use the editor and Lib are all here in the Tencent QQ online chat group for discussing issues. Click to join in: Group1 434866637, Group2 614444599. Welcome to join us and have fun. :)

About Lib

Dependencies

Demo

About Editor

Editor

Features

  • WYSWYG
  • Build complex UI components easily without writing any code even no programming knowledge needed.
  • No complex skin configuration. All UI elements are seperated alone and can be mixed up to build more complex components.
  • Timeline tool provided for creating transitions at the design time.
  • Support sequenced frame animation creating.
  • Support using of bitmap fonts which created by BMFont technology, and support to create bitmap font using pictures.
  • Project files are stored separately in order to suit the version controlling, and for project collaboration.
  • Instant preview.
  • Flexible publish strategy, support packing atlas automatically, or define many separated atlases as you want.
  • Image compression with options for image quality etc, you can adjust options to reduce the size of the final package.

How to use the Lib?

Here is a snippet of basic usage example from the demo code: (typescript)

class Main extends PIXI.Application {

    public constructor() {

        let view = document.querySelector("#canvasContainer canvas") as HTMLCanvasElement;

        super({ view: view, backgroundColor: 0xb5b5b5, antialias: true, forceCanvas:false });

        /**global settings */
        fgui.UIConfig.defaultFont = "Microsoft YaHei";
        fgui.UIConfig.verticalScrollBar = "ui://test/ScrollBar_VT";
        fgui.UIConfig.horizontalScrollBar = "ui://test/ScrollBar_HZ";
        fgui.UIConfig.popupMenu = "ui://test/PopupMenu";
        fgui.UIConfig.globalModalWaiting = "ui://test/GlobalModalWaiting";
        fgui.UIConfig.windowModalWaiting = "ui://test/WindowModalWaiting";

        //main entry
        fgui.GRoot.inst.attachTo(this, {
            designWidth: 1136,
            designHeight: 640,
            scaleMode: fgui.StageScaleMode.FIXED_AUTO,
            orientation: fgui.StageOrientation.LANDSCAPE,
            alignV: fgui.StageAlign.TOP,
            alignH: fgui.StageAlign.LEFT
        });

        //start to preload resource
        //test.jpg actually is a binary file but just ends with fake postfix. so here we need to specify the loadType etc.
        let loader = new fgui.utils.AssetLoader();
        loader.add("test", "images/test.jpg", { loadType: PIXI.loaders.Resource.LOAD_TYPE.XHR, xhrType: PIXI.loaders.Resource.XHR_RESPONSE_TYPE.BUFFER })
            .add("test@atlas0", "images/[email protected]")
            .add("test@atlas0_1", "images/test@atlas0_1.png")
            .add("test@atlas0_2", "images/test@atlas0_2.png")
            .on("progress", this.loadProgress, this)
            .on("complete", this.resLoaded, this)
            .load();
    }

    private loadProgress(loader: PIXI.loaders.Loader): void {
        let p = loader.progress;
        //this.loadingView.setProgress(p);
        if (p >= 100) {
            loader.off("progress", this.loadProgress, this);
            //this.loadingView.dispose();
            //this.loadingView = null;
        }
    }

    private resLoaded(loader: PIXI.loaders.Loader): void {
        loader.removeAllListeners();

        fgui.UIPackage.addPackage("test");  //add your package built in the editor
        
        let ins = fgui.UIPackage.createObject("test", "main") as fgui.GComponent;   //create an object to display
        ins.setSize(fgui.GRoot.inst.width, fgui.GRoot.inst.height);     //add relation so that it will be auto resized when the window size is changed.
        ins.addRelation(fgui.GRoot.inst, fgui.RelationType.Size);
        fgui.GRoot.inst.addChild(ins);   //show it
    }

License

This content is released under the MIT License.

Analytics

fairygui-pixijs's People

Contributors

jcyuan avatar mstoianchuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fairygui-pixijs's Issues

GButton as GList item may cause "ItemClick" event fires more than once

Simple use case:

let list;

list.itemRenderer = (index, object) => {
    // any logic
};
list.numItems = 4;
list.numItems = 5;
list.numItems = 6;

list.on(fgui.ListEvent.ItemClick, onClick, this);

let onClick = () => {
    console.log('GList item clicked');  // will output multiple times as the times of calling GList.numItems
};

This problem appears to be related to PIXI's default event emitter, it won't check for duplicate event handlers, thus when GList renders, the default behavier child.click(this.$clickItem, this) will trigger multiple times, and when the event is fired, this.$clickItem will be triggered multiple times too.

But if the remove logic works right, this won't happen. However...

public removeChildToPoolAt(index: number): void {
     let child: GObject = super.removeChildAt(index);
     this.returnToPool(child);
}

This super call will bypass the remove event logic.

Please fix this ASAP!

GTextInput 控件输入时报错

在编辑器中把text文本设置为输入,不勾选单行(勾选了单行不会报错),把fui 文件加载到程序中运行
并点击input控件进行输入 会报如下错误
ad574a6f-407a-4a7d-b110-f4303d1cd211

GObject.getGear在使用了颜色控制时会运行时报错

错误重现:

  1. 在编辑器里,为按钮组件增加属性控制,选择颜色控制.
  2. 保存.
  3. 发布定义.
  4. 代码中创建该按钮组件.
  5. 出现报错Uncaught ... 'setup' ..., 空对象上没有setup方法.

问题出在GObject.getGear:

case GearType.Color:
    if (fgui.isColorGear(this))
        gear = new GearColor(this);

这个case失败了的话,gear就是null,这样就会导致下面的setupAfterAdd报错:

this.getGear(index).setup(cxml);

谷主的GObject.getGear方法是没有会导致null的逻辑的:

case 4:
    gear = new GearColor(this);

按钮显示的图片状态问题

在按钮响应函数中调用stopPropagation 函数,按钮会一直显示按下状态的图片,没有切回正常状态的图片。

编辑器里,如果对高级组使用了关联,组中的文字会丢失对齐效果

复现步骤:

  1. 创建一个文本组件,自动大小设置为
  2. 文本组件设置对齐为左右居中,上下居中
  3. 用组把文本组件包起来,设置成高级组
  4. 高级组设置关联,对象容器组件,左右居中,上下居中

现象:
文本组件的对齐效果全部丢失

PS:

  1. 未测试高级组的关联对象不是容器组件是否会引起这个问题
  2. 未测试高级组的其他关联类型是否会引起这个问题
  3. 未测试其他组件是否受影响(比如有一个大容器,里面包了一个居中关联的子组件)

fairygui-phaser3

May I ask you, is Fairygui supporting Phaser3 publicly available? Can it be open sourced?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.