UI

Nuake’s UI system is heavily inspired by today’s modern web frameworks. In fact, the layout system is the same as any web standard. It’s layout is defined in .html files and the styling in .css stylesheets.

Layout

The syntax for the layout files are a bit different than regular web files. If we look at the following snippet we can notice a couple differences:

<div class="root" stylesheet="test.css">
    <div class="panel">
       <text class="text">Welcome to Nuake Engine</text>
       <text class="text">This is a demo project showcasing</text>
       <text class="text2">Nuake UI!</text>
    </div>

    <div class="panel">
        <text class="note">This is a a WIP</text>
     </div>
</div>

First, we don’t need to define a header, or a body. Everything, in this file is the body itself. We can define which stylesheet is going to be used to style this piece of UI by using the stylesheet attribute on the top-most node.

We don’t have to deal with different header sizing. Everything that display text is a text node.

Styling

The stylesheet files are also a bit different than regular css. With added styling options and renamed one to make more sense in the sense of a game.

.root {
    width: 100%;
    height: 100%;
    display:flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.panel {
    margin-left: 16px;
    margin-right: 16px;
    margin-top: 16px;
    padding-left: 16px;
    padding-top: 16px;
    padding-right: 16px;
    padding-bottom: 16px;
}

.text {
    font-size: 64px;
    text-align: center;
}

.text2{
    font-size: 22px;
    color: #ff1100;
}

.note {
    font-size: 24px;
    text-align: center;
}

UI Component

We can then add a new UI Component to any entity in our scene, and drag the layout file in the HTML File property. The UI should appear immediately and every time you make a change to your html file, the UI should reload automatically.

Output of the previous UI

Output of the previous UI