Ejemplo n.º 1
0
void run(bool* const quit_game)
{
    vector<Str_and_clr> lines;

    mk_info_lines(lines);

    Menu_browser browser(6, 0);

    render_menu(browser);

    while (true)
    {
        const Menu_action action = menu_input_handling::get_action(browser);

        switch (action)
        {
        case Menu_action::esc:
        case Menu_action::space:
        case Menu_action::selected_shift: {} break;

        case Menu_action::browsed:
        {
            render_menu(browser);
        } break;

        case Menu_action::selected:
        {
            if (browser.is_at_idx(0))
            {
                run_info(lines);
                render_menu(browser);
            }
            else if (browser.is_at_idx(1))
            {
                mk_memorial_file(lines);
            }
            else if (browser.is_at_idx(2))
            {
                high_score::run_high_score_screen();
                render_menu(browser);
            }
            else if (browser.is_at_idx(3))
            {
                msg_log::display_history();
                render_menu(browser);
            }
            else if (browser.is_at_idx(4))
            {
                return;
            }
            else if (browser.is_at_idx(5))
            {
                *quit_game = true;
                return;
            }
        } break;
        }
    }
}
Ejemplo n.º 2
0
TEST(pipelinePLangTest, DISABLED_programmabled_update_y_dims)
{ run_info("plang/programmable-update-y-dims.xml"); }
Ejemplo n.º 3
0
TEST(pipelinePLangTest, DISABLED_predicate_embed)
{ run_info("plang/predicate-embed.xml"); }
Ejemplo n.º 4
0
TEST(pipelinePLangTest, DISABLED_from_module)
{ run_info("plang/from-module.xml"); }
Ejemplo n.º 5
0
TEST(pipelineNitfTest, DISABLED_reader)
{ run_info("nitf/reader.xml"); }
Ejemplo n.º 6
0
TEST(pipelineNitfTest, chipper)
{ run_info("nitf/chipper.xml"); }
Ejemplo n.º 7
0
TEST(pipelineBaseTest, multioptions)
{ run_info("pipeline/pipeline_multioptions.xml"); }
Ejemplo n.º 8
0
TEST(pipelineFiltersTest, range_z)
{ run_info("filters/range_z.xml"); }
Ejemplo n.º 9
0
TEST(pipelineFiltersTest, hexbin_info)
{ run_info("filters/hexbin-info.xml"); }
Ejemplo n.º 10
0
TEST(pipelineFiltersTest, merge)
{ run_info("filters/merge.xml"); }
Ejemplo n.º 11
0
TEST(pipelineBaseTest, readcomments)
{ run_info("pipeline/pipeline_readcomments.xml"); }
Ejemplo n.º 12
0
TEST(pipelineBaseTest, read_notype)
{ run_info("pipeline/pipeline_read_notype.xml"); }
Ejemplo n.º 13
0
TEST(pipelineBaseTest, read)
{ run_info("pipeline/pipeline_read.xml"); }
Ejemplo n.º 14
0
TEST(pipelineQfitTest, DISABLED_reader)
{ run_info("qfit/reader.xml"); }
Ejemplo n.º 15
0
TEST(pipelineFiltersTest, range_classification)
{ run_info("filters/range_classification.xml"); }
Ejemplo n.º 16
0
void server::update(server* srv)
{
	while (srv->running())
	{
		srv->select_timeout_.tv_sec = 0;
		srv->select_timeout_.tv_usec = srv->timeout_;

		FD_ZERO(&srv->read_fs_);
		srv->read_fs_ = srv->active_fs_;

		if (select(srv->max_socket_ + 1, &srv->read_fs_, NULL, NULL, &srv->select_timeout_) > 0)
		{
			//nueva conexion
			if (FD_ISSET(srv->socket_, &srv->read_fs_))
			{
				sockaddr_storage cli_addr;
				socklen_t addr_size = sizeof(cli_addr);
				socket_t cli_socket = accept(srv->socket_, (struct sockaddr*)&cli_addr, &addr_size);
				if (cli_socket != -1)
				{
					FD_SET(cli_socket, &srv->active_fs_);
					srv->connections_.emplace_back(new srv_connection(cli_socket, cli_addr, run_info(srv->run_)));
					srv->max_socket(cli_socket);
				}
			}

//			//conexiones existentes
//			connections_t::iterator it = srv->connections_.begin();
//			while(it != srv->connections_.end())
//			{
//				srv_connection& conn = **it;
//				if (FD_ISSET(conn.socket(), &srv->read_fs_))
//					conn.incoming_packet();
//
//				if (!conn.connected())
//					it = srv->connections_.erase(it);
//				else
//					it++;
//			}
		}

	    // buscamos clientes desconectados
	    time_t now;
	    time(&now);

	    if (now - srv->disconnect_timestamp_ >= disconnect_check)
	    {
		    connections_t::iterator it = srv->connections_.begin();
		    while(it != srv->connections_.end())
		    {
		    	srv_connection& conn = **it;
		    	if (conn.timeout())
		    		it = srv->connections_.erase(it);
				else
					++it;
		    }
			time(&srv->disconnect_timestamp_);
	    }

		std::this_thread::sleep_for(std::chrono::milliseconds(5));
	}
}
Ejemplo n.º 17
0
TEST(pipelineFiltersTest, sort)
{ run_info("filters/sort.xml"); }
Ejemplo n.º 18
0
void lesson_practice(int lesson_no,int num,int MINUTE,int angleINCREASE)
{
/* INCREASE= will control time, MINUTE= given time limit of typing */

	int j1,ch1,x1,y1,time_up;
	int char_x, char_y,i,choice,dummy_choice,line,z;
	int rndm,store; /* 'store' is used to store chars serially in
				store array */
	prev= -1;
	time_interval=0, min=0, sec=0, eff=0, err=0, speed=0;
	pressed=0, correct= 0, wrong= 0, cpm=0, correction=0;
	minute=MINUTE, INCREASE= angleINCREASE, second=0;

	char_x = 173;
	char_y = 72;

	tutorial_window();
	run_info_window();
	hideMouse();

	if(!num)
		LETTER= 4;

	else if(!lesson_no)
		LETTER=20;

	line = 1;
	for(i=1,store=0; line<MAX ;i++,store++)
	{
		rndm = random(LETTER); // randomly seeks chars
		if(!num){
			store_chars[store]= lesson[lesson_no-1][rndm];
			print_lesson(char_x, char_y, lesson[lesson_no-1][rndm],1);
		}

		else if(!lesson_no){
			store_chars[store]= numeric[num-1][rndm];
			print_lesson(char_x, char_y, numeric[num-1][rndm],1);
		}
		char_x +=8; //for next character

		if(i%4==0)       // GIVING SPACE AFTER EVERY 4 CHARS
		{
			char_x +=8;
			store++;
			store_chars[store]=' ';
		}

		if(char_x >405)    // NEXT LINE
		{
			char_x = 173;
			char_y+= 36;
			line++;
		}
	}
	setcolor(4);
	outtextxy(542,50,"0");
	outtextxy(562,50,":");
	outtextxy(574,50,"00");
	show_number(minute,550,50,4,0,1);
	run_info(pressed,correct,wrong,correction);
	user_response(250,130,1,3);
	time(&start_time);

	settextstyle(2,0,5);
	color_text(535,76,"ESC to",3);
	color_text(536,76,"ESC to",3);
	color_text(524,92,"quit/pause",3);
	color_text(525,92,"quit/pause",3);
	char_x= 173; 	char_y= 90;  line =1;  i=0;

	dummy_choice= 'A'; //just to initialize the drawing of a key
	increase=0, angle=89;
	while(1)
	{
	      gettime (&new_time);
	      time_up= time_control();
	      if(time_up)
			return;


	      if(line<7){
			color_text(char_x,char_y+1,"_",4);
			color_text(char_x,char_y-23,"^",4);
	      }

	      if(kbhit())
	      {
			check_kb_up_down(dummy_choice,0);

			choice= getch();  // ASSIGN USER INPUT TO 'CHOICE'
			dummy_choice= choice;
			pressed++;

			check_kb_up_down(choice,1);

			if(line>6)
			{
				summary_content();
				end_lesson(min,sec,eff,err,speed);
				return;
			}
			if(choice==27 )  // ESC
			{
				pressed--;
				make_sound(2000,100);
				if(i>0)
					summary_content();

				z = continue_close(min,sec,eff,err,speed);
				if(z)
					return;
				else
					continue;
			}
			else if(choice==0) // error checking for function keys
			{
				ch1=getch();
				if(ch1==80||ch1==72||ch1==75||ch1==77)   //error checking  to avoide right,left,up
					continue;
			}

			else if(choice==9)
				continue;    //error checking for tab

			else if(choice==8)  	// BACKSPACE
			{
				if(i>0)
				{
					correction++;
					if(char_x<=173){
						setfillstyle(1,15);
						bar(char_x+233,char_y-36,char_x+243,char_y-29);
						color_text(char_x,char_y+1,"_",15);
						color_text(char_x,char_y-23,"^",15);
						char_y-=36;
						char_x+=240;

						color_text(char_x-8,char_y+1,"_",4);
						color_text(char_x-8,char_y-23,"^",4);

					}

					else{
						setfillstyle(1,15);
						bar(char_x-8, char_y, char_x,char_y+7);
						color_text(char_x,char_y+1,"_",15);
						color_text(char_x-8,char_y+1,"_",4);
						color_text(char_x,char_y-23,"^",15);
						color_text(char_x-8,char_y-23,"^",4);
					}
					--i;
					char_x-=8;
					sound(1000);
					delay(100);
					nosound();
				}
			}

			else{

				if(choice==store_chars[i]){  			//letter is ok!
					print_lesson(char_x,char_y,choice,4);
					correct++;
				}

				else if(store_chars[i] !=choice && choice==' ')
				{
					char choice1 = '-';	//when space is pressed instead of any key, print dash
					print_lesson(char_x,char_y,choice1,9);
					make_sound(500,100);
					wrong++;
				}
				else
				{
					print_lesson(char_x, char_y,choice,9);
					make_sound(500,100);
					wrong++;
				}

				color_text(char_x+8,char_y-23,"^",4);
				color_text(char_x,char_y-23,"^",15);
				color_text(char_x+8,char_y+1,"_",4);
				color_text(char_x,char_y+1,"_",15);
				char_x +=8;
				if(char_x > 405)
				{
					color_text(char_x,char_y+1,"_",15);
					color_text(char_x,char_y-23,"^",15);
					char_x = 173;
					char_y +=36;
					line++;
				}
				i++;

			}  // end of else or default typing

			run_info(pressed,correct,wrong,correction);
	      } // end of the initial 'if'
	}  // end of while
}
Ejemplo n.º 19
0
TEST(pipelineBaseTest, metadata_reader)
{ run_info("pipeline/pipeline_metadata_reader.xml"); }