示例#1
0
文件: 10189.c 项目: usong/uva
int main(){
	unsigned int i , j ; 	
	int step = 1;
	while( scanf("%d %d", &n ,&m ) == 2 ){

		if(  m ==0 || n == 0 ) { break ;}
		for( i = 0 ; i < MAX ; i++ ) {
			for( j = 0 ; j < MAX ; j++ ) {
				MineArray[i][j] = 0x00 ; 	
			}		
		}
		for( i = 1 ; i <= n  ; i++ ) {
			scanf( "%s" , MineArray[i] + 1 ); 
			
		}
		
	
		for( i = 1 ; i <= n ; i++ ) { 
			for ( j = 1; j <= m ; j++ ){
				if( MineArray[i][j] == '.' ) 
					draw_mine( MineArray, i , j );
			}
		}	
		printf("Field #%d:\n" , step ) ; 
		for( i = 1 ; i <= n ; i++ ) {
			for( j = 1 ; j <= m ; j++ ) {
				printf("%c" , MineArray[i][j] ) ; 	
			}		
			printf("\n");
		}
		printf("\n");
	
		step++;
	}
		

	return 0;
}
示例#2
0
void draw_world(grs_canvas *screen_canvas,editor_view *v,segment *mine_ptr,int depth)
{
	vms_vector viewer_position;

#if DOUBLE_BUFFER
	grs_canvas temp_canvas;

//	mprintf(0, "\n");

//	if ( screen_canvas == LargeViewBox->canvas ) {
//		CurrentBigCanvas ^= 1;
//
//		gr_set_current_canvas( BigCanvas[CurrentBigCanvas] );
//
//	} else {
		gr_init_sub_canvas(&temp_canvas,canv_offscreen,0,0,
			screen_canvas->cv_bitmap.bm_w,screen_canvas->cv_bitmap.bm_h);

		gr_set_current_canvas(&temp_canvas);
//	}
#else
	gr_set_current_canvas(screen_canvas);
#endif

	//mprintf(0, "\n");

	ui_mouse_hide();

	//g3_set_points(Segment_points,Vertices);

	viewer_position = v->ev_matrix.fvec;
	vm_vec_scale(&viewer_position,-v->ev_dist);

	vm_vec_add2(&viewer_position,&Ed_view_target);

	gr_clear_canvas(0);
	g3_start_frame();
	g3_set_view_matrix(&viewer_position,&v->ev_matrix,v->ev_zoom);

	render_start_frame();

	gr_setcolor(PLAINSEG_COLOR);

	// Draw all segments or only connected segments.
	// We might want to draw all segments if we have broken the mine into pieces.
	if (Draw_all_segments)
		draw_mine_all(Segments, Automap_test);
	else
		draw_mine(mine_ptr,depth);

	// Draw the found segments
	if (!Automap_test) {
		draw_warning_segments();
		draw_group_segments();
		draw_found_segments();
		draw_selected_segments();
		draw_special_segments();

		// Highlight group segment and side.
		if (current_group > -1)
		if (Groupsegp[current_group]) {
			gr_setcolor(GROUPSEG_COLOR);
			draw_segment(Groupsegp[current_group]);

			gr_setcolor(GROUPSIDE_COLOR);
			draw_seg_side(Groupsegp[current_group],Groupside[current_group]);
		}

		// Highlight marked segment and side.
		if (Markedsegp) {
			gr_setcolor(MARKEDSEG_COLOR);
			draw_segment(Markedsegp);

			gr_setcolor(MARKEDSIDE_COLOR);
			draw_seg_side(Markedsegp,Markedside);
		}

		// Highlight current segment and current side.
		gr_setcolor(CURSEG_COLOR);
		draw_segment(Cursegp);

		gr_setcolor(CURSIDE_COLOR);
		draw_seg_side(Cursegp,Curside);

		gr_setcolor(CUREDGE_COLOR);
		draw_side_edge(Cursegp,Curside,Curedge);

		// Draw coordinate axes if we are rendering the large view.
		if (Show_axes_flag)
			if (screen_canvas == LargeViewBox->canvas)
				draw_coordinate_axes();

		// Label the window
		gr_set_fontcolor((v==current_view)?CRED:CWHITE, -1 );
		if ( screen_canvas == LargeViewBox->canvas ) {
			gr_ustring( 5, 5, "USER VIEW" );
			switch (Large_view_index) {
				case 0: gr_ustring( 85, 5, "-- TOP");	break;
				case 1: gr_ustring( 85, 5, "-- FRONT");	break;
				case 2: gr_ustring( 85, 5, "-- RIGHT");	break;
			}			
		} else
#if ORTHO_VIEWS
		 else if ( screen_canvas == TopViewBox->canvas )
			gr_ustring( 5, 5, "TOP" );
		else if ( screen_canvas == FrontViewBox->canvas )
			gr_ustring( 5, 5, "FRONT" );
		else if ( screen_canvas == RightViewBox->canvas )
			gr_ustring( 5, 5, "RIGHT" );
#else
			Error("Ortho views have been removed, what gives?\n");
#endif

	}