int main() { srand(time(0)); terrain* map = new terrain; genMap(map); RiverGen gen = RiverGen(map, MAP_WIDTH, MAP_HEIGHT); gen.edge_fill_oceans(); gen.find_peaks(); gen.find_water_sources(); gen.river_alg(); int out = 1; do{ if (out == REGEN_MAP){ genMap( map); gen = RiverGen(map, MAP_WIDTH, MAP_HEIGHT); gen.edge_fill_oceans(); } out = graphicsLoop(map); } while (out == 2); delete[] map->features; delete map; map = nullptr; return 0; }
// Main Function int main() { // Initialize NCurses initscr(); // Prevent NCurses from displaying keyboard input noecho(); // Allow color tiles and Characters start_color(); init_pair(1, COLOR_RED, COLOR_BLACK); init_pair(2, COLOR_BLACK, COLOR_GREEN); init_pair(3, COLOR_BLUE, COLOR_BLUE); // Hide the terminal cursor curs_set(0); // Allow the use of arrow keys on Mac OS X keypad(stdscr, TRUE); // Initializes random number generator time_t t; srand((unsigned) time(&t)); // Generate the map genMap(); // Initial draw/refresh before the game enters the main loop draw(); refresh(); // The main loop of the game (should be moved to its own function) input(); // Close NCurses endwin(); // Close Program return 0; }