Usnul / meep

Entity Component System game engine
MIT License
260 stars 40 forks source link

How to use Editor? #6

Open gonnavis opened 3 years ago

gonnavis commented 3 years ago

Hello, how to use editor? I run npm run "start:dev" and just see a terrain demo, no any UI. image

Usnul commented 3 years ago

hey Vis,

the editor can be toggled via Num Lock key, however, the CSS isn't complete there, so it will look weird.

In general, that editor is not that great too, it's more of a crutch that I wrote for myself when working on Might is Right, to make populating the world a bit easier.

gonnavis commented 3 years ago

Thanks! I see the UI. But after a while of research, I still can't add anything. Could you please help me how to add something?

And one more question, is this example runnable? image

Usnul commented 3 years ago

hey Vis,

the gif is from the game built on the engine, I wrote quite a bit about it on three.js forum: https://discourse.threejs.org/t/might-is-right-the-game/6523

For various reasons, I'm not open-sourcing the game itself. But demo is available, which might be insightful.

For the UI specifically in this GIF, we see following things:

All of these are HTML elements, the radial menu uses a fair bit of SVG as well. That itself is not really part of the engine, that.. well, HTML and SVG. The engine gives a thin abstraction layer for an arbitrary DOM Element, called View, a view has children, position, scale, visibility flag and mound/unmount signals (called link/unlink in meep).

When I worked on Might is Right, I chose to not use react or any other UI framework, because in my experience (I tried backbone(i feel old), react and vue) they produced unexpected CG pressure and were too slow in some cases, that on top of UI just being heavier. However, all that being said - this system makes minimal assumptions about what it wraps, it doesn't even create the DOM elements for you, so it's possible to attach react or vue or whatever else here.

Now it probably seems like I'm cheating, saying there's a "UI system" when all I said up until this point is - "bruh, it's pure html". Here are the "UI" features of meep:

Hope this explains a bit, meanwhile - i'll see if I can put together an example with a UI

Usnul commented 3 years ago

here's a notification example: https://codesandbox.io/s/meep-notification-example-6sxoe

here's one with a simple text element: https://codesandbox.io/s/meep-example-ui-text-label-nd1fi

Hope that helps. There's a whole bunch of useful UI elements in the /view folder that might come in handy

gonnavis commented 3 years ago

Many thanks! I'll try to learn more.

luozhonghai commented 2 years ago

the editor mode miss some pngs, can not work properly. can you fix it?