The Ultimate Portable GUI System

AnyGUI was born of my wish NOT to write yet another platform specific GUI Framework.
Having written about 4 of them to date, I had noticed how much of the framework was the same each time. Taking a step back, I abstracted out all the GUI logic. What that left was a thin graphics access layer that could be easily ported to any system with basic pixel graphics capabilities.

The result is AnyGUI. AnyGUI is written in C# and is platform neutral. For its glue to the video system it uses an injected dependency called the "GraphicsProvider." AnyGUI currently runs on OSX and Windows/OpenGL under Monogame, iOS and Android4.3 on Xamarin/Monogame, and HTML5 under Canvas and Javascript. The JSIL cross-compiler is used to compile AnyGUI apps for Javascript.

As a general portability solution, when combined with Xamarin for iOS and Android, AnyGUI provides true write once/deploy everywhere for GUI apps on the Web, Desktop and Mobile devices. In terms of port times, once the initial port of web to OSX was done, the other library ports took between 2 - 12 hours of work a peice. The sample app ran on top of all of them essentially unchanged.

AnyGUI is still in development but below are actual executable demos for all 5 platforms. In the next few weeks I will do separate pages for each one that discuss the approach to getting it running on that platform.

Edit: There is a known bug in the logic where you can grab the scrolling window beyond its clipped range. This has been fixed in the latest Unity source base (not demoed here) and I will be back porting it across all the demos when I have some spare cycles.




HTML5/Canvas


A Web demonstration is available here.
(It has not been download optimized yet so depending on the speed of your connection it make take some seconds to load.
It also currently has been tested as working with Chrome, IE and Firefox. Safari has some issues.)

Mac/OSX


You can download the exact same demonstration as stand alone apps as well:


Windows/OpenGL




IOS


The iOS version of the demo is provided as an iOS simulator zip.
To use it you must have the iOS simulator installed on your system (it comes with the Xcode download).
To install the zip easily, you can use the free application Sim Delpoy

If you don't have access to a Mac with the IOS emulator, you can watch a short YouTube video of the iOS version in action instead:


Android 4.3


Here is the APK for the Adroid 4.3 build of the AnyGUI Demo:

And, again, here is a video of it running. In this case its running in the
emulator on OSX which is rather sluggish when it comes to draw speed:


Unity Community

This is a basic port of AnyGUI to use the OnGUI functions of Unity3D4.3
Here is a build using the Unity Web Player.

Unity Professional 3D

This is a port that puts each window on its own quad in 3 Space.
The quads in this demo are set to orbit the camera in a spherical coordinate system.
An extended window type that allows for drag placement in 3D is used for the text window. You can change its 3D depth by dragging the "z drag" widget in the window bar.

3D mode uses a software cursor. If you lose the cursor you can recenter it at any time by hitting the C key.

This links to the 3D Pro Demo in Webplayer

Demo Source


The code for all versions of the demo is identical and looks like this:

        protected void BuildGUI ()
        {
 
            w = new DecoratedWindow ();
            //w.Size=new Vector2<float>(600,200);
            w.LocalPosition = new Vector2<float> (50, 50);
            //w.Insets = defaultWindowState.Insets;
            Label l = new Label ("BigFont","Drag Me", new Vector3<byte>(255,0,255));
            l.LocalPosition= new Vector2<float> (0,0);
            w.AddChild (l);
            l.MouseDragListeners += delegate(GuiComponent c, Vector2<float> mouseDelta) {
                Console.WriteLine("Mouse drag: "+mouseDelta);
                c.LocalPosition += mouseDelta;
            };
            w2 = new Window();
            w2.Size = new Vector2<float>(200, 200);
            w2.LocalPosition = new Vector2<float>(200, 200);
            ButtonBar buttonBar = new ButtonBar(new string[]{"Show Window","PopUp"},
                new Action<string>[]{DoShow,ShowPopUp});
            w2.AddChild(buttonBar);
            w2.AllLoaded += delegate(GuiComponent obj) {
                w2.Pack();
            };
            popup = new Window();
            ButtonBar popupButtons = new ButtonBar(new String[]{"A button", "Another button", "Close"}
                ,new Action<string>[]{DoPop,DoPop,DoPop});
            popupButtons.Vertical = true;
            popup.AddChild(popupButtons);
            popup.AllLoaded += delegate(GuiComponent obj) {
                popup.Pack();
                popup.Enabled = false; // hide
            };
            scrollWindow = new DecoratedWindow();
            scrollWindow.Layout = new GridLayoutManager(1, 1);
            ScrollPanel scrollpanel = new ScrollPanel();
            scrollWindow.AddChild(scrollpanel);
            scrollpanel.Layout = new HorizontalLayout();
            ImagePanel imgPanel = new ImagePanel("Thumbnails", 0, 7);
            scrollpanel.AddChild(imgPanel);
            scrollWindow.AllLoaded+= delegate(GuiComponent obj) {
                scrollWindow.Pack();
                scrollWindow.Size = new Vector2<float>(250,scrollWindow.Size.Y);
            };
            scrollpanel.ContentContainerDrag= new Vector3<float>(1.0f,float.MaxValue,float.MaxValue);
        }
 
        private void DoPop(string button){
            if (button == "Close") {
                popup.Enabled = false;
            }
        }
 
        private void DoShow(string buttonText){
            w.Enabled = true;
        }
 
        private void ShowPopUp(string buttonText){
            popup.Enabled = true;
        }