Пример #1
0
        public override void DrawActor(KthuraActor obj, int ix = 0, int iy = 0, int scrollx = 0, int scrolly = 0)
        {
            var tx = GetTex(obj);

            if (tx != null)
            {
                obj.UpdateMoves();
                TQMG.Color((byte)obj.R, (byte)obj.G, (byte)obj.B);
                //TQMG.SetAlphaFloat((float)obj.Alpha1000 / 1000);
                TQMG.SetAlpha((byte)obj.Alpha255);
                //TQMG.RotateRAD((float)obj.RotationRadians);
                TQMG.RotateDEG(obj.RotationDegrees);
                TQMG.Scale(obj.ScaleX, obj.ScaleY);
                if (obj.AnimFrame >= tx.Frames)
                {
                    obj.AnimFrame = 0;
                }
                tx.XDraw(obj.x + ix - scrollx, obj.y + iy - scrolly, obj.AnimFrame);
                TQMG.Scale(1000, 1000);
                TQMG.RotateRAD(0);
                TQMG.SetAlpha(255);
            }
            else
            {
                CrashOnNoTex?.Invoke($"Actor-texture '{obj.Texture}' did somehow not load?");
            }
        }
Пример #2
0
        public override void Draw(GameTime gameTime)
        {
            const int ident = 5;
            int       DY    = 0;

            if (Death.Height < TQMG.ScrHeight)
            {
                DY = TQMG.ScrHeight - Death.Height;
            }
            TQMG.Color(0, 18, 25);
            TQMG.SetAlpha(255);
            TQMG.DrawRectangle(0, 0, TQMG.ScrWidth, TQMG.ScrHeight);
            TQMG.Color(0, 36, 50);
            Death.Draw(0, DY);
            TQMG.Color(255, 180, 100);
            SysFont.DrawText("OOPS!", ident, 0);
            TQMG.Color(255, 255, 0);
            SysFont.DrawText("You tried something we didn't think of!", 50, 25);
            TQMG.Color(0, 180, 255);
            SysFont.DrawText(sct, ident, 75);
            TQMG.Color(0, 200, 255);
            SysFont.DrawText(smsg, ident, 125);
            TQMG.Color(0, 220, 255);
            SysFont.DrawText(strace, ident, 250);
            TQMG.Color(0, 255, 255);
            SysFont.DrawText("Hit Escape to exit this application", 50, TQMG.ScrHeight - 30);
        }
Пример #3
0
        public override void DrawStretchedArea(KthuraObject obj, int ix = 0, int iy = 0, int scrollx = 0, int scrolly = 0)
        {
            var tx = GetTex(obj);

            TQMG.Color((byte)obj.R, (byte)obj.G, (byte)obj.B);
            TQMG.SetAlpha((byte)obj.Alpha255);
            if (tx != null)
            {
                tx.StretchDraw(obj.x + ix - scrollx, obj.y + iy - scrolly, obj.w, obj.h, obj.AnimFrame);
            }
            TQMG.SetAlpha(255);
        }
Пример #4
0
        public override void DrawTiledArea(KthuraObject obj, int ix = 0, int iy = 0, int scrollx = 0, int scrolly = 0)
        {
            var tx = GetTex(obj);

            TQMG.Color((byte)obj.R, (byte)obj.G, (byte)obj.B);
            //TQMG.SetAlphaFloat((float)obj.Alpha1000 / 1000);
            TQMG.SetAlpha((byte)obj.Alpha255);
            if (tx != null)
            {
                TQMG.Tile(tx, obj.insertx, obj.inserty, obj.x + ix - scrollx, obj.y + iy - scrolly, obj.w, obj.h, obj.AnimFrame);
            }
            TQMG.SetAlpha(255);
        }
Пример #5
0
        public override void Draw()
        {
            if (lchr < 256)
            {
                Void.Font.DrawText($"{(char)lchr}!", 0, 0);
                lchr++;
            }

            // Positions
            var StatY = TQMG.ScrHeight - 20;
            var OutX  = TextX + TextW;
            var OutW  = TQMG.ScrWidth - (TextX + TextW);

            // Document Content
            if (Doc != null)
            {
                TQMG.Color(127, 127, 127);
            }
            Void.VoidBack.Draw((TextX + (TextW / 2)) - (Void.VoidBack.Width / 2), (TextY + (TextH / 2)) - (Void.VoidBack.Height / 2));
            if (Doc != null)
            {
                for (int lnnr = 0; lnnr < Doc.Lines.Count; lnnr++)
                {
                    var py = lnnr - Doc.scrolly;
                    var ty = TextY + (py * 16);
                    if (ty >= TextY && ty < StatY)
                    {
                        TQMG.Color(127, 127, 127);
                        Void.Font.DrawText($"{lnnr + 1} {(char)186}", TextX + (144), ty, TQMG_TextAlign.Right);
                    }
                    var tx = 172;
                    if (Doc.Lines[lnnr].Letters == null)
                    {
                        Doc.Lexer.Chop(Doc.Lines[lnnr]);
                    }
                    if (Doc.Lines[lnnr].Letters != null)
                    {
                        for (int psnr = 0; psnr < Doc.Lines[lnnr].Letters.Count(); psnr++)
                        {
                            if (psnr >= Doc.scrollx && tx < TextW)
                            {
                                var let = Doc.Lines[lnnr].Letters[psnr];
                                TQMG.Color(let.Col);
                                if (psnr == Doc.posx && lnnr == Doc.posy)
                                {
                                    TQMG.DrawRectangle(tx, ty, let.cl * 8, 16);
                                    TQMG.Color((byte)(255 - let.Col.R), (byte)(255 - let.Col.G), (byte)(255 - let.Col.B));
                                }
                                if (let.str != ' ' && let.str != '\t')
                                {
                                    Void.Font.fimg.Draw(tx, ty, (byte)let.str);
                                }
                                tx += let.cl * 8;
                            }
                        }
                        if (Doc.PosY == lnnr && Doc.PosX == Doc.Lines[lnnr].Letters.Count())
                        {
                            TQMG.Color(Color.Aquamarine);
                            TQMG.DrawRectangle(tx, ty, 8, 16);
                        }
                    }
                }
            }


            // Project, FileList and Outline
            TQMG.Color(255, 255, 255);
            Void.Back.Draw(OutX, TextY, TextX + TextW, TextY, OutW, TextW);
            // Project list
            TQMG.Color(255, 0, 0);
            TQMG.SetAlpha(50);
            TQMG.DrawRectangle(OutX, TextY, OutW, 64);
            TQMG.Color(255, 255, 0);
            TQMG.SetAlpha(255);
            {
                var y = 0 - ProjectScroll;
                foreach (string n in Project.ProjMap.Keys)
                {
                    if (y >= 0 && y < 4)
                    {
                        var n2 = Project.ProjMap[n].CFG["Title"]; if (n2.Length > 40)
                        {
                            n2 = $"{qstr.Left(n2, 16)}...{qstr.Right(n2, 16)}";
                        }
                        var iy  = TextY + (y * 16);
                        var Txt = Void.Font.Text(n2);
                        TQMG.Color(255, 255, 0);
                        if (n == Project.ChosenProjectID)
                        {
                            TQMG.DrawRectangle(OutX, iy, Txt.Width, 16);
                            TQMG.Color(255, 0, 0);
                        }
                        Txt.Draw(OutX, iy);
                        if (Void.ms.X > OutX && Void.ms.Y > iy && Void.ms.Y < iy + 16 && Void.ms.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
                        {
                            Project.ChosenProjectID = n;
                        }
                        y++;
                    }
                }
            }

            // File List
            TQMG.Color(0, 255, 0);
            TQMG.SetAlpha(50);
            TQMG.DrawRectangle(OutX, TextY + 64, OutW, 128);
            TQMG.Color(180, 255, 0);
            TQMG.SetAlpha(255);
            {
                var y = 0 - FileScroll;
                void PS(int tab = 0, Project.Item Item = null)
                {
                    TMap <string, Project.Item> IL;

                    if (Item == null)
                    {
                        IL = Project.ChosenProject.ItemMap;
                    }
                    else
                    {
                        IL = Item.SubDirectory;
                    }
                    foreach (string key in IL.Keys)
                    {
                        var V  = IL[key];
                        var iy = TextY + 64 + (y * 16);
                        switch (V.Type)
                        {
                        case Project.ItemType.NonExistent:
                            throw new Exception($"File '{key}' appears to be marked as Non-Existent!");

                        case Project.ItemType.File:
                            TQMG.Color(180, 255, 0);
                            if (y >= 0 && y < 8)
                            {
                                if (V == Project.ChosenProject.CurrentItem)
                                {
                                    TQMG.DrawRectangle(OutX, iy, TQMG.ScrWidth - OutX - 10, 16);
                                    TQMG.Color(0, 25, 0);
                                }
                                Void.Font.DrawText($"F> {qstr.Str(" ", tab)}{key}", OutX, iy);
                                if (Void.ms.Y > iy && Void.ms.Y < iy + 16 && Void.ms.X > OutX && Void.ms.X < TQMG.ScrWidth - 10 && Void.ms.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
                                {
                                    Project.ChosenProject.CurrentItem = V;
                                }
                            }
                            y++;
                            break;

                        case Project.ItemType.Directory:
                            TQMG.Color(255, 255, 0);
                            if (y >= 0 && y < 8)
                            {
                                Void.Font.DrawText($"D> {qstr.Str(" ", tab)}{key}/", OutX, TextY + 64 + (y * 16));
                            }
                            y++;
                            PS(tab + 1, V);
                            break;

                        default:
                            throw new Exception("Fatal Internal Error! Unknown filetype in file outline");
                        }
                    }
                }

                if (Project.ChosenProject != null)
                {
                    PS();
                }
                if (FileScroll != 0)
                {
                    TQMG.Color(180, 255, 0);
                    Void.Font.DrawText($"{(char)30}", TQMG.ScrWidth, TextY + 64, TQMG_TextAlign.Right);
                    if (Void.ms.LeftButton == ButtonState.Pressed && Void.ms.X > TQMG.ScrWidth - 8 && Void.ms.Y > TextY + 64 && Void.ms.Y < TextY + 80)
                    {
                        FileScroll--;
                    }
                }
                if (y > 8)
                {
                    TQMG.Color(180, 255, 0);
                    Void.Font.DrawText($"{(char)31}", TQMG.ScrWidth, TextY + 64 + 112, TQMG_TextAlign.Right);
                    if (Void.ms.LeftButton == ButtonState.Pressed && Void.ms.X > TQMG.ScrWidth - 8 && Void.ms.Y > TextY + 64 + 112 && Void.ms.Y < TextY + 64 + 128)
                    {
                        FileScroll++;
                    }
                }
            }

            // Outline
            if (Project.ChosenProject != null && Project.ChosenProject.CurrentItem != null)
            {
                TQMG.Color(0, 180, 255);
                var y  = 0;
                var ty = TextY + 64 + 128;
                if (Project.ChosenProject.CurrentDoc.Outline.Count == 0)
                {
                    TQMG.Color(255, 0, 180);
                    Void.Font.DrawText("Nothing to outline", OutX, ty);
                }
                foreach (string n in Project.ChosenProject.CurrentDoc.Outline.Keys)
                {
                    if (y >= OutLineScroll && ty < StatY - 16)
                    {
                        Void.Font.DrawText(n, OutX, ty);
                        ty += 16;
                    }
                }
            }

            // Status bar
            TQMG.Color(Color.White);
            Void.Back.Draw(0, StatY, TQMG.ScrWidth, 20);
            if (Project.ChosenProject == null || Project.ChosenProject.CurrentItem == null)
            {
                TQMG.Color(Color.Red);
                Void.Font.DrawText("No document", 0, StatY);
            }
            else
            {
                Void.Font.DrawText(Project.ChosenProject.CurrentItem.filename, 0, StatY);
                if (Project.ChosenProject.CurrentDoc != null)
                {
                    Void.Font.DrawText($"(Ln:{Project.ChosenProject.CurrentDoc.posy + 1}; Pos:{Project.ChosenProject.CurrentDoc.posx + 1})", TQMG.ScrWidth - 10, StatY, TQMG_TextAlign.Right);
                }
                else
                {
                    TQMG.Color(Color.Red);
                    Void.Font.DrawText("Doc Failure!", TQMG.ScrWidth - 10, StatY, TQMG_TextAlign.Right);
                }
                if (Insert)
                {
                    TQMG.Color(Color.White);
                    Void.Font.DrawText("Insert", TQMG.ScrWidth - 300, StatY, TQMG_TextAlign.Center);
                }
                else
                {
                    TQMG.Color(Color.Violet);
                    Void.Font.DrawText("Overwrite", TQMG.ScrWidth - 300, StatY, TQMG_TextAlign.Center);
                }
                if (Void.kb.CapsLock)
                {
                    TQMG.Color(Color.Tomato);
                    Void.Font.DrawText("Caps Lock", TQMG.ScrWidth - 400, StatY, TQMG_TextAlign.Center);
                }
            }



            // PullDown
            PullDownMenus.Draw();
        }