public void boxColor() { this.InitSdl(); //Random rand = new Random(); int result = SdlGfx.boxColor(surfacePtr, 100, 200, 300, 300, 7777777); result = Sdl.SDL_Flip(surfacePtr); Thread.Sleep(sleepTime); Assert.AreEqual(result, 0); this.Quit(); }
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 }
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 }
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(); } } }