Exemplo n.º 1
0
        public static void Clear(bool ClearColors = false)
        {
            if (ClearColors)
            {
                LineColors.Clear();
                PushColor(255, 255, 255);
            }

            for (int i = 0; i < OutBuffer.Length; i++)
            {
                OutBuffer[i] = new GConsoleEntry();
            }
            MaxLineLen = 0;
        }
Exemplo n.º 2
0
        public static void NuklearDraw(int X, int Y)
        {
            const NkPanelFlags Flags         = NkPanelFlags.BorderTitle | NkPanelFlags.MovableScalable | NkPanelFlags.ClosableMinimizable;
            const string       ConWindowName = "GConsole";

            if (Open)
            {
                NuklearAPI.Window(ConWindowName, X, Y, 600, 400, Flags, () => {
                    NkRect Bounds = NuklearAPI.WindowGetBounds();
                    if (Bounds.H > 85)
                    {
                        NuklearAPI.LayoutRowDynamic(Bounds.H - 85);

                        NuklearAPI.Group("Console_OutBufferGroup", 0, () => {
                            NuklearAPI.LayoutRowDynamic(12);

                            for (int i = 0; i < OutBuffer.Length; i++)
                            {
                                GConsoleEntry E = OutBuffer[i];
                                if (E.Msg != null)
                                {
                                    NuklearAPI.LabelColored(E.Msg, E.Clr);
                                }
                            }
                        });
                    }

                    NuklearAPI.LayoutRowDynamic();
                    if (NuklearAPI.EditString(NkEditTypes.Field, InBuffer).HasFlag(NkEditEvents.Active) && NuklearAPI.IsKeyPressed(NkKeys.Enter))
                    {
                        SendInput(InBuffer.ToString());
                        InBuffer.Clear();
                    }
                });

                if (NuklearAPI.WindowIsHidden(ConWindowName))
                {
                    NuklearAPI.WindowClose(ConWindowName);
                    Open = false;
                }
            }
        }