HUD for newbies

Hi every body!

Because of few situations I made a decision to write an extension for Unity GUI. My new GUI(HUD) can easily handle events of mouse. OnClick, OnOver, OnEnter and etc. The description of how to use my extension of GUI is on documentation page.

Here is an example of use:

using UnityEngine;
using System.Collections;

public class HUDPresentation : MonoBehaviour {

    void EventHandler(string name_str, string eventType)
    {
        print("Component name: "+name_str+" Event: "+eventType);
    }
    void OnGUI()
    {
       HUDButton.Draw("btn",180, 25, 200, 20, new GUIContent("Button"), HUDUtils.Theme("Grey").button);
       HUDButton.AddEventListener("btn", HUDEvents.OnClick, EventHandler);
       HUDButton.AddEventListener("btn", HUDEvents.OnOver, EventHandler);
    }
}

New components now are in process of developing. In few days you will see them.

Fixed errors and made new component.

public class HUDTest : MonoBehaviour
{
    public string stringToEdit = "Hello World";
    void EventHandler(string name_str, string eventType)
    {
        print("Component name: "+name_str+" Event: "+eventType);
    }
    void OnGUI()
    {
        HUDUtils.DefaultTheme = "Orange";
 
        stringToEdit = HUDTextField.Draw("Tf", 20, 100, 200, 32, stringToEdit);
        HUDTextField.AddEventListener("Tf", HUDEvents.OnChanged, EventHandler);
        HUDTextField.AddEventListener("Tf", HUDEvents.OnExit, EventHandler);
        HUDTextField.AddEventListener("Tf", HUDEvents.OnEnter, EventHandler);
    }
}

You can apply theme for all GUI by means of this

//Apply Orange theme for all components
HUDUtils.DefaultTheme = "Orange";

Umm… Not everyone can understand russian text. Maybe you could translate the documentation from the site into english?

(The Google Translate-buttonthingy on top doesn’t work)

Hmm… I know than not all can understand Russian, that’s why the google button set on my site. Why doesn’t it work?!
The answer is: may be you use some addBlocker or other JavaScript blocker in your browser. Here is a screen of button work

http://dl.dropbox.com/u/29602694/Screens/otherscreens/google_btn_work.JPG

If have some questions, please ask.

That is odd… I clicked on the Translate-Button, but nothing happened. Its just disappeared.
JavaScript is on and not blocked and i don’t use AdBlocker.

Well… Thank you for the picture! :slight_smile:

Edit:
It seems like it’s not working in Chrome (latest version) for some reason… A transparent white bar appears at the top of the page but thats all… Can anyone confirm this?

Hmm… Can you use another browser? May be will help.

Described how to change the HUD theme. Just with one string.

//Change GUI theme to "MyTheme"
void Start()
{
    HUDUtils.DefaultTheme = "MyTheme";
}

Translate works in Firefox.

That’s greate!!!