https://github.com/iwae/easyMenu
easyMenu is a component to help developers to add menus easily in Cocos Creator
https://github.com/iwae/easyMenu
Last synced: 18 days ago
JSON representation
easyMenu is a component to help developers to add menus easily in Cocos Creator
- Host: GitHub
- URL: https://github.com/iwae/easyMenu
- Owner: iwae
- Created: 2023-09-06T07:48:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-08T02:54:38.000Z (over 1 year ago)
- Last Synced: 2024-11-03T02:32:59.568Z (6 months ago)
- Language: TypeScript
- Size: 2.72 MB
- Stars: 181
- Watchers: 12
- Forks: 40
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-cocos - EasyMenu - A stylish menu creator using descriptive APIs, supporting FPS monitor, time scale, overdraw debugging, sliders, checkboxes, dropdowns etc. (Utilities / Development tools and services)
README
# easyMenu
easyMenu is a component to help developers to add menus easily in Cocos Creator
it presets few functions for 2d/3d game tests.
### FPS Monitor
### Time Scale
### Overdraw Debug

## how to use
copy easyMenu to your project, and add EasyMenu to the Canvas
## add group

``` typescript
const menu = director.getScene().getChildByName('Canvas').getComponentInChildren(eMenu);
if(!menu) return;
const group = menu.addGroup("Scene");```
## add item
``` typescript
group.addItem("Default",()=>{
this.defaultScene();
});
```## add toggle
``` typescript
group.addToggle("High FPS", (t) => {
game.frameRate = t ? 60 : 30;
});
```## add list
``` typescript
group.addList("Image Memory",
this.getImageMemory.bind(this)
);
```
## add slider
``` typescript
group.addSlider("Scale", (v: number) => {
timeScale.scale = v;
}, 1);
```
## add editbox
``` typescript
group.addEdit("edit", "default",((input:string)=>{});
```
## add graph
``` typescript
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
``` typescript
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)
)
```