public static void fillRect(this TCODConsole console, int x, int y, int w, int h, char c) { for (int i = 0; i < h; ++i) { console.hline(x, y + i, w, c); } }
public void Draw() { int lightLenght = (int)((1 - _player.Light.Used) * 80); _root.setBackgroundColor(TCODColor.black); _root.setForegroundColor(TCODColor.white); Map.Draw(_mapConsole); _messages.Draw(); TCODConsole.blit(_mapConsole, 0, 0, 80, 50, _root, 0, 1); TCODConsole.blit(_messages.Console, 0, 0, 80, 10, _root, 0, 51); _root.hline(0, 0, 80, TCODBackgroundFlag.Set); _root.setBackgroundColor(TCODColor.amber); _root.setForegroundColor(TCODColor.amber); _root.hline(0, 0, lightLenght, TCODBackgroundFlag.Set); TCODConsole.flush(); }
public override void DrawNewFrame(TCODConsole screen) { if (m_enabled) { screen.printFrame(SelectedItemOffsetX, SelectedItemOffsetY, SelectedItemWidth, SelectedItemHeight, true); // Draw Header. screen.hline(SelectedItemOffsetX + 1, SelectedItemOffsetY + 2, SelectedItemWidth - 2); screen.putChar(SelectedItemOffsetX, SelectedItemOffsetY + 2, (int)TCODSpecialCharacter.TeeEast); screen.putChar(SelectedItemOffsetX + SelectedItemWidth - 1, SelectedItemOffsetY + 2, (int)TCODSpecialCharacter.TeeWest); screen.printEx(SelectedItemOffsetX + (SelectedItemWidth / 2), SelectedItemOffsetY + 1, TCODBackgroundFlag.Set, TCODAlignment.CenterAlignment, m_selectedItem.DisplayName); // Split in half for description. screen.vline(SelectedItemOffsetX + (SelectedItemWidth / 3), SelectedItemOffsetY + 2, SelectedItemHeight - 3); screen.putChar(SelectedItemOffsetX + (SelectedItemWidth / 3), SelectedItemOffsetY + 2, (int)TCODSpecialCharacter.TeeSouth); screen.putChar(SelectedItemOffsetX + (SelectedItemWidth / 3), SelectedItemOffsetY + SelectedItemHeight - 1, (int)TCODSpecialCharacter.TeeNorth); DrawItemInRightPane(screen); m_dialogColorHelper.SaveColors(screen); // Print option list. for (int i = 0; i < m_optionList.Count; ++i) { m_dialogColorHelper.SetColors(screen, i == m_cursorPosition, m_optionList[i].Enabled); screen.print(SelectedItemOffsetX + 2, SelectedItemOffsetY + 4 + (i * 2), m_optionList[i].Option); } m_dialogColorHelper.ResetColors(screen); } }
public void RenderInventory(TCODConsole con, int con_x, int con_y, int width, int height) { con.setForegroundColor(TCODColor.darkAzure); con.setBackgroundColor(TCODColor.darkestBlue); con.setBackgroundFlag(TCODBackgroundFlag.Set); con.printFrame(con_x + 1, con_y + 1, width - 2, height - 2); con.setBackgroundFlag(TCODBackgroundFlag.Default); con.vline(width / 2, con_y + 2 + 5, height - 4 - 5); con.hline(con_x + 2, con_y + 1 + 5, width - 4); con.print(con_x + 2, con_y + 2, "GRZ64 INTEGRATED BACKPACK INTERFACE V1.14 REV 1984"); con.print(con_x + 2, con_y + 3, "UNREGISTERED TRIAL VERSION"); con.print(con_x + 2, con_y + 5, "LOADING INVENTORY DATA..."); if (player.Inventory.Count > 0) { int cap = (height - 5) - (con_y + 7); int count = player.Inventory.Count; if (menu_selection >= count) menu_selection = (menu_selection - count); if (menu_selection < 0) menu_selection = count - 1; int top = menu_selection > cap ? (menu_selection - cap) : 0; int bottom = top + count > cap ? cap : top + count; int it = 0; List<Item> item_list = player.Inventory.GetItemList(); Item sel_item = item_list[menu_selection]; //Item list for (int i = top; i < bottom; i++) { con.setBackgroundFlag(TCODBackgroundFlag.Default); if (i == menu_selection) { //con.setBackgroundFlag(TCODBackgroundFlag.Set); //con.setBackgroundColor(TCODColor.azure); con.setForegroundColor(TCODColor.azure); } if (i == menu_selection + 1) { con.setForegroundColor(TCODColor.darkAzure); } if (item_list[i].GetType().IsSubclassOf(typeof(EquippableItem))) { EquippableItem ei = (EquippableItem)item_list[i]; if (ei.IsEquipped()) { con.setBackgroundFlag(TCODBackgroundFlag.Set); con.setBackgroundColor(TCODColor.lightAzure); } } con.print(con_x + 3, con_y + 7 + it, item_list[i].Name); it++; } con.setBackgroundFlag(TCODBackgroundFlag.Default); con.setForegroundColor(TCODColor.darkAzure); int left_offset = width / 2 + 1; int top_offset = con_y + 7; //Item stats con.print(left_offset, top_offset + 0, "NAME : " + sel_item.Name); con.print(left_offset, top_offset + 1, "WEIGHT : " + sel_item.Weight); // type specifics if (sel_item.GetType() == typeof(Firearm)) { Firearm f = (Firearm)sel_item; con.print(left_offset, top_offset + 3, "TYPE : Firearm"); con.print(left_offset, top_offset + 5, "CLASS : " + f.type.ToString()); String fm_str = ""; foreach (FireMode fm in f.modes) { fm_str += fm.ToString() + " "; } con.print(left_offset, top_offset + 6, "FIREMODES : " + fm_str); con.print(left_offset, top_offset + 8, "CALIBER : " + f.caliber.ToString()); con.print(left_offset, top_offset + 9, "MAG. CAPACITY: " + f.MagazineCapacity); } //Item description List<String> lines = wrap(sel_item.Description, width / 2 - 2); top_offset = con_y + (int)(height * 0.45d); for (int j = 0; j < lines.Count; j++) { con.print(left_offset, top_offset + j, lines[j]); } con.hline(left_offset, top_offset - 1, width / 2 - 2); //Item actions con.hline(width / 2 + 1, height - 4 - 5, width / 2 - 2); //con.print(width / 2 + 2, height - 4 - 4, "R/M/T - Equip Rngd/Mlee/Thrwn"); //con.print(width / 2 + 2, height - 4 - 3, " E/L - Equip Armor/Lightsrc"); con.print(width / 2 + 2, height - 4 - 4, " E - Equip"); con.print(width / 2 + 2, height - 4 - 3, " U - Unequip"); con.print(width / 2 + 2, height - 4 - 2, " D - Drop Item"); con.print(width / 2 + 2, height - 4 - 1, " Q - Quit"); con.print(width / 2 + 2, height - 4 + 0, " +,- - Select"); con.print(width / 2 + 2, height - 4 + 1, " C - Consume"); con.print(width / 2 + 2, height - 4 + 2, " U - Use"); } }
private void DrawTabBar(TCODConsole screen) { const int HorizontalTabOffset = 2; screen.rect(UpperLeft + 1, UpperLeft + 1, SkillTreeWidth - 2, HorizontalTabOffset - 1, true); screen.putChar(UpperLeft, UpperLeft + HorizontalTabOffset, (int)TCODSpecialCharacter.TeeEast); screen.putChar(UpperLeft + SkillTreeWidth - 1, UpperLeft + HorizontalTabOffset, (int)TCODSpecialCharacter.TeeWest); screen.hline(UpperLeft + 1, UpperLeft + HorizontalTabOffset, SkillTreeWidth - 2); int x = UpperLeft + 2; int y = UpperLeft + HorizontalTabOffset - 1; foreach (string name in m_skillTreeTabs.Keys) { int xOffset = name == "Water" ? 1 : 0; screen.print(x + xOffset, y, name); x += name.Length + 1; if (name != "Water") { screen.putChar(x, y, (int)TCODSpecialCharacter.VertLine); // This is a bit of a hack. We don't want to overwrite the color'ed background title of the frame, so we check first // This can break if libtcod changes that background title color if (!screen.getCharBackground(x, y - 1).Equal(new TCODColor(211, 211, 211))) screen.putChar(x, y - 1, (int)TCODSpecialCharacter.TeeSouth); screen.putChar(x, y + 1, (int)TCODSpecialCharacter.TeeNorth); } x += 2; if (m_currentTabName == name) { int lengthReductionToDueTee = name == "Water" ? 0 : 2; for (int i = x - 4 - name.Length; i < x - lengthReductionToDueTee; i++) { screen.setCharBackground(i, y, TCODColor.grey); } } } }
public void DrawHorizontalLine(int x, int y, int length) { _console.hline(x, y, length); }