当前位置: 首页>>代码示例>>C++>>正文


C++ clear_buffer函数代码示例

本文整理汇总了C++中clear_buffer函数的典型用法代码示例。如果您正苦于以下问题:C++ clear_buffer函数的具体用法?C++ clear_buffer怎么用?C++ clear_buffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了clear_buffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

void init(void)
{
	for(uint8_t i = 0; i < matrix_xyz_len; i++) {
		vars.xyz[i] = (xyz_t){
			.x = randint(0, LEDS_X),
			.y = randint(0, LEDS_Y),
			.z = randint(0, LEDS_Z)
		};
	}

	clear_buffer();
}
void effect(void)
{
	clear_buffer();

	for(uint8_t i = 0; i < matrix_xyz_len; i++) {
		xyz_t xyz = vars.xyz[i];

		for(uint8_t j = 0; j < 3; j++) {
			if(xyz.z + j < LEDS_Z) {
				set_led(xyz.x, xyz.y, xyz.z + j, MAX_INTENSITY);
			}
		}

		uint8_t z = xyz.z;

		z++;

		if(z >= LEDS_Z) z = 0;

		vars.xyz[i].z = z;
	}
}
开发者ID:elovalo,项目名称:elovalo,代码行数:34,代码来源:matrix.c

示例2: request_custom_command

DWORD request_custom_command(Remote *remote, Packet *packet)
{
	Packet * response = packet_create_response(packet);
	Tlv argTlv             = {0};
	DWORD index            = 0;
	vector<wstring> args;

	LPCSTR func = packet_get_tlv_value_string(packet, TLV_TYPE_MIMIKATZ_FUNCTION);
	dprintf("Function: %s", packet_get_tlv_value_string(packet, TLV_TYPE_MIMIKATZ_FUNCTION));
	wstring function = s2ws(func);

	while( packet_enum_tlv( packet, index++, TLV_TYPE_MIMIKATZ_ARGUMENT, &argTlv ) == ERROR_SUCCESS )
	{
		dprintf("Arg: %s", (PCHAR)argTlv.buffer);
		args.push_back(s2ws((PCHAR)argTlv.buffer));
	}

	clear_buffer();

	initialize_mimikatz();
	myMimiKatz->doCommandeLocale(&function, &args);

	wchar_t* output = convert_wstring_to_wchar_t(oss.str());
	
	clear_buffer();

	packet_add_tlv_raw(response, TLV_TYPE_MIMIKATZ_RESULT, output, (DWORD)(wcslen(output)*sizeof(wchar_t)));
	packet_transmit_response(ERROR_SUCCESS, remote, response);

	return ERROR_SUCCESS;	
}
开发者ID:AnwarMohamed,项目名称:metasploit-payloads,代码行数:31,代码来源:main.cpp

示例3: main

int main(int argc, char **argv){
	FILE *fpa;
	FILE *fpb;
	char ba[BUF_SIZE];
	char bb[BUF_SIZE];
	int a;
	int b;
	int num_match=0;
	int total=0;
	fpa = fopen(argv[1], "r");
	fpb = fopen(argv[2], "r");
	clear_buffer(ba);
	clear_buffer(bb);
	while(fgets(ba, sizeof(ba), fpa)){
		if(fgets(bb, sizeof(bb), fpb)){
		}
		else{
			break;
		}
		a = atoi(ba);
		b = atoi(bb);
		if(a == b){
			num_match++;
		}
		total++;
		clear_buffer(ba);
		clear_buffer(bb);
	}
	printf("%f\n", (double)num_match/(double)total);
	return EXIT_SUCCESS;
}
开发者ID:jasonbarnes,项目名称:SCA,代码行数:31,代码来源:accuracy.c

示例4: process_respond

/**
* Przetwarza otrzymaną odpowiedź serwera.
*/
void process_respond(int* auth){
  if(! *auth){ // Autoryzuje do skutku
    my_usr_id = msg->user_id;
    if(my_usr_id != -1){
      *auth = 1;
      strcpy(user_type, msg->message);
      printf("Zalogowano jako: %s\n",msg->message);
    }else{
      printf("SERVER: %s \n", msg->message);
    }
    clear_buffer();
    return;
  }
  switch (msg->command_type) {
    case -1:  // Błąd
      printf("Problem z przetworzeniem żądania!\nSERVER: %s\n", msg->message);
      break;
    case 0:
    case 2 ... 14:
      printf("SERVER: %s\n",msg->message);
      if(msg->is_complete == 0)
        printf("\n");
      break;
    default:  //jakieś inne bugi
      printf("Wystapil problem z żądaniem lub żądanie nieobsugiwane! \n");
      break;
  }
  clear_buffer();
}
开发者ID:adowsky,项目名称:client-server,代码行数:32,代码来源:client.c

示例5: main

int main(int argc, char const *argv[]) {
    coordinate cityA, cityB;
    
    char units;
    printf("Choose units of distance \'k\' for kilometes \'m\' for miles\n>>> ");
    scanf("%c", &units);
    clear_buffer();
    while(!check(units, "km")) {
        printf("Enter \'k\' or \'m\'\n>>> ");
        scanf("%c", &units);
        clear_buffer();
    }

    printf("Enter a coordinates (latitude and longitude) of first city\n>>> ");
    scanf("%lf %lf", &cityA.latitude, &cityA.longitude);
    printf("Enter a coordinates of second city\n>>> ");
    scanf("%lf %lf", &cityB.latitude, &cityB.longitude);
    
    double distance = get_distance(cityA, cityB);
    if (units == 'm')
        distance = (1.0 / 1.609344) * distance;
    printf("\nDistance between this cities: %.3f %s.\n", distance,
           (units == 'k')? "kilometes": "miles");
   
    return 0;
}
开发者ID:caiyuchao,项目名称:c_code,代码行数:26,代码来源:distance.c

示例6: init

void init(void)
{
	for(uint8_t i = 0; i < starfield_xyz_len; i++) {
		vars.xyz[i] = (xyz_t){
			.x = randint(0, LEDS_X),
			.y = randint(0, LEDS_Y),
			.z = randint(0, LEDS_Z)
		};
	}

	clear_buffer();
}
void effect(void)
{
	clear_buffer();

	for(uint8_t i = 0; i < starfield_xyz_len; i++) {
		xyz_t xyz = vars.xyz[i];

		set_led(xyz.x, xyz.y, xyz.z, MAX_INTENSITY);

		uint8_t y = xyz.y;

		y++;

		if(y >= LEDS_Y) y = 0;

		vars.xyz[i].y = y;
	}
}
开发者ID:elovalo,项目名称:elovalo,代码行数:30,代码来源:starfield.c

示例7: extract_meta

/*
	Extract Meta information from video using ffprobe.
*/
void extract_meta(char const *video_path, int *width, int *height, int *fcount, float *fps)
{
	FILE *pipe_fp;
	char readbuf[80]; //todo: magic number, not good
	char fcount_probe_cmmd[1024] = "ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 ";
	char fps_probe_cmmd[1024] = "ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 ";
	char y_probe_cmmd[1024] = "ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height ";
	char x_probe_cmmd[1024] = "ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=width ";

	/*
	Extract frame count information from video.
	*/

	pipe_to_buffer(pipe_fp, readbuf, fcount_probe_cmmd, video_path);

	if(sscanf(readbuf, "%d", fcount) != 1) {
		// printf("Frame Count could not be read.\n");
	}
	printf("Frame Count: %d\n", *fcount);
	clear_buffer(readbuf);


	/*
	Extract fps information from video.
	*/
	pipe_to_buffer(pipe_fp, readbuf, fps_probe_cmmd, video_path);

	int _n, _d; //must extract 
	if(sscanf(readbuf, "%d/%d", &_n, &_d) != 1) {
		// printf("FPScould not be read.\n");
	}

	float _f = ((float) _n / (float) _d);
	memcpy(fps, &_f, sizeof(float));

	printf("FPS (%d/%d) : %f\n", _n, _d, *fps);
	clear_buffer(readbuf);

	/*
	Extract height information from video.
	*/
	pipe_to_buffer(pipe_fp, readbuf, y_probe_cmmd, video_path);

	if(sscanf(readbuf, "streams_stream_0_height=%d", height) != 1) {
		// printf("FPScould not be read.\n");
	}
	printf("Height: %d\n", *height);
	clear_buffer(readbuf);

	/*
	Extract width information from video.
	*/
	pipe_to_buffer(pipe_fp, readbuf, x_probe_cmmd, video_path);
	
	if(sscanf(readbuf, "streams_stream_0_width=%d", width) != 1) {
		// printf("FPScould not be read.\n");
	}
	printf("Width: %d\n", *width);
	clear_buffer(readbuf);
}
开发者ID:bigredwill,项目名称:cs161,代码行数:63,代码来源:Simons_Will_assignment_2.c

示例8: mapcache_create

void mapcache_create(uint32 mapnum)
{
	buffer_t buffer;
	uint32 x = 0, y = 0;

	clear_buffer(&buffer);

	add_opcode(&buffer, SMAPDATA);
	add_buffer(&buffer, &mapnum, SIZE32);
	add_string(&buffer, map(mapnum)->name );
	add_buffer(&buffer, &map(mapnum)->moral,SIZE8);
	add_buffer(&buffer, &map(mapnum)->music,SIZE8);
	add_buffer(&buffer, &map(mapnum)->left,SIZE16);
	add_buffer(&buffer, &map(mapnum)->right,SIZE16);
	add_buffer(&buffer, &map(mapnum)->up,SIZE16);
	add_buffer(&buffer, &map(mapnum)->down,SIZE16);
	add_buffer(&buffer, &map(mapnum)->shop,SIZE16);
	add_buffer(&buffer, &map(mapnum)->bootmap,SIZE32);
	add_buffer(&buffer, &map(mapnum)->bootx,SIZE8);
	add_buffer(&buffer, &map(mapnum)->booty,SIZE8);
	add_buffer(&buffer, &map(mapnum)->revision,SIZE32);

	for( x = 0; x < MAX_MAP_NPCS; x++)
		add_buffer(&buffer, &map(mapnum)->npc[x].num,SIZE16);

	for(x = 0; x < MAX_MAPX; x++){
		for(y = 0; y < MAX_MAPY; y++){
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].type, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].data1, SIZE16);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].data2, SIZE16);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].data3, SIZE16);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].ground.y, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].ground.x, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].ground.tileset, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].mask.y, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].mask.x, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].mask.tileset, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].anim.y, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].anim.x, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].anim.tileset, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].fringe.y, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].fringe.x, SIZE8);
			add_buffer(&buffer,&map(mapnum)->tile[GETXY(x,y)].fringe.tileset, SIZE8);
		}
	}

	clear_buffer(&map_array_cache[mapnum]);
	map_array_cache[mapnum] = buffer;
}
开发者ID:MMORPGCreation,项目名称:Developers-Engine,代码行数:49,代码来源:maps.c

示例9: scanner_get_str_bracket

token scanner_get_str_bracket()
{
    WCHAR in_char, c;

    clear_buffer();
    if (m_file_in_ptr == 0) return TOKEN_EOF;
    if (src_eof()) return TOKEN_EOF;

    while (((in_char=src_getc())!=0)) {
        if (isspace(in_char))
            continue;
        else if (in_char == 0x0d)
            continue;            
        else if (in_char == 0x0a)
            continue;            
        else if (in_char != ']') {
            buffer_char(in_char);
            for (c=src_getc(); 
                c!=',' && c!='\t' && c!='\n' && c != ']'; 
                c=src_getc()) {
                if (c==0) break;
                buffer_char(c);
            }
            src_ungetc(c);
            return TOKEN_STRING;
        }    
    }
    
    return TOKEN_EOF;
}
开发者ID:h0tw1r3,项目名称:asuswrt-merlin,代码行数:30,代码来源:scanner.cpp

示例10: show_vocab

int show_vocab(vocab_t *listavocab, int cat, bool imprime) {

int resultados = 0;
	
	
print_buffer_new_line();
if (listavocab) {
	
	listavocab = go_to_cat(listavocab,cat);
	listavocab = listavocab->psiguiente;

	resultados = 0;
	if (listavocab) {
		clear_buffer();
		while (listavocab && !listavocab->pcat) {
			resultados++;
			if (imprime) {
				show_vocab_item(listavocab,resultados);
			}

			listavocab = listavocab->psiguiente;					
  	}    	
	}

}

upgrade_buffer(false);

return resultados;
}
开发者ID:aperezm-vlex,项目名称:himitsu,代码行数:30,代码来源:vocab.c

示例11: send_map

void send_map(void)
{
	buffer_t buffer;
	uint32 x = 0;

	clear_buffer(&buffer);

	add_opcode(&buffer, CMAPDATA);
	add_string(&buffer, map()->name );
	add_buffer(&buffer, &map()->moral,SIZE8);
	add_buffer(&buffer, &map()->music,SIZE8);
	add_buffer(&buffer, &map()->left,SIZE16);
	add_buffer(&buffer, &map()->right,SIZE16);
	add_buffer(&buffer, &map()->up,SIZE16);
	add_buffer(&buffer, &map()->down,SIZE16);
	add_buffer(&buffer, &map()->shop,SIZE16);
	add_buffer(&buffer, &map()->bootmap,SIZE32);
	add_buffer(&buffer, &map()->bootx,SIZE8);
	add_buffer(&buffer, &map()->booty,SIZE8);

	for( x = 0; x < MAX_MAP_NPCS; x++){
		add_buffer(&buffer, &map()->npc[x].num,SIZE16);
	}

	add_buffer(&buffer, map()->tile,(MAX_MAPX * MAX_MAPY) * sizeof(tile_t));

	send_data(&buffer);
}
开发者ID:DarkBeast,项目名称:Developers-Engine,代码行数:28,代码来源:clienttcp.c

示例12: cast_spell

/**
* cast_spell(void)
*
* @brief
* @param void
* @return void
*/
void cast_spell(void)
{
	buffer_t buffer;

	//Check for subscript out of range
	if(!tempdata()->spell_selected || tempdata()->spell_selected >= MAX_PLAYER_SPELLS)
		return;

	//Check if player has enough MP
	if(player(myindex())->spells[tempdata()->spell_selected]){
		if(player(myindex())->vitals[VITAL_MP] < spell(player(myindex())->spells[tempdata()->spell_selected])->mpreq){
			//	Call AddText("Not enough MP to cast " & Trim$(Spell(SpellSelected).Name) & ".", 12)
			return;
		}
		if(gettickcount() > player(myindex())->attacktimer + 1){
			if(player(myindex())->moving == 0){
				clear_buffer(&buffer);
				add_opcode(&buffer,CCAST);
				add_buffer(&buffer,&tempdata()->spell_selected, SIZE16);
				socketsend(&buffer);
				player(myindex())->attacking = TRUE;
				player(myindex())->attacktimer = gettickcount();
				tempdata()->castedspell = TRUE;
			}
			else{
				//Call AddText("Cannot cast while walking!", 12)
			}
		}
	}
	else{
		//Call AddText("No spell here.", 12)
	}
}
开发者ID:MMORPGCreation,项目名称:Developers-Engine,代码行数:40,代码来源:gamelogics.c

示例13: cellGcmSetSurface

void Renderer::fillBuffers()
{
	cellGcmSetSurface(&deferredLight[0]);
	cellGcmSetDitherEnable(CELL_GCM_FALSE);
	clear_buffer();
	this->SetCurrentShader(*sceneVert, *sceneFrag);
	cellGcmSetDepthTestEnable(CELL_GCM_TRUE);
	cellGcmSetCullFaceEnable(CELL_GCM_TRUE);
	cellGcmSetBlendEnable(CELL_GCM_TRUE);
	cellGcmSetDepthFunc(CELL_GCM_LESS);

	cellGcmSetColorMaskMrt(CELL_GCM_COLOR_MASK_MRT1_A |
						   CELL_GCM_COLOR_MASK_MRT1_R |
						   CELL_GCM_COLOR_MASK_MRT1_G |
						   CELL_GCM_COLOR_MASK_MRT1_B);



	projMatrix = Matrix4::perspective(0.7853982, screen_ratio, 1.0f, 10000.0f);	//CHANGED TO THIS!!
	//projMatrix = Matrix4::orthographic(-0.5,0.5,-0.5,0.5,-1,1);
	viewMatrix = camera->BuildViewMatrix();
	modelMatrix = Matrix4::identity();
	currentVert->UpdateShaderMatrices(modelMatrix, viewMatrix, projMatrix);

	DrawNode(root);
	cellGcmSetDitherEnable(CELL_GCM_TRUE);

	cellGcmSetColorMaskMrt(0);
	//SetTextureSampler(currentFrag->GetParameter("texture"), height->GetMesh()->GetDefaultTexture());
	//height->GetMesh()->Draw(*sceneVert, *sceneFrag);
}
开发者ID:rhvall,项目名称:PS3DeferredLighting,代码行数:31,代码来源:Renderer.cpp

示例14: main

int main() {
    vga_fd = open("/dev/vga", O_RDONLY);
    ioctl(vga_fd, SETVGAMODE, (void*)vga_mode_320x200x256); 

    int fd = open("/dev/mouse", O_RDONLY);
    mousestate_t data;

    int ballX = WIDTH/2 - BALL_SIZE / 2;
    int ballY = HEIGHT/2 - BALL_SIZE /2;
    int velX = 10;
    int velY = 10;

    char color = 1;

    while (1) {
	clear_buffer(buffer);

	// read mouse position
	read(fd, &data, sizeof(data));
	data.y = 199 - data.y;
	data.x = data.x * WIDTH / 320;
	data.y = data.y * HEIGHT / 200;

	// draw ball and racket
	moveBall(&ballX,&ballY,&velX,&velY,data.y);
	drawBall(ballX,ballY,color);
	drawRacket(data.y,color);
	ioctl(vga_fd, FLUSHVGA, buffer);
	
	usleep(10000);
    }
    return 0;
}
开发者ID:TacOS-team,项目名称:tacos-gui,代码行数:33,代码来源:pong.c

示例15: idle_screen

// Pop up the Idle screen
void idle_screen(void)
{
	clear_buffer();
	LCD_Display_Text(121,(prog_uchar*)Verdana14,40,12); // "Press"
	LCD_Display_Text(122,(prog_uchar*)Verdana14,24,32); // "for status"
	write_buffer();
};
开发者ID:sndae,项目名称:kk2glider,代码行数:8,代码来源:glcd_menu.c


注:本文中的clear_buffer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。