EasyMenu plugin - devlog (experimental dynamically generated ui system)

Not favoritedFavorited Favorited 0 favourites
From the Asset Store
Casual UI Button is a customizable, ready to use desktop and mobile-friendly game UI Asset.
  • I wasn't happy with any of the ui options available in c3, so i started making my own dynamic system with events.

    It worked ok but was cumbersome and had its limits, so i thought why not just try and turn it into an actual plugin.

    The menu system will be created entirely of polygons drawn directly to the layer, with the ability to change the colour and an option to skin them with textures.

    Each plugin represents a self contained window that you configure with events ACES, to craft its appearance and control its functionality.

    UI elements can then be added, and windows can interact and call each other. Thats the plan.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • setting the window size, colour and adding a boarder.

    + System: On start of layout
    -> EasyMenu: Set width to 300
    -> EasyMenu: Set height to 200
    -> EasyMenu: Set background color to "165,20,25"
    -> EasyMenu: Enable border True
    -> EasyMenu: Set border color to "20,255,135,1"
    -> EasyMenu: Set border width to 20
    
  • Window with drop shadow applied. It can set colour, and alpha opacity. The size matches the widow and the shadow can be offset as you like.

    + System: On start of layout
    -> EasyMenu: Set width to 300
    -> EasyMenu: Set height to 200
    -> EasyMenu: Set background color to "165,20,25"
    -> EasyMenu: Enable border True
    -> EasyMenu: Set border color to "20,255,135,1"
    -> EasyMenu: Set border width to 20
    -> EasyMenu: Enable drop shadow True
    -> EasyMenu: Set drop shadow color to "25,123,80,0.5"
    -> EasyMenu: Set drop shadow offset X to 15
    -> EasyMenu: Set drop shadow offset Y to 25
    
  • UIs are interesting with all the different ways to go about it.

    So instead of using say a 9patch you draw things directly so you can change the border width on the fly?

    Do you have a mockup of the kinds of ui that you are after that this will ultimately help you make? I ask because currently there are other ways to do what you have without a plugin, but I also know there’s often a lot of simpler things that have to be implemented first before getting to the useful parts. Like you mentioned that doing it with events had limits and was cumbersome. In what way do you hope to reduce the friction and limits? I guess the general goal would be enough to see what you’re working towards.

    Anyways, keep it up. More options are always nice and especially as things get more complex I can see a plug-in being more useful and faster than rolling it another way.

  • I'm aiming for more window heavy games, simulation, management types rather than say mobile platformer / flappy bird games.

    I'm looking to make it so you can create the menu entirely with events.

    I'll focus on getting the core stuff working and then add more interesting features.

    I'm just seeing where it goes, so its very experimental, and it helps me learn plugin development.

    Right now i've chosen to work towards a windows 95 ui as reference, but it should be quite customisable when its done.

  • Windows now have "pages". Eventually windows will allow multiple pages so we can have tabs.

    Pages are the content area of the window. If a page is bigger than a window then scroll bars will appear, it you have scroll bars enabled.

    I've also added the ability to add sprite to the page.

    SDK v2 does not allow any type of clipping it seems, so i had to find my own way. I tried blend modes but that had issues, so i now copy the referenced sprite to a quad as a texture, then modify its position and dimensions to create clipping when a sprite is partially outside the window area.

    + System: On start of layout
    -> EasyMenu: Set width to 300
    -> EasyMenu: Set height to 200
    -> EasyMenu: Set background color to "165,20,25"
    -> EasyMenu: Enable border True
    -> EasyMenu: Set border color to "20,255,135,1"
    -> EasyMenu: Set border width to 20
    -> EasyMenu: Enable drop shadow True
    -> EasyMenu: Set drop shadow color to "25,123,80,0.5"
    -> EasyMenu: Set drop shadow offset X to 15
    -> EasyMenu: Set drop shadow offset Y to 25
    -> EasyMenu: Set page height to 500
    -> EasyMenu: Set page width to 300
    -> EasyMenu: Set horizontal scrollbar enabled True
    -> EasyMenu: Set vertical scrollbar enabled True
    -> EasyMenu: Set UID Sprite.UID to page position (52, 152)
    -> EasyMenu: Set UID Sprite2.UID to page position (20, 250)
    
  • Windows now support unlimited pages. Pages now have names to identify them, they can have different properties like size, and elements like sprites can be added to different pages.

    Set current page action is used to select the visible page, while other pages are hidden.

    Also sprites added to a page now reflect some of the referenced sprites properties like opacity and size. Changing the sprite updates it on the page.

    + System: On start of layout
    -> EasyMenu: Set width to 300
    -> EasyMenu: Set height to 200
    -> EasyMenu: Set background color to "165,20,25"
    -> EasyMenu: Enable border True
    -> EasyMenu: Set border color to "20,255,135,1"
    -> EasyMenu: Set border width to 20
    -> EasyMenu: Enable drop shadow True
    -> EasyMenu: Set drop shadow color to "0,0,0,0.5"
    -> EasyMenu: Set drop shadow offset X to 15
    -> EasyMenu: Set drop shadow offset Y to 25
    -> EasyMenu: Add page "default"
    -> EasyMenu: Set current page to "default"
    -> EasyMenu: Set page "default" height to 500
    -> EasyMenu: Set page "default" width to 400
    -> EasyMenu: Set UID Sprite.UID to page "default" position (50, 55)
    -> EasyMenu: Set UID Sprite2.UID to page "default" position (130, 250)
    -> Sprite2: Tween "" property Height to 20 in 1 seconds (In Out Sinusoidal, destroy: No, loop: Yes, ping pong: Yes, repeat count: 1)
    -> Sprite2: Tween "" property Width to 20 in 1 seconds (In Out Sinusoidal, destroy: No, loop: Yes, ping pong: Yes, repeat count: 1)
    -> Sprite2: Tween "" property Opacity to 10 in 0.5 seconds (In Out Quadratic, destroy: No, loop: Yes, ping pong: Yes, repeat count: 1)
    -> EasyMenu: Add page "page1"
    -> EasyMenu: Set page "page1" height to 650
    -> EasyMenu: Set page "page1" width to 250
    -> EasyMenu: Set UID Sprite3.UID to page "page1" position (60, 120)
    
    + Keyboard: On 1 pressed
    -> EasyMenu: Set current page to "page1"
    -> EasyMenu: Set background color to "85,155,255"
    
    + Keyboard: On 2 pressed
    -> EasyMenu: Set current page to "default"
    -> EasyMenu: Set background color to "165,20,25"
    
  • Experimenting with rounding window corners, but this messes up clipping.

    Not sure if it will be possible.

    Will have to think some more.

  • Looking cool!

    If you approximate the rounded window with a polygon you can do polygon clipping with an algorithm like:

    en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm

    But I’m certain you could do something simpler than that by utilizing the sdf equation of a rounded rectangle so you don’t have to loop over so many edges.

    Or maybe you could try clipping by a rectangle like you already do and then use a blend mode to draw that within the rounded window. Or maybe drawing to a texture and then drawing that within the rounded window shape. But those kinda depend on what you have access to with construct’s renderer.

  • Thanks!

    I switched to a Sutherland–Hodgman algorithm for clipping, so now windows and elements can all be rounded.

    Still need to update the scroll bar code.

  • Mostly doing stuff on the back end ready for more advanced features.

    Managed to add styles to scroll bars.

    They now clip rounded windows, and you can set colours thickness and roundness.

  • Scrollbars now have fully customisable spacing.

    Pages can have their own page colour, and i've added page transitions, which currently support sliding and fading with full tween support. More transition types will be added later.

    Excuse the colours for testing. I'm badly colour blind.

  • I just wasted a few days trying to track down a non existent bug.

    I couldn't work out why the scroll bar calculations were incorrect for the page size. Then i finally remembered i made it so that if you add a sprite to a page, then the page resizes to fit the sprite if the page is too small. This is so pages can grow at runtime if the page content is updated.

    There is now another option to set this per sprite, so you can decide which sprites effect page size.

    I also added the option to have scrollbar thumbs dynamically resize with a tween motion, and the option to hide scrollbars when the page is smaller than the window area.

  • Looking cool!

    If you end up delving into layouting, aka automatically positioning and resizing elements, I recently found this video that makes it sound fairly straightforward:

    youtube.com/watch

    Also currently your plugin builds and modifies you gui, which is basically a retained mode gui. Another approach is an immediate mode gui that builds the gui on the fly per frame, which has some interesting pros and cons.

    As for the programmer art colors, I do that too, but I've recently been toying with the idea of using a palette generator to get some pleasing colors to go together. I've also seen sites that provide nice palettes specifically for uis. Anyways, just some ideas that could give some inspiration.

  • Thanks for the video. That's super helpful.

    I wasn't aware of the terms but my original event based gui was an immediate mode design, it was great for certain things, such as when elements arranged directly beneath each other, but made more complex layout design difficult, which i think you can only get from retained mode gui's.

    Anyway this system will be easily adjustable on the fly.

    I've been looking at google androids ui system material.

    m2.material.io/components

    Adding palettes is another good idea.

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)