Ejemplo n.º 1
0
int main()
{
	int q;
	srand(time(0));	
	init_ncurses();
	
	new SnakeHead(Snake_map);
	
	erase();
	Snake_map.display();
	q = getch();
	
	int Game_over = 1;
	while (Game_over)
	{
		q = -1;
		erase();
		Snake_map.display();
		printw("%d\n", Snake_map.cnt_food());
		halfdelay(1);
		q = getch();
		Game_over = next_move(q);
		usleep(40000);
	}
	erase();
	printw("YOU LOOSE!\nYour score: %d\n\n\nPlease ENTER!\n", Snake_map.cnt_food());
	nocbreak();
	getch();
	endwin();
	return 0;
}
Ejemplo n.º 2
0
void *ncurses_display(void *p)
{
	unsigned int current_display_index = 0;

	sem_wait(&bootstrap);
	/*
	 * Prevent the 1 second delay when we hit ESC
	 */
	ESCDELAY = 0;
	init_ncurses();

	while (1) {
		sem_wait(&timer);
		sem_wait(&goodtodisplay);
		sem_wait(&pause_sem);

		if (quit) {
			sem_post(&pause_sem);
			sem_post(&timer);
			reset_ncurses();
			pthread_exit(0);
		}

		copy = g_ptr_array_index(copies, current_display_index);
		assert(copy);
		display(current_display_index++);

		sem_post(&goodtoupdate);
		sem_post(&pause_sem);
	}
}
Ejemplo n.º 3
0
int main(int argc, char **args)
{
  // ncurses for unicode support
  setlocale(LC_ALL, "");

  // ncurses basic setting
  init_ncurses();

  dynamic_initial();
  
  /** main loop for keyboard hit daemon */
  for(;;)
	{
	  being_mode->listen_keyboard();

	  if(quit_signal) break;

	  screen_update_checking();
	  wchain_size_update();
	  screen_redraw();

	  smart_sleep();
	}

  dynamic_destroy();

  endwin();

  return 0;
}
Ejemplo n.º 4
0
struct state_t* player_init(
  int map_height,
  int map_width,
  const square *map,
  const struct program_t *prg)
{
  struct state_t* state = new struct state_t;
  init_ncurses();
  getmaxyx(stdscr, state->map_height, state->map_width);
  if ((state->map_height < max(map_height, 7)) || (state->map_width < map_width * 2 + 12 + 2))
  {
    delete state;
    return NULL;
  }
  state->map = map;
  state->prg = prg;
  state->pc = 0;
  state->coord.x = 0;
  state->coord.y = 0;
  state->dir = N;
  state->map_height = map_height;
  state->map_width = map_width;
  state->cmd_window = newwin(7, 12, 0, map_width * 2 + 2);
  state->map_window = newwin(map_height, map_width * 2, 0, 0);
  arrows[0] = ACS_DARROW; arrows[1] = ACS_RARROW;
  arrows[2] = ACS_UARROW; arrows[3] = ACS_LARROW;
  refresh();
  draw_program(state);
  draw_map(state);
  return state;
}
Ejemplo n.º 5
0
int					main(int argc, char **argv)
{
	t_core		c;
	int			ret;

	if (argc == 1)
		usage();
	ft_bzero(&c, sizeof(c));
	parse_options(&c, argc, argv);
	if (load_champions(&c) < 0)
		return (1);
	if ((c.options & OPT_C) && (init_ncurses(&c) < 0))
	{
		ft_error("ncurse failed to initialize\n");
		return (3);
	}
	if ((ret = init_memory(&c)) < 0)
	{
		if (c.options & OPT_C)
			endwin();
		print_error("corewar: ", ret);
		return (1);
	}
	cycles_execution(&c);
	if (c.options & OPT_C)
		endwin();
	return (0);
}
Ejemplo n.º 6
0
int main() {
  init_ncurses();

  run_game();

  endwin();
}
Ejemplo n.º 7
0
int main(int argc, char *argv[]) {


    init_ncurses();
    refresh();

    for (int i=0; i<NPILAS; i++)
      win[i] = create_newwin(H, W, 1, 1 + i * W);

    for (int i=0; i<NPILAS; i++)
	p[i] = create_stack(N);

    /* Inicializar */
    for (int i=N-1; i>=0; i--)
	push(i+1, p[0]);

    traslada(N, 0, 2);
   
    for (int i=0; i<NPILAS; i++)
	destroy_stack(p[i]);

    for (int i=0; i<NPILAS; i++)
	destroy_win(win[i]);
    end_ncurses();

    return EXIT_SUCCESS;
}
Ejemplo n.º 8
0
int		main(int argc, char **argv)
{
  if (argc != 2)
    help();
  init_ncurses();
  largeur(argv[1]);
  return (0);
}
Ejemplo n.º 9
0
table::table(int row, int col, int cell_width, int cell_height)
{
    init_ncurses();

    m_row = row;
    m_colomn = col;
    m_CW = cell_width;
    m_CH = cell_height;
    m_table.clear();
}
Ejemplo n.º 10
0
int main(int argc, char **argv)
{
	init_ncurses();
	
	print_center("Welcome to Static Movement Router", 5);
	
	sleep(1);
	
	endwin();
	
	return 0;
}
Ejemplo n.º 11
0
void		init(t_core *core)
{
	signal(SIGINT, interupt_handler);
	core->board_size_x = 4;
	core->board_size_y = 4;
	core->width = 0;
	core->height = 0;
	core->winit = 0;
	core->end_game = 0;
	get_victory_condition(core);
	init_ncurses(core);
}
Ejemplo n.º 12
0
int main(int argc, char **argv)
{
	init_ncurses();
	init_connection();
	init_signalhandler();
	pthread_t rec, in;
	if(pthread_create(&rec, NULL, &client_receiver, NULL))
		error("pthread_create");
	pthread_create(&in, NULL, &client_input, NULL);
	pthread_join(rec, NULL);
	pthread_join(in, NULL);
	endwin();
}
void execute_loop(chip_8_cpu cpu, FILE *debug_log) {
    if (pthread_create(&(cpu->delay_decrement_thread), NULL, delay_thread, cpu) != 0) {
        shutdown_cpu(cpu, 1);
    }
    if (pthread_create(&(cpu->sound_decrement_thread), NULL, sound_thread, cpu) != 0) {
        fprintf(stderr, "Failed to start the sound register thread, exiting...\n");
        shutdown_cpu(cpu, 1);
    }
    pthread_detach(cpu->delay_decrement_thread);
    pthread_detach(cpu->sound_decrement_thread);

    cpu->chip_8_screen = init_ncurses(default_window_height, default_window_width);
    refresh_window(cpu->chip_8_screen);

    while (1) {
        if (cpu->program_counter >= MEMORY_SIZE) {
            fprintf(stderr, "ERR - Fatal memory error: invalid access at memory cell: '%d'\n", cpu->program_counter);
            shutdown_cpu(cpu, 1);
        }
        if (cpu->halt) {
            break;
        }
        opcode instr = fetch_opcode(cpu);
        if (debug_log) {
            print_debug_info(debug_log, instr, cpu);
        }

        execute_opcode(instr, cpu);
        if (cpu->performed_jump) {
            cpu->performed_jump = false;
            continue;
        }

        if (cpu->skip_opcode) {
            cpu->program_counter = cpu->program_counter + 2;
            cpu->skip_opcode = false;
        }
        else {
            cpu->program_counter = cpu->program_counter + 1;
        }
    }

    // allow 0.1 seconds for the threads to clean up their memory
    usleep(100000);
    delwin(cpu->chip_8_screen);
    endwin();
}
int main(int argc, char **argv) {
  init_ncurses();
  run_command (&argv[1]);
  finish_ncurses(0);
  //  summarize (outfp, output_format, command_line, &res);
  //  fflush (outfp);
  //print_infos(&infos);

 // if (WIFSTOPPED (infos.waitstatus))
 // exit (WSTOPSIG (infos.waitstatus) + 128);
 // else if (WIFSIGNALED (infos.waitstatus))
 // exit (WTERMSIG (infos.waitstatus) + 128);
 // else if (WIFEXITED (infos.waitstatus))
 // exit (WEXITSTATUS (infos.waitstatus));
  

}
Ejemplo n.º 15
0
int main(int argc, char *argv) {
	void	*options, *events;
	bool	fullscr = false;
	int	tmp;

	/* parse command line here */
	options = pcline(argc, argv);
	if (options == NULL) {	/* oopthspthspthsie! */
		prinf("\nUnable to allocate memory!\n");
		return 1;
	}

	if (((bool) *options) == true) {	/* we're editing */
		fullscr = init_ncurses();
		/* TODO: Implement non-fullscreen functionality */

		while ((tmp = event_editor(events, fullscr)) != 5) {
		  switch (event_editor(events, fullscr)) {
		    case 1: /* list events */
			list_events(*events);
			break;
		    case 2: /* delete event(s) */
			delete_events(*events);
			break;
		    case 3: /* add event(s) */
			add_events(*events);
			break;
		    case 4: /* edit event */
			ed_event(*events);
			break;
		    case 5: /* exit */
			return 0;
			break;
		    default:
			err("\n\nWTF?\nFell through main loop: %s\n");
		  }
		}
	
	} else if (((bool) *(options + 1)) == true) { /* fork & notify */
		if (notifyd != 0) return 2;
	}

}
Ejemplo n.º 16
0
table::table(int colomn_number, int cell_width, int cell_height)
{
    init_ncurses();

    m_row = 0;
    m_colomn = colomn_number;
    m_CW = cell_width;
    m_CH = cell_height;
    m_table.clear();

    getmaxyx(stdscr,m_maxH,m_maxW);

    m_W0 = m_maxW/2;
    m_H0 = m_maxH/2;

    m_header.w = NULL;
    m_header.X0 = m_header.Y0 = m_header.W = m_header.H = 0;
    m_status.w = NULL;
    m_status.X0 = m_status.Y0 = m_status.W = m_status.H = 0;
}
Ejemplo n.º 17
0
bool Engine::init()
{
	init_ncurses();

	world		=	new World;
	entityM		=	new EntityManager;
	windowM		=	new WindowManager(*world,gameLogStream,debugLogStream);
	physicsCM	=	new PhysicsComponentManager(*world,*entityM);
	visualCM	=	new VisualComponentManager(*world,*entityM);
	lightingCM	=	new LightingComponentManager(*world,*entityM,*physicsCM);
	listenerCM	=	new ListenerComponentManager(*world,*entityM);
	logicCM		=	new LogicComponentManager(*world,*entityM);
	dungeonLoader = new DungeonLoader(*world,*entityM,
									  *physicsCM,*visualCM,
									  *lightingCM,*listenerCM,
									  *logicCM);
	Logic::initialzeDomain(*world,*entityM,
						   *physicsCM,*visualCM,
						   *lightingCM,*listenerCM,
						   *logicCM);
	return (initialized = true);
}
Ejemplo n.º 18
0
Archivo: init.c Proyecto: tmerlier/2048
void				main_init(t_env *env, int *argc, char ***argv)
{
	int					i;

	env->tsize = NULL;
	env->score = 0;
	env->undo = 0;
	env->ascii.ascii_on = 0;
	env->win = 0;
	env->load = 0;
	i = -1;
	while (++i < MAX_SCORE)
	{
		env->scoreboard[i].player = NULL;
		env->scoreboard[i].score = 0;
	}
	init_opt(env, argc, argv);
	load_ascii(env, 2);
	init_ncurses(env);
	init_game(env);
	signal(SIGINT, handle_sigint);
	signal(SIGQUIT, handle_sigint);
}
Ejemplo n.º 19
0
s32 main(void) {

  mffilesystem_setup();
  mflog_setup();
  
  s32 max_x, max_y;
  init_ncurses(&max_x, &max_y);
  mfgame *game = init_game(max_x, max_y);

  mflog("Starting game");
  mfgame_run(game);
  timeout(-1);
  getch();
  getch();
  mflog("Game ended");

  shutdown_ncurses();
  mfgame_delete(game);

  mflog_shutdown();
  mffilesystem_shutdown();
  return 0;
}
Ejemplo n.º 20
0
int main(int argc, char *argv[])
{
	int ch = 0;
	struct timeval tv_last, tv;
	unsigned i;

	atexit(cleanup);
	setup_connections(argc, argv);
	init_ncurses(global.num_clamd, default_colors);

	memset(&tv_last, 0, sizeof(tv_last));
	do {
		if (toupper(ch) == 'H') {
			ch = show_help();
		}
		switch(ch) {
			case KEY_RESIZE:
				resize();
				endwin();
				refresh();
				init_windows(global.num_clamd);
				break;
			case 'R':
			case 'r':
				for (i=0;i<global.num_clamd;i++)
					global.all_stats[i].biggest_queue = 1;
				biggest_mem = 0;
				break;
			case KEY_UP:
				if (global.num_clamd > 1) {
					if (detail_selected == -1)
						detail_selected = global.num_clamd-1;
					else
						--detail_selected;
				}
				break;
			case KEY_DOWN:
				if (global.num_clamd > 1) {
					if (detail_selected == -1)
						detail_selected = 0;
					else {
						if((unsigned)++detail_selected >= global.num_clamd)
							detail_selected = -1;
					}
				}
				break;
		}
		gettimeofday(&tv, NULL);
		header();
		if(tv.tv_sec - tv_last.tv_sec >= MIN_INTERVAL) {
			free_global_stats();
			for(i=0;i<global.num_clamd;i++) {
				unsigned biggest_q;
				struct stats *stats = &global.all_stats[i];
				if (global.conn[i].sd != -1)
					send_string(&global.conn[i], "nSTATS\n");
				biggest_q = stats->biggest_queue;
				memset(stats, 0, sizeof(*stats));
				stats->biggest_queue = biggest_q;
				parse_stats(&global.conn[i], stats, i);
			}
			if (global.tasks)
				qsort(global.tasks, global.n, sizeof(*global.tasks), tasks_compare);
			tv_last = tv;
		}
		/* always show, so that screen resizes take effect instantly*/
		output_all();
		for(i=0;i<global.num_clamd;i++) {
			if (global.conn[i].sd == -1)
				reconnect(&global.conn[i]);
		}
	} while(toupper(ch = getch()) != 'Q');
	free_global_stats();
	normal_exit = 1;
	return 0;
}
Ejemplo n.º 21
0
Archivo: r86.c Proyecto: crgimenes/r86
int main(int argc, char *argv[]) {
    char memory[1024];
    FILE *fp;

    int opt_flag;
    char *filename;
    extern char *optarg;
    extern int optind, optopt, opterr;
    char *file;

    print_asm = 0;
    use_curses = 0;
    cursor_y = 0;
    cursor_y = 0;

    while ((opt_flag = getopt(argc, argv, "acf")) != -1) {
        switch(opt_flag) {
        case 'a':
            print_asm = 1;
            break;
        case 'c':
            use_curses = 1;
            break;
        case 'f':
            filename = optarg;
            printf("filename is %s\n", filename);
            break;
        case ':':
            printf("-%c without filename\n", optopt);
            break;
        case '?':
            printf("unknown option %c\n", optopt);
            break;
        default:
            filename = optarg;
            printf("filename is %s\n", filename);
            break;
        }
    }

    //printf("optind = %i\n",optind);
    if (optind < argc) {
        file = argv[optind];
        //printf("filename is %s\n", file);
    }

    if(argc==1) {
        printf("%s filename.com\r\n",argv[0]);
        exit(1);
    }

    memset(memory, 0, sizeof(memory));
    fp = fopen(file , "rb");
    if(fp == NULL) {
        printf("Error opening file %s",file);
        return(-1);
    }

    size_t size = fsize(fp);

    fread(memory, size, 1, fp);
    fclose(fp);

    init_ncurses();
    run(memory);
    end_ncurses();

    return 0;
}
Ejemplo n.º 22
0
Archivo: i7z.c Proyecto: bobwya/i7z
int main (int argc, char **argv)
{
    atexit(atexit_runsttysane);

    char log_file_name[MAX_FILENAME_LENGTH], log_file_name2[MAX_FILENAME_LENGTH+3];
    prog_options.logging=0; //0=no logging, 1=logging, 2=appending

    struct cpu_hierarchy_info chi;
    struct cpu_socket_info socket_0={.max_cpu=0, .socket_num=0, .processor_num={-1,-1,-1,-1,-1,-1,-1,-1}};
    struct cpu_socket_info socket_1={.max_cpu=0, .socket_num=1, .processor_num={-1,-1,-1,-1,-1,-1,-1,-1}};

    //////////////////// GET ARGUMENTS //////////////////////
    int c;
    //char *cvalue = NULL;
    //static bool logging_val_append=false, logging_val_replace=false;
    bool presupplied_socket_info = false;
	bool only_display_version=false;

    static struct option long_options[]=
    {
        {"write",	required_argument,	0, 'w'},
		{"version",	no_argument,		0, 'v'},
		{"socket0",	required_argument,	0, 'z'},
        {"socket1",	required_argument,	0, 'y'},
        {"logfile",	required_argument,	0, 'l'},
        {"help",	no_argument,		0, 'h'},
        {"nogui",	no_argument,		0, 'n'},
		{0, 0, 0, 0}
    };

    prog_options.logging = 0;
    while(1)
    {
        int option_index = 0;
		c = getopt_long(argc, argv,"w:vz:y:l:hn", long_options, &option_index);
        if (c==-1)
            break;
        switch(c)
        {
            case 'z':
                socket_0_num = atoi(optarg);
                presupplied_socket_info = true;
                printf("Socket_0 information will be about socket %d\n", socket_0.socket_num);
                break;

            case 'y':
                socket_1_num = atoi(optarg);
                presupplied_socket_info = true;
                printf("Socket_1 information will be about socket %d\n", socket_1.socket_num);
                break;

            case 'w':
                //printf("write options specified %s\n", optarg);
                if (strcmp("l",optarg)==0)
                {
                    prog_options.logging = 1;
                    printf("Logging is ON and set to replace\n");
                }
                if (strcmp("a",optarg)==0)
                {
                    prog_options.logging = 2;
                    printf("Logging is ON and set to append\n");
                }
                break;

			case 'v':
				only_display_version=true;
				break;

            case 'l':
                strncpy(log_file_name, optarg, MAX_FILENAME_LENGTH-3);
                strcpy(log_file_name2, log_file_name);
                strcat(log_file_name2, "_%d");
                CPU_FREQUENCY_LOGGING_FILE_single = log_file_name;
                CPU_FREQUENCY_LOGGING_FILE_dual = log_file_name2;
                printf("Logging frequencies to %s for single sockets, %s for dual sockets(0,1 for multiple sockets)\n", CPU_FREQUENCY_LOGGING_FILE_single, CPU_FREQUENCY_LOGGING_FILE_dual);
                break;

            case 'n':
                use_ncurses = false;
                printf("Not Spawning the GUI\n");
                break;

            case 'h':
                printf("\ni7z Tool Supports the following functions:\n");
 				printf("Display version information only and exit:  ");
                printf("%c[%d;%d;%dm./i7z --version ", 0x1B,1,31,40);
                printf("%c[%dm[OR] ",0x1B,0);
                printf("%c[%d;%d;%dm./i7z -v \n", 0x1B,1,31,40);
                printf("%c[%dm",0x1B,0);

				printf("Append to a log file:  ");
                printf("%c[%d;%d;%dm./i7z --write a ", 0x1B,1,31,40);
                printf("%c[%dm[OR] ",0x1B,0);
                printf("%c[%d;%d;%dm./i7z -w a\n", 0x1B,1,31,40);
                printf("%c[%dm",0x1B,0);

                printf("Replacement instead of Append:  ");
                printf("%c[%d;%d;%dm./i7z --write l ", 0x1B,1,31,40);
                printf("%c[%dm[OR]", 0x1B,0);
                printf(" %c[%d;%d;%dm./i7z -w l\n", 0x1B,1,31,40);
                printf("%c[%dm",0x1B,0);

                printf("Default log file name is %s (single socket) or %s (dual socket)\n", CPU_FREQUENCY_LOGGING_FILE_single, CPU_FREQUENCY_LOGGING_FILE_dual);
                printf("Specifying a different log file: ");
                printf("%c[%d;%d;%dm./i7z --logfile filename ", 0x1B,1,31,40);
                printf("%c[%dm[OR] ", 0x1B,0);
                printf("%c[%d;%d;%dm./i7z -l filename\n", 0x1B,1,31,40);
                printf("%c[%dm",0x1B,0);
                printf("Specifying a particular socket to print: %c[%d;%d;%dm./i7z --socket0 X \n", 0x1B,1,31,40);
                printf("%c[%dm",0x1B,0);
                printf("In order to print to a second socket use: %c[%d;%d;%dm./i7z --socket1 X \n", 0x1B,1,31,40);
                printf("%c[%dm",0x1B,0);
                printf("To turn the ncurses GUI off use: %c[%d;%d;%dm./i7z --nogui\n", 0x1B, 1, 31, 40);
                printf("%c[%dm",0x1B,0);
                printf("Example: To print for two sockets and also change the log file %c[%d;%d;%dm./i7z --socket0 0 --socket1 1 -logfile /tmp/logfilei7z -w l\n", 0x1B, 1, 31, 40);
                printf("%c[%dm",0x1B,0);

                exit(0);
                break;
        }
    }

    Print_Version_Information();

    Print_Information_Processor (&prog_options.i7_version.nehalem, &prog_options.i7_version.sandy_bridge, &prog_options.i7_version.ivy_bridge, &prog_options.i7_version.haswell);
	if (only_display_version)
		exit(0);

//	printf("nehalem %d, sandy bridge %d\n", prog_options.i7_version.nehalem, prog_options.i7_version.sandy_bridge);

    Test_Or_Make_MSR_DEVICE_FILES ();
    modprobing_msr();

    /*
    prog_options.logging = 0;
    if (logging_val_replace){
        prog_options.logging = 1;
        printf("Logging is ON and set to replace\n");
    }
    if (logging_val_append){
        prog_options.logging = 2;
        printf("Logging is ON and set to append\n");
    }
    */
    /*
    while( (c=getopt(argc,argv,"w:")) !=-1){
		cvalue = optarg;
    	//printf("argument %c\n",c);
    	if(cvalue == NULL){
    	    printf("With -w option, requires an argument for append or logging\n");
    	    exit(1);
    	}else{
     	    //printf("         %s\n",cvalue);
     	    if(strcmp(cvalue,"a")==0){
     		printf("Appending frequencies to %s (single_socket) or cpu_freq_log_dual_(%d/%d).txt (dual socket)\n", CPU_FREQUENCY_LOGGING_FILE_single,0,1);
     		prog_options.logging=2;
     	    }else if(strcmp(cvalue,"l")==0){
     		printf("Logging frequencies to %s (single socket) or cpu_freq_log_dual_(%d/%d).txt (dual socket) \n", CPU_FREQUENCY_LOGGING_FILE_single,0,1);
     		prog_options.logging=1;
     	    }else{
     		printf("Unknown Option, ignoring -w option.\n");
     		prog_options.logging=0;
     	    }
     	    sleep(3);
        }
    }
    */
    ///////////////////////////////////////////////////////////

    construct_CPU_Hierarchy_info(&chi);
    construct_sibling_list(&chi);
    print_CPU_Hierarchy(chi);
    construct_socket_information(&chi, &socket_0, &socket_1, socket_0_num, socket_1_num);
    print_socket_information(&socket_0);
    print_socket_information(&socket_1);

    if (!use_ncurses){
        printf("GUI has been Turned OFF\n");
        //print_options(prog_options);
    } else {
        printf("GUI has been Turned ON\n");
        init_ncurses();
        //print_options(prog_options);
        /*
        if (prog_options.logging ==0)
        {
            printf("Logging is OFF\n");
        } else {
            printf("Logging is ON\n");
            if (prog_options.cstatelogging) {
                printf("Cstate logging is enabled\n");
            }
            if (prog_options.templogging) {
                printf("temp logging is enabled\n");
            }
        }
        */
    }

    if (!presupplied_socket_info){
        if (socket_0.max_cpu>0 && socket_1.max_cpu>0) {
            //Path for Dual Socket Code
            printf("i7z DEBUG: Dual Socket Detected\n\r");
            //Dual_Socket(&prog_options);
            Dual_Socket();
        } else {
            //Path for Single Socket Code
            printf("i7z DEBUG: Single Socket Detected\n\r");
            //Single_Socket(&prog_options);
            Single_Socket();
        }
    } else {
        Dual_Socket();
    }
    return(1);
}
Ejemplo n.º 23
0
int main(int argc, string argv[]){
	int c;
	int portnum;
	char* game_address;
	int verbose=0, server=0;
	while ( (c = getopt(argc, argv, "sp:g:hv")) != -1){
		switch(c){
			case 's':
				server = 1;
				break;
			case 'p':
				portnum = atoi(optarg);
				break;
			case 'g':
				game_address = optarg;
				break;
			case 'h':
				print_startup_options_help();
				exit(1);
			case 'v':
				verbose = 1;
				break;
		}
	}
	if(server){
		//launch server code
	}
	else{
		clock_t timeNowMs = (1000* clock())/(CLOCKS_PER_SEC);
		init_ncurses();
		int done = 0;
		gameMode_t game_mode = playerCreationMode;
		gameMode_t prev_mode;
		do{
			//add timing code while loop
			//add updating and drawing code
			int c = getch();
			if(c == 27 && !gameModeCmp(game_mode,escape_screen)){ //EscapeKey
				mvprintw(0,0,"GOING TO ESCAPE SCREEN");
				prev_mode = game_mode;
				game_mode = escape_screen; 
			}
			int update = game_mode.update(c);
			int draw   = game_mode.draw(stdscr);
			wrefresh(stdscr);	
			if(update == EXIT_GAME){
				done = 1;
			}else if(update == RETURN){
				game_mode = prev_mode;
				prev_mode = null_mode;
			} 			

			//timing code
			/*clock_t now = (1000* clock())/(CLOCKS_PER_SEC);
 			int k = 0;
			while((now = now = (1000* clock())/(CLOCKS_PER_SEC)) - timeNowMs < 16){
				k += 1;
			}
			timeNowMs = now;*/

		}while(!done);
		endwin();
	}
	return 0;
}