// Set up and display the main menu public void DisplayMainMenu() { // Setup the logo image TCODImage titleLogoImage = new TCODImage("titlelogo.bmp"); // Blit the image to the background titleLogoImage.blit2x(rootConsole, 0, -1); topOfMenu = 18; PrintMainMenu(); topOfMenu = 25; }
// Display the intro public void DisplayIntro() { int XLoc = 1; foreach (string s in Intro) { DisplayText(s, 1, ++XLoc, TCODColor.white, TCODColor.black, -1); } DisplayText("Press any key to start...", -1, 30, TCODColor.grey, TCODColor.black, -1); // Setup the logo image TCODImage rightMenuImage = new TCODImage("icicle.bmp"); // Blit the image to the background rightMenuImage.blit2x(rootConsole, 63, 2); }
// Set up the title screen public void DisplayTitleScreen() { // Setup the logo image TCODImage titleLogoImage = new TCODImage("titlelogo.bmp"); // Blit the image to the background titleLogoImage.blit2x(rootConsole, 0, -1); // Set up the title text# int yloc = 25; DisplayText("by & (c) Dave Moore ([email protected])", -1, yloc++, TCODColor.white, TCODColor.black, -1); DisplayText("(Version " + Application.ProductVersion.ToString() + ")", -1, yloc++, TCODColor.grey, TCODColor.black, -1); yloc++; DisplayText("for the 2011 7-Day Roguelike Challenge (7DRL) (http://7drl.org)", -1, yloc++, TCODColor.silver, TCODColor.black, -1); yloc++; DisplayText("Released under the GNU Public License (GPL) v2", -1, yloc++, TCODColor.grey, TCODColor.black, -1); DisplayText("Powered by Libtcod 1.5", -1, yloc++, TCODColor.grey, TCODColor.black, -1); yloc++; DisplayText("Press any key to continue...", -1, yloc, TCODColor.white, TCODColor.black, -1); }
public MenuCode pick() { TCODImage img = new TCODImage("assets/menu_background.png"); int selected = 0; while (!TCODConsole.isWindowClosed()) { img.blit2x(TCODConsole.root, 0, 0); int current = 0; foreach (MenuItem item in items) { if (current == selected) { TCODConsole.root.setForegroundColor(TCODColor.lighterOrange); } else { TCODConsole.root.setForegroundColor(TCODColor.lightGrey); } TCODConsole.root.print(10, 10 + current * 3, item.label); current++; } TCODConsole.flush(); TCODKey key = TCODConsole.checkForKeypress(); switch (key.KeyCode) { case TCODKeyCode.Up: selected--; if (selected < 0) { selected = items.Count - 1; } break; case TCODKeyCode.Down: selected = (selected + 1) % items.Count; break; case TCODKeyCode.Enter: return items[selected].code; default: break; } } return 0; }