Пример #1
0
        public string Load(string file, string assign = "")
        {
            try {
                var tag = assign;
                var at  = 0;
                if (tag == "")
                {
                    do
                    {
                        at++; tag = $"IMAGE:{at}";
                    } while (Images.ContainsKey(tag));
                }
                if (qstr.Suffixed(file.ToLower(), ".jpbf"))
                {
                    Images[tag] = TQMG.GetBundle(file);
                }
                else
                {
                    Images[tag] = TQMG.GetImage(file);
                }
                if (Images[tag] == null)
                {
                    throw new Exception($"Filed loading {file} at {tag}\n{UseJCR6.JCR6.JERROR}");
                }
                return(tag);
            } catch (Exception Catastrophe) {
#if DEBUG
                SBubble.MyError($"Bubble.Graphics.Images.Load(\"{file}\",\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}\n\n.NET Traceback:\n{Catastrophe.StackTrace}");
#else
                SBubble.MyError($"Bubble.Graphics.Images.Load(\"{file}\",\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}");
#endif
                return("Il ya une catastrophe");
            }
        }
Пример #2
0
        public string GrabScreen(string assign = "")
        {
            try {
                var tag = assign;
                var at  = 0;
                if (tag == "")
                {
                    do
                    {
                        at++; tag = $"IMAGE:{at}";
                    } while (Images.ContainsKey(tag));
                }
                Images[tag] = TQMG.GrabImage();
                if (Images[tag] == null)
                {
                    throw new Exception("Grabbed image == null!");
                }
                return(tag);
            } catch (Exception Catastrophe) {
#if DEBUG
                SBubble.MyError($"Bubble.Graphics.Images.Grab(\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}\n\n.NET Traceback:\n{Catastrophe.StackTrace}");
#else
                SBubble.MyError($"Bubble.Graphics.Images.Grab(\"{assign}\")", Catastrophe.Message, $"{SBubble.TraceLua(vm)}");
#endif
                return("Il ya une catastrophe");
            }
        }
Пример #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            try {
                // Create a new SpriteBatch, which can be used to draw textures.
                spriteBatch = new SpriteBatch(GraphicsDevice);


                #region Tricky's Quick Monogame Graphics
                if (SBubble.JCR == null)
                {
                    System.Diagnostics.Debug.WriteLine("EEP! JCR resource is null! But how?");
                }
                TQMG.Init(graphics, GraphicsDevice, spriteBatch, SBubble.JCR);
                #endregion

                BubbleInit.LetsGo();

                TrickyGameJolt.GJAPI.ERRORFUNCTION = delegate(string msg) {
#if FATAL_GAMEJOLT
                    SBubble.MyError("Game Jolt API Error", msg, "");
#else
                    BubConsole.WriteLine("GAME JOLT ERROR", 255, 0, 0); System.Console.Beep();
                    BubConsole.WriteLine(msg);
#endif
                };
            } catch (System.Exception Allemaal_naar_de_klote) {
#if DEBUG
                Confirm.Annoy($"ERROR!\n{Allemaal_naar_de_klote.Message}\n\n{Allemaal_naar_de_klote.StackTrace}\n", "NALA Init error (LC)", System.Windows.Forms.MessageBoxIcon.Error);
#else
                Confirm.Annoy($"ERROR!\n{Allemaal_naar_de_klote.Message}\n\nDid you install everything propely, or is the engine broken?\n", "NALA Init error (LC)", System.Windows.Forms.MessageBoxIcon.Error);
#endif
                System.Environment.Exit(10);
            }
        }
Пример #4
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?");
            }
        }
Пример #5
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);
        }
Пример #6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            try {
                spriteBatch = new SpriteBatch(GraphicsDevice);
                TQMG.Init(graphics, GraphicsDevice, spriteBatch, JCR);
                MousePointer = TQMG.GetImage("Mouse.png"); Assert(MousePointer, JCR6.JERROR);
                Font         = TQMG.GetFont("DosFont.JFBF"); Assert(Font, JCR6.JERROR);
                Back         = TQMG.GetImage("Back.png");
                VoidBack     = TQMG.GetImage("Void.png");
                Stage.GoTo(new Editor());
                foreach (string prj in Config.GetL("Projects"))
                {
                    if (System.IO.Directory.Exists(prj))
                    {
                        Project.ProjMap[prj] = new Project(prj);
                    }
                    else
                    {
                        Confirm.Annoy($"Project directory \"{prj}\" has not been found!");
                    }
                }
                new LexNIL();
            } catch (Exception QuelleCatastrophe) {
#if DEBUG
                FatalError($"Exception Thrown:\n{QuelleCatastrophe.Message}\n\n{QuelleCatastrophe.StackTrace}");
#else
                FatalError($"Exception Thrown:\n{QuelleCatastrophe.Message}");
#endif
            }

            // TODO: use this.Content to load your game content here
        }
Пример #7
0
        void GetJCR()
        {
            var f = new List <TJCREntry>();

            JCR = JCR6.Dir(Dirry.AD(args[1]));
            Assert(JCR, JCR6.JERROR);

            foreach (TJCREntry e in JCR.Entries.Values)
            {
                var ok = qstr.Suffixed(e.Entry.ToLower(), ".png");
                var p  = false;
                for (int i = 2; i < args.Length; i++)
                {
                    p = p || qstr.Prefixed(e.Entry.ToLower(), args[i].ToLower());
                }
                ok = (args.Length == 2 || p);
                if (ok)
                {
                    f.Add(e);
                }
            }
            Files = f.ToArray();
            TQMG.Init(graphics, GraphicsDevice, spriteBatch, JCR);
            JCRC = new TJCRCreate($"{qstr.StripExt(args[1])}.Negative.JCR");
        }
        public override void Draw(GameTime gameTime)
        {
            // Blocked, or not?
            for (int y = 0; y < TQMG.ScrHeight; y++)
            {
                for (int x = 0; x < TQMG.ScrWidth; x++)
                {
#if DEBUG
                    if (first)
                    {
                        BubConsole.WriteLine($"Pure({x},{y}); Scroll({ScrollX},{ScrollY}); Combined({x + ScrollX},{ y + ScrollY});  Block({MapLayer.Block(x + ScrollX, y + ScrollY)})");
                    }
#endif
                    TQMG.Color(
                        BlCol(
                            MapLayer.Block(x + ScrollX, y + ScrollY)
                            )
                        );
                    TQMG.Plot(x, y);
                }
            }
#if DEBUG
            first = false;
#endif

            // Actors
            foreach (KthuraObject O in MapLayer.Objects)
            {
                TQMG.Color(255, 0, 0);
                if (O.kind == "Actor")
                {
                    TQMG.Plot(O.x - ScrollX, O.y - ScrollY);
                }
            }
        }
Пример #9
0
        static public void DrawText(string text, int x, int y)
        {
            var dx = x;
            var dy = y;

            for (int i = 0; i < text.Length; i++)
            {
                var b = (byte)text[i];
                if (b == 32)
                {
                    dx += fw;
                }
                else if (b == 10)
                {
                    dx  = x;
                    dy += fh;
                }
                else if (b > 32 && b < 127)
                {
                    if (!CharPics.ContainsKey(b))
                    {
                        var q = QuickStream.OpenEmbedded($"SysFont.{b}.png");
                        if (q != null)
                        {
                            CharPics[b] = TQMG.GetImage(q);
                            Debug.WriteLine($"Loaded character {b} => {text[i]}");
                        }
                    }
                    if (CharPics.ContainsKey(b))   // NO ELSE! That won't cause the desired effect
                    {
                        try {
                            var cp = CharPics[b];
                            cp.Draw(dx, dy);
                            if (fw < cp.Width)
                            {
                                fw = cp.Width;
                            }
                            if (fh < cp.Height)
                            {
                                fh = cp.Height;
                            }
                            dx += fw;
                            if (dx + fw > TQMG.ScrWidth)
                            {
                                dx  = x;
                                dy += fh;
                            }
                        } catch (Exception E) {
                            Debug.Print($"Caught: {E.Message}");
                        }
                    }
                }
            }
        }
Пример #10
0
 void Neg()
 {
     Negative = TQMG.NewImage(Original.Width, Original.Height);
     for (int y = 0; y < Original.Height; y++)
     {
         for (int x = 0; x < Original.Width; x++)
         {
             var Pix = Original.GetPixel(x, y);
             Negative.PutPixel(x, y, (byte)(255 - Pix.R), (byte)(255 - Pix.G), (byte)(255 - Pix.B), Pix.A);
         }
     }
 }
Пример #11
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);
        }
Пример #12
0
        override public void Draw(Game1 game, GameTime gameTime)
        {
            var y = 10;

            // throw new Exception("FORCE"); // must be rem in release
            TQMG.Color(255, 0, 0);
            foreach (TQMGText T in TextList)
            {
                T.Draw(10, y);
                TQMG.Color(255, 180, 0);
                y += 20;
            }
        }
Пример #13
0
 public override void Draw(Game1 game, GameTime gameTime)
 {
     TQMG.Color(0, 180, 255); // This effect was originall a bug, but in stead of fixing it, I decided to "seal" it in :P
     TQMG.SimpleTile(UI.back, 0, 0, UI.ScrWidth, UI.ScrHeight);
     TQMG.Color(255, 180, 0);
     UI.font32.DrawText($"All Textures! Starting at {spot.ToString("X2")}", UI.ScrWidth / 2, 50, TQMG_TextAlign.Center);
     TQMG.Color(180, 0, 255);
     UI.font20.DrawText("Prefix:", 10, 100);
     TQMG.Color(0, 18, 25);
     TQMG.DrawRectangle(10, 125, UI.ScrWidth - 20, 22);
     TQMG.Color(0, 180, 255);
     UI.font20.DrawText($"{prefix}|", 12, 126);
 }
Пример #14
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);
        }
Пример #15
0
        static public void Error(Game1 getgame, string ErrorMessage)
        {
            Game = getgame;
            var fnt = TQMG.GetFont("fonts/SulphurPoint-Regular.12.jfbf");

            TextList.Add(fnt.Text("Error!"));
            foreach (string l in ErrorMessage.Split('\n'))
            {
                TextList.Add(fnt.Text(l));
            }
            TextList.Add(fnt.Text("Hit enter or click the mouse to leave this program!"));
            ProjectData.Log($"{(char)27}[31mERROR!!!{(char)27}[0m\n{ErrorMessage}");
            Game.SetStage(new Crash());
        }
Пример #16
0
 /// <summary>
 /// Allows the game to run logic such as updating the world,
 /// checking for collisions, gathering input, and playing audio.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Update(GameTime gameTime)
 {
     //if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
     if (FilesIDX >= FilesCNT)
     {
         JCRC.Close();
         Exit();
     }
     else
     {
         Original = TQMG.GetImage(Files[FilesIDX].Entry);
         Neg();
         Negative.Save(JCRC, $"{qstr.StripExt(Files[FilesIDX].Entry)}.Negative.png", "lzma", Files[FilesIDX].Author, Files[FilesIDX].Notes);
         FilesIDX++;
     }
     base.Update(gameTime);
 }
Пример #17
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            BubbleTimer.DrawTime = gameTime.ElapsedGameTime.Milliseconds;
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearWrap, null, null); //DepthStencilState.Default
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, null);

            FlowManager.Draw(gameTime);

            if (BubbleTimer.ShowTime)
            {
                TQMG.Color(255, 255, 255);
                SysFont.DrawText($"Update: {BubbleTimer.UpdateTime}ms/{1000 / BubbleTimer.UpdateTime}fps; Draw: {BubbleTimer.DrawTime}ms/{1000 / BubbleTimer.DrawTime}fps", 5, 5);
            }
            spriteBatch.End();

            base.Draw(gameTime);
        }
Пример #18
0
        public override void Draw(Game1 game, GameTime gameTime)
        {
            var d = DateTime.Now.Second;
            var c = "|";
            var y = 100;

            if (d % 2 == 0)
            {
                c = "";
            }
            TQMG.Color(127, 127, 127);
            TQMG.SimpleTile(UI.back, 0, 0, UI.ScrWidth, UI.ScrHeight);
            TQMG.Color(255, 180, 0);
            font32.DrawText($"Object ({x},{y}): {obj.Cl("TeddyID")}", UI.ScrWidth / 2, 50, TQMG_TextAlign.Center);
            foreach (string key in ProjectData.ProjectConfig.List($"OBJECT.{obj.ObjType}"))
            {
                if (curField == "")
                {
                    curField = key;
                }
                var cur = "";
                var r   = (byte)180;
                var g   = (byte)0;
                var b   = (byte)255;
                if (key == curField)
                {
                    cur = c;
                    r   = 0;
                    g   = 180;
                    b   = 255;
                }
                TQMG.Color((byte)(r / 10), (byte)(g / 10), (byte)(b / 10));
                TQMG.DrawRectangle(250, y, UI.ScrWidth - 300, 21);
                TQMG.Color(r, g, b);
                font20.DrawText($"{obj.Cl(key)}{cur}", 252, y);
                TQMG.Color((byte)(255 - r), (byte)(255 - g), (byte)(255 - b));
                font20.DrawText(key, 240, y, TQMG_TextAlign.Right);
                if (muis.LeftButton == ButtonState.Pressed && muis.Y > y && muis.Y < y + 20)
                {
                    curField = key;
                }
                y += 23;
            }
        }
Пример #19
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.LinearWrap, null, null);
            // Stage

            Stage.DrawStage();

            // Mouse
            TQMG.Color(255, 255, 255); if (ms.X > 0 && ms.Y > 0)
            {
                MousePointer.Draw(ms.X, ms.Y);
            }

            spriteBatch.End();


            base.Draw(gameTime);
        }
Пример #20
0
 public override void Draw(Game1 game, GameTime gameTime)
 {
     #region draw list itself
     foreach (TL_Item item in Texes)
     {
         if (item.high)
         {
             TQMG.Color(255, 180, 0);
         }
         else
         {
             TQMG.Color(255, 255, 255);
         }
         item.dt.Draw(20, item.y - scrollY);
     }
     #endregion
     #region Draw scroll arrow
     #region up
     if (ms.X > ProjectData.Game.Window.ClientBounds.Width - 32 && ms.Y < 32)
     {
         TQMG.Color(180, 0, 255);
     }
     else
     {
         TQMG.Color(0, 180, 255);
     }
     UI.ArrowUp.Draw(ProjectData.Game.Window.ClientBounds.Width - 32, 0);
     #endregion
     #region Down
     if (ms.X > ProjectData.Game.Window.ClientBounds.Width - 32 && ms.Y > ProjectData.Game.Window.ClientBounds.Height - 32)
     {
         TQMG.Color(180, 0, 255);
     }
     else
     {
         TQMG.Color(0, 180, 255);
     }
     UI.ArrowDn.Draw(ProjectData.Game.Window.ClientBounds.Width - 32, ProjectData.Game.Window.ClientBounds.Height - 32);
     #endregion
     #endregion
 }
Пример #21
0
        public override void Draw(Game1 game, GameTime gameTime)
        {
            TQMG.Color(127, 127, 127);
            TQMG.Color(255, 180, 0);
            Head.Draw(UI.ScrWidth / 2, 50, TQMG_TextAlign.Center);

            // Todo: Tile the requested texture
            for (int i = 0; i < UI.LayerList.Length; i++)
            {
                if (!qstr.Prefixed(UI.LayerList[i], "Zone_"))
                {
                    var cy = 100 + (i * 21);
                    TQMG.Color(255, 255, 255);
                    UI.LayerText[i].Draw(5, cy);
                    if (MapConfig.Allow(ProjectData.Map.Texture[Tex], UI.LayerList[i]) == TexAllow.NotSet)
                    {
                        MapConfig.Allow(ProjectData.Map.Texture[Tex], UI.LayerList[i], TexAllow.Allow);
                    }
                    foreach (TexAllow a in AllowText.Keys)
                    {
                        var cx = ((int)a) * 150;
                        if (MapConfig.Allow(ProjectData.Map.Texture[Tex], UI.LayerList[i]) == a)
                        {
                            TQMG.Color(0, 180, 255);
                        }
                        else
                        {
                            TQMG.Color(180, 0, 255);
                        }
                        AllowText[a].Draw(cx, cy, TQMG_TextAlign.Center);
                        if (myMouse.Y > cy && myMouse.Y < cy + 20 && myMouse.X > cx - 70 && myMouse.X < cx + 70 && myMouse.LeftButton == ButtonState.Pressed)
                        {
                            MapConfig.Allow(ProjectData.Map.Texture[Tex], UI.LayerList[i], a);
                        }
                        // TODO: Click this
                    }
                }
            }
        }
Пример #22
0
 public override void Draw(Game1 game, GameTime gameTime)
 {
     TQMG.Color(127, 127, 127);
     TQMG.SimpleTile(UI.back, 0, 0, UI.ScrWidth, UI.ScrHeight);
     TQMG.Color(255, 180, 0);
     Caption.Draw(UI.ScrWidth / 2, 25, TQMG_TextAlign.Center);
     foreach (ObjectItem item in ObjectItems)
     {
         TQMG.Color(180, 0, 255);
         if (mstate.X > item.x && mstate.X < item.x + 95 && mstate.Y > item.y && mstate.Y < item.y + 20)
         {
             TQMG.Color(0, 180, 255);
             if (mstate.LeftButton == ButtonState.Pressed)
             {
                 UI.CurrentObject = item.ObjName;
                 Main.ComeToMe();
                 UI.DontMouse = true;
             }
         }
         item.ObjText.Draw(item.x + 3, item.y);
     }
 }
Пример #23
0
        public string GrabPart(int x, int y, int w, int h, string assign = "")
        {
            try {
                var tag = assign;
                var at  = 0;
                if (tag == "")
                {
                    do
                    {
                        at++; tag = $"IMAGE:{at}";
                    } while (Images.ContainsKey(tag));
                }
                Images[tag] = TQMG.GrabImage(x, y, w, h);
                return(tag);
            } catch (Exception Catastrophe) {
#if DEBUG
                SBubble.MyError($"Bubble.Graphics.Images.Grab(\"{assign}\",{x},{y},{w},{h})", Catastrophe.Message, $"{SBubble.TraceLua(vm)}\n\n.NET Traceback:\n{Catastrophe.StackTrace}");
#else
                SBubble.MyError($"Bubble.Graphics.Images.Grab(\"{assign}\",{x},{y},{w},{h})", Catastrophe.Message, $"{SBubble.TraceLua(vm)}");
#endif
                return("Il ya une catastrophe");
            }
        }
Пример #24
0
        static public void GoError(string ct, string message, string trace)
        {
            blocked = true;
            BubConsole.WriteLine($"ERROR>{message}", 255, 0, 0);
            Debug.WriteLine($"{ct}: {message}\nTraceback:\n{trace}\n\n");
            if (crashed)
            {
                return;
            }
            crashed = true;
            var s = QuickStream.OpenEmbedded("Death.png");

            if (s == null)
            {
                Debug.WriteLine("ERROR! Trying to read Death resulted into null!");
            }
            s.Position = 0;
            Death      = TQMG.GetImage(s);
            sct        = ct;
            smsg       = message;
            strace     = trace;
            FlowManager.GoHardFlow(new Error(), true);
        }
Пример #25
0
        static BubConsole()
        {
            if (AllowWriteLog)
            {
                try {
                    WriteLine($"Output will be written to {WriteLogFile}", 255, 180, 0);
                    System.IO.Directory.CreateDirectory(qstr.ExtractDir(WriteLogFile));
                    WrLog = QuickStream.WriteFile(WriteLogFile);
                    WrLog.WriteString("<html>\n<head><title>Log from Bubble!</title></head><style>body{ color: white; background-color: black; font-family: courier; font-size:20pt; }</style>\n\n", true);
                } catch (Exception EX) {
                    WriteLine("ERROR!", 255, 0, 0);
                    WriteLine($"{EX.Message}", 255, 0, 0);
                    WriteLine("Due to this error I cannot guarantee the log will work!");
                    Console.Beep();
                }
            }
            WriteLine($"Bubble {MKL.Newest} - (c) Jeroen P. Broks", 255, 255, 0);
            var s = new NLua.Lua();
            var v = (string)s.DoString("return _VERSION")[0];

            WriteLine($"Uses {v} by PUC-Rio", 180, 0, 255);
            WriteLine($"Data folder: {Bubble_Save.SWorkDir}", 180, 255, 0);
            if (SBubble.JCR.Exists("Bubble/Background.png"))
            {
                WriteLine("Loading: Bubble/Background.png", 255, 180, 0);
                BackGround = TQMG.GetImage("Bubble/Console.png");
            }
            else if (SBubble.JCR.Exists("Bubble/Console.jpg"))
            {
                WriteLine("Loading: Bubble/Console.jpg", 255, 180, 0);
                BackGround = TQMG.GetImage("Bubble/Console.jpg");
            }
            else
            {
                WriteLine("No background found", 255, 0, 0);
            }
        }
Пример #26
0
        static public void Draw()
        {
            TQMG.Color(Color.White);
            Void.Back.Draw(0, 0, 0, 0, TQMG.ScrWidth, 20);
            var nix = 5;

            foreach (Heads h in (Heads[])Enum.GetValues(typeof(Heads)))
            {
                if (Top[h] == null)
                {
                    new PullDownMenus(h);
                    Top[h].TopX      = nix;
                    Top[h].Caption   = $"{h}";
                    Top[h].CaptGraph = Void.Font.Text(Top[h].Caption, true);
                }
                if (Selected == Top[h])
                {
                    TQMG.Color(0, 255, 255);
                    TQMG.DrawRectangle(nix - 5, 0, Top[h].CaptGraph.Width + 10, 20);
                    TQMG.Color(Color.Black);
                }
                else
                {
                    TQMG.Color(0, 255, 255);
                }
                Top[h].CaptGraph.Draw(nix, 4);
                if (Void.ms.LeftButton == ButtonState.Pressed)
                {
                    if (Void.ms.X > nix && Void.ms.Y < 20 && Void.ms.X < nix + Top[h].CaptGraph.Width + 10)
                    {
                        Selected = Top[h];
                    }
                }
                nix += Top[h].CaptGraph.Width + 10;
            }
        }
Пример #27
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            // TQMG
            TQMG.Init(graphics, GraphicsDevice, spriteBatch, SBubble.JCR);

            // Make sure all states consider at least these!
            SBubble.AddInit(delegate(string v) { SBubble.State(v).DoString($"function {FlowManager.NOTHING}() end", "Alright move along, nothing to see here!"); });
            SBubble.AddInit(BubbleConsole.StateInit);
            SBubble.AddInit(BubbleGraphics.InitGraphics);
            SBubble.AddInit(Bubble_Audio.Init);
            SBubble.AddInit(APIFlow.Init);
            SBubble.AddInit(BubbleSuperGlobal.Init);
            SBubble.AddInit(Bubble_Input.Init);
            SBubble.AddInit(Bubble_Save.Init);

            // Start init script
            FlowManager.StartInitFlow();


            // Error Test
            //Error.GoError("Test", "TestError", "Traceme");
        }
Пример #28
0
 public override void Draw(GameTime gameTime)
 {
     TQMG.Color(255, 255, 255);
     if (BackGround != null)
     {
         TQMG.Tile(BackGround, 0, 0, 0, 0, TQMG.ScrWidth, TQMG.ScrHeight);
     }
     try {
         var y = ScrollUp - StartY;
         foreach (BCLine l in Line)
         {
             if (y > -30)
             {
                 //SysFont.DrawText(l.txt, 2, y);
                 l.Show(2, y);
             }
             y += 22;
         }
         TQMG.Color(255, 180, 0);
         SysFont.DrawText($">{TypingCommand}_", 2, y);
     } catch (Exception error) {
         Debug.WriteLine($"Exception during the debug log rendering!\n{error.Message}\nTraceback:\n{error.StackTrace}\n\n");
     }
 }
Пример #29
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();
        }
Пример #30
0
        TQMGImage GetTex(KthuraObject obj)
        {
            var file  = obj.Texture;
            var kind  = obj.kind;
            var lay   = obj.Parent;
            var map   = lay.Parent;
            var mfile = qstr.StripExt(file);

            if (qstr.ExtractExt(file.ToUpper()) == "PNG" && map.TextureJCR.Exists($"{mfile}.frames") && map.TextureJCR.DirExists($"{mfile}.jpbf"))
            {
                var rfile = $"{mfile}.jpbf";
                switch (AutoBundle)
                {
                case TAutoBundle.Off: break;

                case TAutoBundle.AutomaticallyFixObject:
                    obj.Texture = rfile;
                    // Fallthrough... Otherwise not supported in C#, so this is the only way to do it (bad bad Microsoft)
                    goto case TAutoBundle.ReplaceInLoadOnly;

                case TAutoBundle.ReplaceInLoadOnly:
                    file = rfile;
                    break;
                }
            }
            if (map != LastUsedMap)
            {
                Textures.Clear();                     // Only store texture per map. Will take too much RAM otherwise!
            }
            LastUsedMap = map;
            var tag = $"{kind}::{file}";

            if (!Textures.ContainsKey(tag))
            {
                if (qstr.ExtractExt(file.ToUpper()) == "JPBF")
                {
                    Textures[tag] = TQMG.GetBundle(map.TextureJCR, $"{file}/");
                    //Bubble.BubConsole.WriteLine($"KTHURA DRAW DEBUG: Loading Bundle {file}", 255, 255, 0); // debug! (must be on comment when not in use)
                }
                else
                {
                    if (map.TextureJCR == null)
                    {
                        Debug.WriteLine("TextureJCR is null???");
                    }
                    var bt = map.TextureJCR.ReadFile(file);
                    if (bt == null)
                    {
                        if (NoTexture != null)
                        {
                            Textures[tag] = NoTexture; //TQMG.GetImage(NoTexture.GetTex(0));
                            System.Console.Beep();
                            Debug.WriteLine($"Texture {file} for {tag} could not be loaded , so set to alternet picture in stead ({UseJCR6.JCR6.JERROR})");
                            //return NoTexture;
                        }
                        else
                        {
                            CrashOnNoTex?.Invoke($"Couldn't open texture file {file} for {tag}");
                            Debug.WriteLine($"Couldn't open texture file {file} for {tag}");
                            return(null);
                        }
                    }
                    else
                    {
                        Textures[tag] = TQMG.GetImage(bt);
                        if (Textures[tag] == null)
                        {
                            if (NoTexture != null)
                            {
                                Textures[tag] = NoTexture;
                                System.Console.Beep();
                                Debug.WriteLine($"Texture {tag} could not be loaded, so set to alternet picture in stead");
                            }
                            else
                            {
                                CrashOnNoTex?.Invoke($"Texture `{file}` didn't load at all on tag {tag}.\n{UseJCR6.JCR6.JERROR}");
                            }
                        }
                    }
                }
                if (Textures[tag].Frames == 0)
                {
                    CrashOnNoTex?.Invoke($"Texture `{file}` for tag `{tag}` has no frames");
                }
                if (obj.kind == "Obstacle" || obj.kind == "Actor")
                {
                    Textures[tag].HotBottomCenter();
                }
            }
            return(Textures[tag]);
        }