예제 #1
0
        protected void SimpleCreateInstructions(string text = "")
        {
            var layout = new UILayout();

            layout.Rect = UIView.Rect;

            layout.LayoutPosition             = UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_RIGHT_BOTTOM;
            layout.LayoutDistributionPosition = UI_LAYOUT_DISTRIBUTION_POSITION.UI_LAYOUT_DISTRIBUTION_POSITION_RIGHT_BOTTOM;

            var fontDesc = new UIFontDescription();

            fontDesc.Id   = "Vera";
            fontDesc.Size = 18;

            var label = new UIEditField();

            label.FontDescription    = fontDesc;
            label.ReadOnly           = true;
            label.Multiline          = true;
            label.AdaptToContentSize = true;
            label.Text = text;
            layout.AddChild(label);

            UIView.AddChild(layout);
        }
예제 #2
0
        public override void Start()
        {
            var cache = GetSubsystem<ResourceCache>();
            var graphics = GetSubsystem<Graphics>();
            var ui = GetSubsystem<UI>();


            graphics.SetWindowIcon(cache.Get<Image>("Textures/AtomicIcon48.png"));
            graphics.WindowTitle = "Atomic Game Engine Feature Example";

            // Subscribe to Esc key:
            SubscribeToEvent<KeyDownEvent>(e => { if (e.Key == Constants.KEY_ESCAPE) BackToSelector(); });

            // Say Hello

            var layout = new UILayout();
            layout.Rect = UIView.Rect;

            layout.LayoutPosition = UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_CENTER;
            layout.LayoutDistributionPosition = UI_LAYOUT_DISTRIBUTION_POSITION.UI_LAYOUT_DISTRIBUTION_POSITION_CENTER;

            var fontDesc = new UIFontDescription();
            fontDesc.Id = "Vera";
            fontDesc.Size = 24;

            var label = new UITextField();
            label.FontDescription = fontDesc;
            label.Text = "Hello World, from the Atomic Game Engine";
            layout.AddChild(label);

            UIView.AddChild(layout);

        }
예제 #3
0
    public override void Start()
    {
        view = new UIView()
        {
            X = 0,
            Y = 0
        };

        fontDescription = new UIFontDescription()
        {
            Size = 22,
            Id   = "Anonymous Pro"
        };

        layout = new UILayout()
        {
            Axis           = UI_AXIS.UI_AXIS_Y,
            Rect           = view.Rect,
            LayoutPosition = UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_CENTER
        };

        view.AddChild(layout);

        CreateSceneLoadButton("Clear");
        CreateSceneLoadButton("Empty");
        CreateSceneLoadButton("Scene");

        // Setup debug hud to display metrics
        GetSubsystem <UI>().ShowDebugHud(true);
        GetSubsystem <UI>().SetDebugHudProfileMode(DebugHudProfileMode.DEBUG_HUD_PROFILE_METRICS);
    }
예제 #4
0
        public override void Start()
        {
            var cache = GetSubsystem<ResourceCache>();
            var graphics = GetSubsystem<Graphics>();
            var ui = GetSubsystem<UI>();

            graphics.SetWindowIcon(cache.Get<Image>("Textures/UrhoIcon.png"));
            graphics.WindowTitle = "Atomic Game Engine Feature Example";

            // Subscribe to Esc key:
            SubscribeToEvent<KeyDownEvent>(e => { if (e.Key == Constants.KEY_ESCAPE) BackToSelector(); });

            // Say Hello

            var layout = new UILayout();
            layout.Rect = UIView.Rect;

            layout.LayoutPosition = UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_CENTER;
            layout.LayoutDistributionPosition = UI_LAYOUT_DISTRIBUTION_POSITION.UI_LAYOUT_DISTRIBUTION_POSITION_CENTER;

            var fontDesc = new UIFontDescription();
            fontDesc.Id = "Vera";
            fontDesc.Size = 24;

            var label = new UITextField();
            label.FontDescription = fontDesc;
            label.Text = "Hello World, from the Atomic Game Engine";
            layout.AddChild(label);

            UIView.AddChild(layout);
        }
    private static void HandleUifontdescriptionEvent(WidgetEvent ev)
    {
        UIWidget widget = (UIWidget)ev.Target;

        if (widget.Equals(null))
        {
            return;
        }
        if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK)
        {
            if (widget.GetId() == "uifontdescriptioncode")
            {
                AtomicMain.AppLog("UIFontdescription support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uifontdescription.cs", widget.GetParent());
            }
            if (widget.GetId() == "uifontdescriptionlayout")
            {
                AtomicMain.AppLog("UIFontdescription support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uifontdescription.ui.txt", widget.GetParent());
            }
        }
        else if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CHANGED)
        {
            if (widget.GetId() == "fontstep")
            {
                UISlider uis = (UISlider)widget;
                if (!uis.Equals(null))
                {
                    UITextField       mytext = (UITextField)widget.FindWidget("changetext");
                    UIFontDescription myfont = new UIFontDescription();
                    int mysize = (int)uis.GetValue();
                    myfont.SetSize(mysize);
                    myfont.SetId("Vera");
                    mytext.SetFontDescription(myfont);
                    mytext.SetText("Size " + mysize);
                    AtomicMain.AppLog("UIFontdescription action : " + widget.GetId() + " step size changed to " + mysize);
                }
            }
        }
    }
예제 #6
0
        protected void SimpleCreateInstructions(string text = "")
        {
            var layout = new UILayout();

            layout.Rect = UIView.Rect;

            layout.LayoutPosition = UI_LAYOUT_POSITION.UI_LAYOUT_POSITION_RIGHT_BOTTOM;
            layout.LayoutDistributionPosition = UI_LAYOUT_DISTRIBUTION_POSITION.UI_LAYOUT_DISTRIBUTION_POSITION_RIGHT_BOTTOM;

            var fontDesc = new UIFontDescription();
            fontDesc.Id = "Vera";
            fontDesc.Size = 18;

            var label = new UIEditField();
            label.FontDescription = fontDesc;
            label.ReadOnly = true;
            label.Multiline = true;
            label.AdaptToContentSize = true;
            label.Text = text;
            layout.AddChild(label);

            UIView.AddChild(layout);
        }
    private static void HandleUitabcontainerEvent(WidgetEvent ev)
    {
        UIWidget widget = (UIWidget)ev.Target;
        string   refid  = (string)ev.RefID;

        if (widget.Equals(null))
        {
            return;
        }
        if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK)
        {
            if (widget.GetId() == "uitabcontainercode")
            {
                AtomicMain.AppLog("UITabContainer support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Components/code_uitabcontainer.cs", widget.GetParent());
            }
            if (widget.GetId() == "uitabcontainerlayout")
            {
                AtomicMain.AppLog("UITabContainer support : " + widget.GetId() + " was pressed ");
                AtomicMain.ViewCode("Scenes/layout_uitabcontainer.ui.txt", widget.GetParent());
            }


            if (widget.GetId() == "uitabcontainerremove")
            {
                AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed ");
                UITabContainer tcx     = (UITabContainer)widget.FindWidget("UITabContainerDemo");
                int            current = tcx.GetCurrentPage();
                tcx.DeletePage(current);
            }
            if (widget.GetId() == "uitabcontaineradd")
            {
                AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed ");
                UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo");
                tcx.AddTabPageFile("New File", "Scenes/sheet.ui.txt");
            }
            if (widget.GetId() == "uitabcontainermake")
            {
                AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed ");
                var            cache = GetSubsystem <ResourceCache>();
                UITabContainer tcx   = (UITabContainer)widget.FindWidget("UITabContainerDemo");
                UILayout       lo    = new UILayout();
                lo.SetLayoutConfig("YAGAC");     // YACAC!
                UIEditField myeditfield = new UIEditField();
                myeditfield.SetGravity(UI_GRAVITY.UI_GRAVITY_ALL);
                myeditfield.SetMultiline(true);
                File   filex = cache.GetFile("Components/code_uitabcontainer.cs");
                String textx = filex.ReadText();
                filex.Close();
                myeditfield.SetText(textx);
                UIFontDescription myfont = new UIFontDescription();  // put in a coder font
                myfont.SetSize(16);
                myfont.SetId("Vera");
                myeditfield.SetFontDescription(myfont);
                lo.AddChild(myeditfield);
                tcx.AddTabPageWidget("New Code", lo);
            }
            if (widget.GetId() == "uitabcontainerundock")
            {
                AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed ");
                UITabContainer tcx     = (UITabContainer)widget.FindWidget("UITabContainerDemo");
                int            current = tcx.GetCurrentPage();
                tcx.UndockPage(current);
            }
            if (widget.GetId() == "uitabcontainerredock")
            {
                AtomicMain.AppLog("UITabContainer action : " + widget.GetId() + " was pressed ");
                UITabContainer tcx = (UITabContainer)widget.FindWidget("UITabContainerDemo");
                if (!tcx.DockWindow("tab1"))
                {
                    if (!tcx.DockWindow("tab2"))
                    {
                        if (!tcx.DockWindow("tab3"))
                        {
                            if (!tcx.DockWindow("New File"))
                            {
                                if (!tcx.DockWindow("New Code"))
                                {
                                    AtomicMain.AppLog("UITabContainer action : no more windows to dock.");
                                }
                            }
                        }
                    }
                }
            }
        }
    }