⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bnch_lin.c

📁 公司vc培训的时候,给大家几个例子,比较实用,拿来分享
💻 C
字号:
/*......................... BENCH_LINE.C ................ 2-25-96 ..........*/
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <vsa.h>
#include <vsa_font.h>

extern unsigned _stklen = 20000;            /* This is for Borland C Only ! */

void main()
{
	char text[100];
	clock_t clk,delta;
	unsigned mode,x[4096],y[4096];
	unsigned i,num_lines,xl,yt,xr,yb;
	float timer;
	printf("input graphics mode (hex): ");
	scanf("%x",&mode);
	vsa_init(mode);
LOOP:
	xl = 0;
	yt = 0;
	xr = XResolution-1;
	yb = YResolution-1;
	vsa_set_clip_mode(1);
	vsa_set_viewport(xl,yt,xr,yb);

	num_lines = 4000;
	srand(1);
	for(i=0;i<num_lines;i++)
		{
			x[i] = ((unsigned long)(XResolution-1)*rand())/RAND_MAX;
			y[i] = ((unsigned long)(YResolution-1)*rand())/RAND_MAX;
		}
	vsa_set_color(6);
	vsa_move_to(0,0);
	clk = clock();
	for(i=0;i<num_lines;i++)
		vsa_line_to(x[i],y[i]);
	delta = clock() - clk;
	timer = ((float)(delta))/((float)CLOCKS_PER_SEC);
	if(timer == 0) timer = .000001;
	sprintf(text,"elapsed line drawing time = %f sec\n",timer);
	vsa_write_string(10,10,15,text);
	sprintf(text,"RANDOM LINES: Drawing Rate = %f lines/sec\n",num_lines/timer);
	vsa_write_string(10,25,15,text);

	if(getch() == 27)
		goto BAIL;

	goto LOOP;
BAIL:
	vsa_init(3);
	return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -