Exemple #1
0
void Foo::Calc()
{
	for(int i=0;i<30;i++)   	// do calculation
	{
		long_calculations();	// which can be very long
		pnt.Set(2*mgl_rnd()-1,2*mgl_rnd()-1);
		Gr->Update();			// update window
	}
}
Exemple #2
0
	void Calc()
	{
		for(i=0;;i++)	// do calculation
		{
			Check();	// check if need pause
			long_calculations();// which can be very long
			pnt.Set(2*mgl_rnd()-1,2*mgl_rnd()-1);
			if(wnd)	wnd->Update();
		}
	}
Exemple #3
0
int main(int argc,char **argv)
{
	mglFLTK gr("test");
	gr.RunThr();	// <-- need MathGL version which use pthread
	for(int i=0;i<10;i++)	// do calculation
	{
		long_calculations();// which can be very long
		pnt = mglPoint(2*mgl_rnd()-1,2*mgl_rnd()-1);
		gr.Clf();			// make new drawing
		gr.Line(mglPoint(),pnt,"Ar2");
		char str[10] = "i=0";	str[3] = '0'+i;
		gr.Update();		// update window
	}
	return 0;	// finish calculations and close the window
}
Exemple #4
0
void *calc(void *)
{
	mglPoint pnt;
	for(int i=0;i<10;i++)	// do calculation
	{
		long_calculations();       // which can be very long
		pnt.Set(2*mgl_rnd()-1,2*mgl_rnd()-1);
		if(gr)
		{
			gr->Clf();			// make new drawing
			gr->Line(mglPoint(),pnt,"Ar2");
			char str[10] = "i=0";	str[2] = '0'+i;
			gr->Puts(mglPoint(),str);
			gr->Update();		// update window
		}
	}
	exit(0);
}