Jump to content

UserInterface from String?


photo

Recommended Posts

Is it possible to create a UserInterface from a string?
The constructor `UserInterface ui = new UserInterface(gui, "Gui/Hud.ui");` takes a path to a .ui file.

I would like to template some things using raw string literals

interface Gui {
    UserInterface Create(string hName, string vName) => new UserInterface(gui, $$"""
    <?xml version="1.0" encoding="utf-8"?>
    <ui version="1.00">
        <hbox name="{{hName}}" width="1920" height="1080">
            <vbox name="{{vName}}" height="1080" width="100" align="left">
            </vBox>
        </hBox>
    </ui>
    """);
    }

 

Edited by Tessalator
Link to comment
×
×
  • Create New...