Exemple #1
0
        /// <summary>
        /// Draw filled primitive onto surface
        /// </summary>
        /// <param name="surface">Surface to draw to</param>
        /// <param name="color">Color to fill primitive</param>
        /// <param name="antiAlias">antialias primitive</param>
        /// <param name="fill">fill primitive with color</param>
        public void Draw(Surface surface, System.Drawing.Color color, bool antiAlias, bool fill)
        {
            if (surface == null)
            {
                throw new ArgumentNullException("surface");
            }
            if (antiAlias)
            {
                int result = SdlGfx.aalineRGBA(
                    surface.Handle, this.XPosition1, this.YPosition1,
                    this.XPosition2, this.YPosition2,
                    color.R, color.G, color.B,
                    color.A);
                GC.KeepAlive(this);
                if (result != (int)SdlFlag.Success)
                {
                    throw SdlException.Generate();
                }
            }
            else
            {
                int result = SdlGfx.lineRGBA(
                    surface.Handle, this.XPosition1, this.YPosition1,
                    this.XPosition2, this.YPosition2,
                    color.R, color.G, color.B,
                    color.A);
                GC.KeepAlive(this);

                if (result != (int)SdlFlag.Success)
                {
                    throw SdlException.Generate();
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Draw filled primitive onto surface
        /// </summary>
        /// <param name="surface">Surface to draw to</param>
        /// <param name="color">Color to fill primitive</param>
        /// <param name="antiAlias">antialias primitive</param>
        /// <param name="fill">fill primitive with color</param>
        public void Draw(Surface surface, System.Drawing.Color color, bool antiAlias, bool fill)
        {
            if (surface == null)
            {
                throw new ArgumentNullException("surface");
            }
            if (fill)
            {
                int result = SdlGfx.filledPieRGBA(surface.Handle, this.PositionX, this.PositionY, this.Radius, this.StartingAngle, this.EndingAngle, color.R, color.G, color.B,
                                                  color.A);
                GC.KeepAlive(this);
                if (result != (int)SdlFlag.Success)
                {
                    throw SdlException.Generate();
                }
            }
            else
            {
                int result = SdlGfx.pieRGBA(
                    surface.Handle, this.PositionX, this.PositionY,
                    this.Radius,
                    this.StartingAngle, this.EndingAngle,
                    color.R, color.G, color.B,
                    color.A);
                GC.KeepAlive(this);

                if (result != (int)SdlFlag.Success)
                {
                    throw SdlException.Generate();
                }
            }
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        public void Run()
        {
            int  flags    = (Sdl.SDL_HWSURFACE | Sdl.SDL_DOUBLEBUF | Sdl.SDL_ANYFORMAT);
            int  bpp      = 16;
            int  width    = 640;
            int  height   = 480;
            bool quitFlag = false;

            Random rand = new Random();

            //string musicFile = "Data/SdlExamples.Reactangles.sound.ogg";

            Sdl.SDL_Event evt;

            try
            {
                Sdl.SDL_Init(Sdl.SDL_INIT_EVERYTHING);
                Sdl.SDL_WM_SetCaption("Tao.Sdl Example - GfxPrimitives", "");
                IntPtr surfacePtr = Sdl.SDL_SetVideoMode(
                    width,
                    height,
                    bpp,
                    flags);

                Sdl.SDL_Rect rect2 =
                    new Sdl.SDL_Rect(0, 0, (short)width, (short)height);
                Sdl.SDL_SetClipRect(surfacePtr, ref rect2);
                while (quitFlag == false)
                {
                    Sdl.SDL_PollEvent(out evt);

                    if (evt.type == Sdl.SDL_QUIT)
                    {
                        quitFlag = true;
                    }
                    else if (evt.type == Sdl.SDL_KEYDOWN)
                    {
                        if ((evt.key.keysym.sym == (int)Sdl.SDLK_ESCAPE) ||
                            (evt.key.keysym.sym == (int)Sdl.SDLK_q))
                        {
                            quitFlag = true;
                        }
                    }

                    try
                    {
                        SdlGfx.filledCircleRGBA(surfacePtr, (short)rand.Next(10, width - 100), (short)rand.Next(10, height - 100), (short)rand.Next(10, 100), (byte)rand.Next(255), (byte)rand.Next(255), (byte)rand.Next(255), (byte)rand.Next(255));
                        Sdl.SDL_Flip(surfacePtr);
                        Thread.Sleep(100);
                    }
                    catch (Exception) {}
                }
            }
            catch
            {
                Sdl.SDL_Quit();
                throw;
            }
        }
Exemple #4
0
        public void zoomSurfaceSize()
        {
            int dstwidth;
            int dstheight;

            SdlGfx.zoomSurfaceSize(100, 33, 2, 4, out dstwidth, out dstheight);
            Assert.AreEqual(200, dstwidth);
            Assert.AreEqual(132, dstheight);
        }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="r"></param>
 /// <param name="c"></param>
 public void DrawBox(Rectangle r, Color c)
 {
     /*surface.Draw(new SdlDotNet.Graphics.Primitives.Box((short)r.Left,
      *                                              (short)r.Top,
      *                                              (short)r.Right,
      *                                              (short)r.Bottom), c);*/
     //SdlGfx.boxColor(this.surfacePtr(),(short)r.X,(short)r.Y,(short)(r.X+r.Width),(short)(r.Y+r.Height),Sdl.SDL_MapRGB(this.surface.format,c.R,c.G,c.B));
     SdlGfx.rectangleRGBA(this.SurfacePtr(), (short)r.X, (short)r.Y, (short)(r.X + r.Width), (short)(r.Y + r.Height), c.R, c.G, c.B, 255);
 }
Exemple #6
0
        public void bezierColor()
        {
            this.InitSdl();
            //Random rand = new Random();
            int result = SdlGfx.bezierColor(surfacePtr, vx, vy, vx.Length, 4, 7777777);

            result = Sdl.SDL_Flip(surfacePtr);
            Thread.Sleep(sleepTime);
            Assert.AreEqual(result, 0);
            this.Quit();
        }
Exemple #7
0
        public void pixelColor()
        {
            this.InitSdl();

            //Random rand = new Random();
            int result = SdlGfx.pixelColor(surfacePtr, 100, 100, 7777777);

            result = Sdl.SDL_Flip(surfacePtr);
            Thread.Sleep(sleepTime);
            Assert.AreEqual(result, 0);
            this.Quit();
        }
Exemple #8
0
        public void FilledPolygonRGBA()
        {
            this.InitSdl();
            //Random rand = new Random();
            int result =
                SdlGfx.filledPolygonRGBA(surfacePtr, vx, vy, vx.Length, 200, 0, (byte)0, 254);

            result = Sdl.SDL_Flip(surfacePtr);
            Thread.Sleep(sleepTime);
            Assert.AreEqual(result, 0);
            this.Quit();
        }
Exemple #9
0
        public void aaEllipseRGBA()
        {
            this.InitSdl();

            //Random rand = new Random();
            int result = SdlGfx.aaellipseRGBA(surfacePtr, 200, 100, 100, 50, 200, 0, (byte)0, 254);

            result = Sdl.SDL_Flip(surfacePtr);
            Thread.Sleep(sleepTime);
            Assert.AreEqual(result, 0);
            this.Quit();
        }
Exemple #10
0
        public void FilledTrigonPieRGBA()
        {
            this.InitSdl();

            //Random rand = new Random();
            int result = SdlGfx.filledTrigonRGBA(surfacePtr, 100, 100, 250, 400, 100, 300, 200, 0, (byte)0, 254);

            result = Sdl.SDL_Flip(surfacePtr);
            Thread.Sleep(sleepTime);
            Assert.AreEqual(result, 0);
            this.Quit();
        }
Exemple #11
0
 public void ImageFilterAdd()
 {
     SdlGfx.SDL_imageFilterAdd(src1, src2, dest, src1.Length);
     //Console.WriteLine("result: " + result.ToString());
     //Console.WriteLine(
     //	"dest: " + dest[0].ToString() +
     //	", " + dest[1].ToString() + ", " + dest[2].ToString() +
     //	", " + dest[3].ToString());
     Assert.AreEqual(src1[0] + src2[0], dest[0]);
     Assert.AreEqual(src1[1] + src2[1], dest[1]);
     Assert.AreEqual(src1[2] + src2[2], dest[2]);
     Assert.AreEqual(src1[3] + src2[3], dest[3]);
 }
Exemple #12
0
        public void zoomSurface()
        {
            this.InitSdl();
            Sdl.SDL_Rect rect1          = new Sdl.SDL_Rect(0, 0, 400, 400);
            Sdl.SDL_Rect rect2          = new Sdl.SDL_Rect(0, 0, 400, 400);
            IntPtr       bmpImagePtr    = Sdl.SDL_LoadBMP("test.bmp");
            IntPtr       zoomSurfacePtr = SdlGfx.zoomSurface(bmpImagePtr, 5, 2, SdlGfx.SMOOTHING_OFF);

            Sdl.SDL_BlitSurface(zoomSurfacePtr, ref rect1, surfacePtr, ref rect2);
            Assert.IsNotNull(zoomSurfacePtr);
            Assert.IsFalse(zoomSurfacePtr == IntPtr.Zero);
            Sdl.SDL_UpdateRect(surfacePtr, 0, 0, 400, 400);

            //int results = Sdl.SDL_Flip(surfacePtr);
            Thread.Sleep(sleepTime);
        }
Exemple #13
0
        /// <summary>
        /// Draw filled primitive onto surface
        /// </summary>
        /// <param name="surface">Surface to draw to</param>
        /// <param name="color">Color to fill primitive</param>
        /// <param name="antiAlias">antialias primitive</param>
        /// <param name="fill">fill primitive with color</param>
        public void Draw(Surface surface, System.Drawing.Color color, bool antiAlias, bool fill)
        {
            if (surface == null)
            {
                throw new ArgumentNullException("surface");
            }
            int result = SdlGfx.bezierRGBA(
                surface.Handle, this.PositionsX(), this.PositionsY(),
                this.NumberOfPoints, this.Steps,
                color.R, color.G, color.B,
                color.A);

            GC.KeepAlive(this);

            if (result != (int)SdlFlag.Success)
            {
                throw SdlException.Generate();
            }
        }
Exemple #14
0
 /// <summary>
 /// Draw filled primitive onto surface
 /// </summary>
 /// <param name="surface">Surface to draw to</param>
 /// <param name="color">Color to fill primitive</param>
 /// <param name="antiAlias">antialias primitive</param>
 /// <param name="fill">fill primitive with color</param>
 public void Draw(Surface surface, System.Drawing.Color color, bool antiAlias, bool fill)
 {
     if (surface == null)
     {
         throw new ArgumentNullException("surface");
     }
     if (fill)
     {
         int result = SdlGfx.filledPolygonRGBA(surface.Handle, this.PositionsX(), this.PositionsY(), this.NumberOfSides, color.R, color.G, color.G,
                                               color.A);
         GC.KeepAlive(this);
         if (result != (int)SdlFlag.Success)
         {
             throw SdlException.Generate();
         }
     }
     else
     {
         int result = 0;
         if (antiAlias)
         {
             result = SdlGfx.aapolygonRGBA(surface.Handle, this.PositionsX(), this.PositionsY(), this.NumberOfSides, color.R, color.G, color.B,
                                           color.A);
             GC.KeepAlive(this);
         }
         else
         {
             result = SdlGfx.polygonRGBA(surface.Handle, this.PositionsX(), this.PositionsY(), this.NumberOfSides, color.R, color.G, color.B,
                                         color.A);
             GC.KeepAlive(this);
         }
         if (result != (int)SdlFlag.Success)
         {
             throw SdlException.Generate();
         }
     }
 }
Exemple #15
0
        static void Draw_HUD()
        {
            SdlGfx.rectangleColor(screen, 5, 533, 270, (short)(windowSizeY * 0.992), Color.White.ToArgb());
            SdlGfx.rectangleColor(screen, 270, 533, 895, (short)(windowSizeY * 0.992), Color.White.ToArgb());

            #region Stat Box
            Color  foodLevelColor = Color.White;
            string foodLevelWord  = "Full";
            if (CurrentLevel.creatures[0].food > 15000)
            {
                foodLevelColor = Color.Cyan;
                foodLevelWord  = "Overstuffed";
            }
            if (CurrentLevel.creatures[0].food < 10000)
            {
                foodLevelColor = Color.LightGreen;
                foodLevelWord  = "Hungry";
            }
            if (CurrentLevel.creatures[0].food < 5000)
            {
                foodLevelColor = Color.Yellow;
                foodLevelWord  = "Famished";
            }
            if (CurrentLevel.creatures[0].food < 2500)
            {
                foodLevelColor = Color.Crimson;
                foodLevelWord  = "Starving";
            }
            if (CurrentLevel.creatures[0].food < 0)
            {
                foodLevelColor = Color.Gray;
                foodLevelWord  = "Organ Failure";
            }

            Color injuryColor = Color.White;

            if (CurrentLevel.creatures[0].hp >= CurrentLevel.creatures[0].hpMax)
            {
                injuryColor = Color.White;
            }
            else if (CurrentLevel.creatures[0].hp > CurrentLevel.creatures[0].hpMax * 0.75)
            {
                injuryColor = Color.LightCyan;
            }
            else if (CurrentLevel.creatures[0].hp > CurrentLevel.creatures[0].hpMax * 0.5)
            {
                injuryColor = Color.Green;
            }
            else if (CurrentLevel.creatures[0].hp > CurrentLevel.creatures[0].hpMax * 0.25)
            {
                injuryColor = Color.Yellow;
            }
            else if (CurrentLevel.creatures[0].hp > CurrentLevel.creatures[0].hpMax * 0.0)
            {
                injuryColor = Color.FromArgb(255, 50, 50);
            }
            else if (CurrentLevel.creatures[0].hp <= 0)
            {
                injuryColor = Color.Gray;
            }

            int displayTurn = (int)totalTurnCount;

            DrawText(veraSmall, "Turn: " + displayTurn.ToString(),
                     new Point2D(10, 535), Color.White); //Write turn count

            DrawText(veraSmall, "HP: " + CurrentLevel.creatures[0].hp + "/" + CurrentLevel.creatures[0].hpMax,
                     new Point2D(175, 535), injuryColor); //Write turn count

            DrawText(veraSmall, "XP: " + CurrentLevel.creatures[0].xp + "/" + CurrentLevel.creatures[0].xpBorder * 2,
                     new Point2D(175, 550), Color.White); //Write turn count

            DrawText(veraSmall, "GP: " + CurrentLevel.creatures[0].gold,
                     new Point2D(175, 565), Color.White); //Write turn count

            DrawText(veraSmall, "Area: (" + mapPos.X + ", " + mapPos.Y + ", " + mapPos.Z + ")",
                     new Point2D(10, 550), Color.White);

            DrawText(veraSmall, "Hunger: ", new Point2D(10, 610),
                     Color.White);
            DrawText(veraSmall, foodLevelWord, new Point2D(110, 610), foodLevelColor);

            DrawText(veraSmall, "STR: " + CurrentLevel.creatures[0].strength +
                     " DEX: " + CurrentLevel.creatures[0].dexterity +
                     " CON: " + CurrentLevel.creatures[0].constitution +
                     " INT: " + CurrentLevel.creatures[0].intelligence +
                     " WIS: " + CurrentLevel.creatures[0].wisdom +
                     " CHA: " + CurrentLevel.creatures[0].charisma, new Point2D(10, 730));
            #endregion

            #region Message Box
            int            m        = 520;
            Queue <string> messages = new Queue <string>();
            foreach (string message in CurrentLevel.creatures[0].message)
            {
                if (messages.Count >= 14)
                {
                    messages.Dequeue(); //Don't let there be more than fourteen in the queue
                }

                messages.Enqueue(message);
            }

            foreach (string message in messages.Reverse()) //Display newest first
            {
                m += 15;                                   //Skip down 15 pixels
                DrawText(veraSmall, message, new Point2D(280, m), Color.White);
            }

            messages.Clear();
            #endregion
        }
Exemple #16
0
        static void Draw_GetPos()
        {
            Draw_Main();
            SdlGfx.boxColor(screen, 5, 533, 895, (short)(windowSizeY * 0.992), Color.Black.ToArgb());
            SdlGfx.rectangleColor(screen, 5, 533, 895, (short)(windowSizeY * 0.992), Color.White.ToArgb());

            DrawImage(88, new Point2D(cursorPos.X * TILEWIDTH, cursorPos.Y * TILEHEIGHT), Color.Yellow); //Draw Cursor

            #region Description
            int            m        = 535;
            Queue <string> messages = new Queue <string>();
            Tile           thisTile = CurrentLevel.tileArray[cursorPos.X, cursorPos.Y];

            if (CurrentLevel.LineOfSight(CurrentLevel.creatures[0].pos, cursorPos)) //If it can be seen
            {
                foreach (Creature c in CurrentLevel.creatures)
                {
                    if (c.pos == cursorPos) //If creature is at this position
                    {
                        messages.Enqueue("There is a " + c.name + " here.");
                    }
                }

                if (thisTile.itemList.Count > 0)
                {
                    messages.Enqueue("There is a " + thisTile.itemList[0].name + " here.");
                }

                if (thisTile.fixtureLibrary.Count > 0)
                {
                    if (thisTile.fixtureLibrary[0] is Trap)
                    {
                        Trap t = (Trap)thisTile.fixtureLibrary[0];
                        if (t.visible)
                        {
                            messages.Enqueue("There is a " + thisTile.fixtureLibrary[0].type + " here.");
                        }
                    }
                    else
                    {
                        messages.Enqueue("There is a " + thisTile.fixtureLibrary[0].type + " here.");
                    }
                }

                if (thisTile.isWall)
                {
                    messages.Enqueue("This is a " + thisTile.material.name + " wall.");
                }
            }
            else
            {
                messages.Enqueue("You cannot see to there at the moment");
            }

            while (messages.Count >= 14)
            {
                messages.Dequeue(); //Don't let there be more than fourteen in the queue
            }

            if (messages.Count <= 0)
            {
                messages.Enqueue("There is nothing noteworthy here.");
            }

            foreach (string message in messages.Reverse())
            {
                m -= 15; //Skip up 15 pixels
                DrawText(veraSmall, message, new Point2D(10, m), Color.White);
            }

            messages.Clear();
            #endregion
        }
Exemple #17
0
        static void Draw_Health()
        {
            Draw_Main();
            SdlGfx.boxColor(screen, (short)(windowSizeX * 0.66), 0, (short)windowSizeX, (short)windowSizeY,
                            Color.FromArgb(1, 1, 1, 255).ToArgb()); //Black backdrop
            SdlGfx.rectangleColor(screen, (short)(windowSizeX * 0.66), 0, (short)windowSizeX, (short)windowSizeY,
                                  Color.White.ToArgb());            //White border

            DrawText(vera, "Status Menu", new Point2D(690, 20), Color.White);
            DrawText(veraSmall, "Cancel: Space", new Point2D(605, windowSizeY - 20), Color.White);

            #region List parts
            int            partCount  = CurrentLevel.creatures[0].anatomy.Count;
            int            m          = 60;
            Queue <string> parts      = new Queue <string>();
            Queue <Color>  partDamage = new Queue <Color>();

            foreach (BodyPart part in CurrentLevel.creatures[0].anatomy)
            {
                if (parts.Count >= 24)
                {
                    parts.Dequeue(); //Don't let there be more than 24 in the queue
                    partDamage.Dequeue();
                }

                parts.Enqueue(CapitalizeFirst(part.Name));

                switch (part.Injury)
                {
                case InjuryLevel.Healthy:
                    partDamage.Enqueue(Color.White);
                    break;

                case InjuryLevel.Minor:
                    partDamage.Enqueue(Color.Green);
                    break;

                case InjuryLevel.Broken:
                    partDamage.Enqueue(Color.Yellow);
                    break;

                case InjuryLevel.Mangled:
                    partDamage.Enqueue(Color.Crimson);
                    break;

                case InjuryLevel.Destroyed:
                    partDamage.Enqueue(Color.Gray);
                    break;

                default:
                    throw new Exception($"Unhandled InjuryType '${part.Injury.ToString()}' when displaying body parts");
                }
            }

            partCount = parts.Count;
            for (int c = 1; c <= partCount; c++)
            {
                m += 15; //Skip down 15 pixels
                DrawText(veraSmall, parts.Dequeue(),
                         new Point2D(650, m), partDamage.Dequeue());
            }

            parts.Clear();
            #endregion
        }
Exemple #18
0
        static void Draw_Inventory()
        {
            Draw_Main();                                            //Need the background
            SdlGfx.boxColor(screen, (short)(windowSizeX * 0.66), 0, (short)windowSizeX, (short)windowSizeY,
                            Color.FromArgb(1, 1, 1, 255).ToArgb()); //Black backdrop
            SdlGfx.rectangleColor(screen, (short)(windowSizeX * 0.66), 0, (short)windowSizeX, (short)windowSizeY,
                                  Color.White.ToArgb());            //White border
            DrawText(vera, "Inventory Menu", new Point2D(690, 20), Color.White);
            DrawText(veraSmall, "Cancel: Space", new Point2D(605, windowSizeY - 20), Color.White);

            #region List items
            if (inventorySelect == 0) //If none selected
            {
                int            m     = 60;
                Queue <string> items = new Queue <string>();
                foreach (Item item in CurrentLevel.creatures[0].inventory)
                {
                    if (items.Count >= 26)
                    {
                        items.Dequeue(); //Don't let there be more than 26 in the queue
                    }

                    items.Enqueue(CapitalizeFirst(item.name));
                }

                int count = items.Count;
                for (int c = 1; c <= count; c++)
                {
                    m += 15; //Skip down 15 pixels

                    #region Get item letter
                    string s = "a";
                    if (c == 2)
                    {
                        s = "b";
                    }
                    if (c == 3)
                    {
                        s = "c";
                    }
                    if (c == 4)
                    {
                        s = "d";
                    }
                    if (c == 5)
                    {
                        s = "e";
                    }
                    if (c == 6)
                    {
                        s = "f";
                    }
                    if (c == 7)
                    {
                        s = "g";
                    }
                    if (c == 8)
                    {
                        s = "h";
                    }
                    if (c == 9)
                    {
                        s = "i";
                    }
                    if (c == 10)
                    {
                        s = "j";
                    }
                    if (c == 11)
                    {
                        s = "k";
                    }
                    if (c == 12)
                    {
                        s = "l";
                    }
                    if (c == 13)
                    {
                        s = "m";
                    }
                    if (c == 14)
                    {
                        s = "n";
                    }
                    if (c == 15)
                    {
                        s = "o";
                    }
                    if (c == 16)
                    {
                        s = "p";
                    }
                    if (c == 17)
                    {
                        s = "q";
                    }
                    if (c == 18)
                    {
                        s = "r";
                    }
                    if (c == 19)
                    {
                        s = "s";
                    }
                    if (c == 20)
                    {
                        s = "t";
                    }
                    if (c == 21)
                    {
                        s = "u";
                    }
                    if (c == 22)
                    {
                        s = "v";
                    }
                    if (c == 23)
                    {
                        s = "w";
                    }
                    if (c == 24)
                    {
                        s = "x";
                    }
                    if (c == 25)
                    {
                        s = "y";
                    }
                    if (c == 26)
                    {
                        s = "z";
                    }
                    #endregion

                    DrawText(veraSmall, s + ": " + items.Dequeue(),
                             new Point2D(650, m), Color.White);
                }

                items.Clear();
            }
            #endregion
            else if (inventorySelect <= CurrentLevel.creatures[0].inventory.Count) //If the item exists
            {
                if (inventoryMode == 0)
                {
                    DrawText(veraSmall, CapitalizeFirst(CurrentLevel.creatures[0].inventory[
                                                            inventorySelect - 1].name), new Point2D(650, 75), Color.White); //Draw selected item's name

                    DrawText(veraSmall, " - [b]reak down", new Point2D(650, 90), Color.White);
                    DrawText(veraSmall, " - [c]ombine craft", new Point2D(650, 105), Color.White);
                    DrawText(veraSmall, " - [d]rop", new Point2D(650, 120), Color.White);
                    DrawText(veraSmall, " - [e]at", new Point2D(650, 135), Color.White);
                    DrawText(veraSmall, " - [f]ire/throw", new Point2D(650, 150), Color.White);
                    DrawText(veraSmall, " - [u]se", new Point2D(650, 165), Color.White);
                    DrawText(veraSmall, " - [w]ield", new Point2D(650, 180), Color.White);
                    DrawText(veraSmall, " - [W]ear", new Point2D(650, 195), Color.White);
                }
                else if (inventoryMode == 1) //Craft this item menu
                {
                    int            m     = 60;
                    Queue <string> items = new Queue <string>();
                    foreach (Item item in craftableItems)
                    {
                        if (items.Count >= 24)
                        {
                            items.Dequeue(); //Don't let there be more than 24 in the queue
                        }

                        items.Enqueue(CapitalizeFirst(item.name));
                    }

                    int count = items.Count;
                    if (count <= 0)
                    {
                        DrawText(veraSmall, "Nothing occurs to you, given what you have.",
                                 new Point2D(650, 75), Color.White);
                    }

                    for (int c = 1; c <= count; c++)
                    {
                        m += 15; //Skip down 15 pixels

                        #region Get item letter
                        string s = "a";
                        if (c == 2)
                        {
                            s = "b";
                        }
                        if (c == 3)
                        {
                            s = "c";
                        }
                        if (c == 4)
                        {
                            s = "d";
                        }
                        if (c == 5)
                        {
                            s = "e";
                        }
                        if (c == 6)
                        {
                            s = "f";
                        }
                        if (c == 7)
                        {
                            s = "g";
                        }
                        if (c == 8)
                        {
                            s = "h";
                        }
                        if (c == 9)
                        {
                            s = "i";
                        }
                        if (c == 10)
                        {
                            s = "j";
                        }
                        if (c == 11)
                        {
                            s = "k";
                        }
                        if (c == 12)
                        {
                            s = "l";
                        }
                        if (c == 13)
                        {
                            s = "m";
                        }
                        if (c == 14)
                        {
                            s = "n";
                        }
                        if (c == 15)
                        {
                            s = "o";
                        }
                        if (c == 16)
                        {
                            s = "p";
                        }
                        if (c == 17)
                        {
                            s = "q";
                        }
                        if (c == 18)
                        {
                            s = "r";
                        }
                        if (c == 19)
                        {
                            s = "s";
                        }
                        if (c == 20)
                        {
                            s = "t";
                        }
                        if (c == 21)
                        {
                            s = "u";
                        }
                        if (c == 22)
                        {
                            s = "v";
                        }
                        if (c == 23)
                        {
                            s = "w";
                        }
                        if (c == 24)
                        {
                            s = "x";
                        }
                        if (c == 25)
                        {
                            s = "y";
                        }
                        if (c == 26)
                        {
                            s = "z";
                        }
                        #endregion

                        DrawText(veraSmall, s + ": " + items.Dequeue(),
                                 new Point2D(650, m), Color.White);
                    }
                    items.Clear();
                }
            }
        }
Exemple #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="col"></param>
 public void SetPixel(int x, int y, Color col)
 {
     SdlGfx.pixelRGBA(this.surfacePtrs[0], (short)x, (short)y, col.R, col.G, col.B, 255);
 }
Exemple #20
0
        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="dstPos"></param>
        ///// <param name="source"></param>
        ///// <param name="fill"></param>
        //public void bltShape(Point dstPos, Surface source, Color fill)
        //{
        //    bltShape(dstPos, source, new Point(0, 0), source.Size, fill);
        //}

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public Surface CreateFlippedVerticalSurface()
        {
            return(new Surface(SdlGfx.rotozoomSurfaceXY(this.SurfacePtr(), 0, 1, -1, SdlGfx.SMOOTHING_OFF)));
        }
Exemple #21
0
 public static void DrawSquare(short x, short y, short x2, short y2, byte r, byte g,
                               byte b, byte alpha)
 {
     SdlGfx.rectangleRGBA(screen, x, y, x2, y2, r, g, b, alpha);
     Hardware.UpdateScreen();
 }
Exemple #22
0
 public void DrawRectangle(short x1, short y1, short x2, short y2, short x3, short y3, short x4, short y4, byte r, byte g, byte b, byte alpha)
 {
     short[] vx = { x1, x3, x4, x2 };
     short[] vy = { y1, y3, y4, y2 };
     SdlGfx.filledPolygonRGBA(screen, vx, vy, vx.Length, r, g, b, alpha);
 }
Exemple #23
0
        static void DoFrame()
        {
            sw.Start();

            bool hit = false;

            Voxlap.lpoint3d loc;
            Color           voxcolor;

            Voxlap.Face face;
            int         x, y;

            Voxlap.ClearRect(p1, p2);
            Voxlap.SetRectWithWoodTexture(p1, p2, Color.BurlyWood);
            if (Voxlap.Hitscan(or.ipo, or.ifo, out loc, out voxcolor, out face) == Voxlap.HitStatus.Hit)
            {
                double xdist = or.ipo.x - loc.x;
                double ydist = or.ipo.y - loc.y;
                double zdist = or.ipo.z - loc.z;
                double dist  = Math.Sqrt(xdist * xdist + ydist * ydist + zdist * zdist);
                if (dist < 40)
                {
                    p1 = new Voxlap.lpoint3d()
                    {
                        x = loc.x & 0x7ffffff8, y = loc.y & 0x7ffffff8, z = loc.z & 0x7ffffff8
                    };
                    p2 = new Voxlap.lpoint3d()
                    {
                        x = p1.x + 7, y = p1.y + 7, z = p1.z + 7
                    };
                    Voxlap.ClearRect(p1, p2);

                    Voxlap.SetRectWithWoodTexture(p1, p2, Color.BurlyWood, 200);
                }
                hit = true;
            }
            Voxlap.UpdateVxl();


            Sdl.SDL_LockSurface(g_pDisplaySurface);


            Voxlap.SetFrameBuffer(g_DisplaySurface.pixels, g_DisplaySurface.pitch, g_DisplaySurface.w, g_DisplaySurface.h);
            Voxlap.SetCamera(
                or.ipo,
                or.ist,
                or.ihe,
                or.ifo,
                g_DisplaySurface.w * .5f,
                g_DisplaySurface.h * .5f,
                g_DisplaySurface.w * .5f);
            Voxlap.Opticast();

            sw.Stop();


            Voxlap.Print(10, 10, Color.White, Color.Transparent, "x={0} y={1} z={2}", or.ipo.x, or.ipo.y, or.ipo.z);
            Voxlap.Print(10, 20, Color.White, Color.Transparent, "{0} fps", sw.ElapsedMilliseconds == 0 ? "Infinity" : (1000 / sw.ElapsedMilliseconds).ToString());
            if (hit)
            {
                Voxlap.Print(10, 30, Color.White, Color.Transparent, "HIT x={0} y={1} z={2} face={3}", loc.x, loc.y, loc.z, face);
            }
            sw.Reset();

            Sdl.SDL_UnlockSurface(g_pDisplaySurface);

            SdlGfx.lineColor(g_pDisplaySurface, SCREEN_WIDTH / 2 - 10, SCREEN_HEIGHT / 2, SCREEN_WIDTH / 2 + 10, SCREEN_HEIGHT / 2, -1);
            SdlGfx.lineColor(g_pDisplaySurface, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 10, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 + 10, -1);
        }
Exemple #24
0
 // Writes a line in the specified coordinates, with the specified color and alpha
 public void DrawLine(short x, short y, short x2, short y2, byte r, byte g, byte b, byte alpha)
 {
     SdlGfx.lineRGBA(screen, x, y, x2, y2, r, g, b, alpha);
 }
Exemple #25
0
 public static void RectanguloRellenoRGBA(short x1, short y1, short x2, short y2,
                                          byte r, byte g, byte b, byte a)
 {
     SdlGfx.boxRGBA(pantallaOculta,
                    x1, y1, x2, y2, r, g, b, a);
 }