예제 #1
0
        public void rectangleColor()
        {
            this.InitSdl();

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

            result = Sdl.SDL_Flip(surfacePtr);
            Thread.Sleep(sleepTime);
            Assert.AreEqual(result, 0);
            this.Quit();
        }
예제 #2
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
        }
예제 #3
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
        }
예제 #4
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
        }
예제 #5
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();
                }
            }
        }