easyMenu is a component to help developers to add menus easily in Cocos Creator
it presets few functions for 2d/3d game tests.
copy easyMenu to your project, and add EasyMenu to the Canvas
const menu = director.getScene().getChildByName('Canvas').getComponentInChildren(eMenu);
if(!menu) return;
const group = menu.addGroup("Scene");
group.addItem("Default",()=>{
this.defaultScene();
});
group.addToggle("High FPS", (t) => {
game.frameRate = t ? 60 : 30;
});
group.addList("Image Memory",
this.getImageMemory.bind(this)
);
group.addSlider("Scale", (v: number) => {
timeScale.scale = v;
}, 1);
group.addEdit("edit", "default",((input:string)=>{
});
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);
})
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)
)