Skip to content
Usagirei edited this page Apr 10, 2018 · 3 revisions

What is JankyUI?

JankyUI is a wrapper for Unity1 Immediate Mode GUI with XML Syntax, ViewModels and Two-Way DataBindings

XML?

JankyUI uses a simple representation of a window in textual format, that uses eXtensible Markup Language (XML)2 for structuring the layout

A XML Document is composed of a group of Tags, which may or not each have Attributes. Each Tag can have children tags, which in turn may also have their own chilren, recursively.

<!-- A Root Element -->
<Tag>
   <!-- A Child Element -->
   <ChildTag />

   <!-- A Child Element with attributes -->
   <ChildTagWithAttribute attribute='some value' />

   <!-- A Child Element with its own children -->
   <ChildTagWithMoreChildren>
      <ChildTag />
   </ChildTagWithMoreChildren>

   <!-- A Child Element with its own children AND attributes -->
   <ChildTagWithMoreChildrenAndAttributes attribute='another value'>
      <ChildTag />
   </ChildTagWithMoreChildrenAndAttributes>
</Tag>

JankyUI Provides a XML Schema to help you write/validate your UI Code with if your IDE supports it.

DataBinding? ViewModel?

When creating an instance of the JankyUI Context, you may pass any object instance to:

  • Take data from
  • Put data into
  • Provide callback for interactive controls, such as buttons

Example:

Piece of the XML Code

...
<Label text='I Have Fixed Text' />
<Button name='BoundButton' text='@MyButtonText' on-click='@MyButtonCallback' />
<Textbox text='@MyTextboxValue' />
...

Simple ViewModel:

public class ViewModel {

   // Take data from
   public string MyButtonText { get; set; } = "I Have Bound Text";

   // Put data into
   public string MyTextboxValue { get; set; }

   // Callback
   public void MyButtonCallback(JankyEventArgs args) {
      Console.WriteLine("Button '{0}' was Pressed!", args.Control);
   }
}

  1. Unity
  2. XML