Skip to content

Latest commit

 

History

History
104 lines (82 loc) · 2.47 KB

README.md

File metadata and controls

104 lines (82 loc) · 2.47 KB

easyMenu

easyMenu is a component to help developers to add menus easily in Cocos Creator

image

it presets few functions for 2d/3d game tests.

FPS Monitor

122

Time Scale

133

Overdraw Debug

image

how to use

copy easyMenu to your project, and add EasyMenu to the Canvas

image

add group

image

    const menu = director.getScene().getChildByName('Canvas').getComponentInChildren(eMenu);
    if(!menu) return;
    const group = menu.addGroup("Scene");

add item

    group.addItem("Default",()=>{
          this.defaultScene();
    });

add toggle

  
     group.addToggle("High FPS", (t) => {
           game.frameRate = t ? 60 : 30;
     });

add list

  
     group.addList("Image Memory",
           this.getImageMemory.bind(this)
    );

add slider

  
     group.addSlider("Scale", (v: number) => {
           timeScale.scale = v;
     }, 1);

add editbox

     group.addEdit("edit", "default",((input:string)=>{

     });

add graph

    group.addGraph("FPS", null, 60, 14);

    this.graph = group.node.getChildByName("FPS").getComponent(eGraph);

    this.graph.callback = (() => {
        const output = this.graph.positions.toString();
        console.log("FPS History", output)
        this.copyToClipboard(output);
    })

add multi items

   this.menu
    .addGroup("Debug")
    .addToggle("Profiler", (t) => {
        t ? profiler.showStats() : profiler.hideStats();
    })
    .addSlider("Scale", (v: number) => {
        TimeScale.scale = v;
    }, 1)
    .addItem("Game Time", () => {
        return "GameTime: " + Math.floor(game.totalTime) + " ms";
    })
    .addToggle("High FPS", (t) => {
        game.frameRate = t ? 60 : 30;
    })
    .addItem("Overdraw Test",
        this.testOverdraw.bind(this)
    )
    .addList("Image Memory",
        this.getImageMemory.bind(this)
    )