Jamagic2D SCREEN SAVER EXAMPLE #2!

This open source code is a simple 2D screensaver that create a screen full of 2D multicolor polygons.

If you do any changes to this source code, please send it to me!

//Simple 2D Screensaver Jul 2001
//Giovanni@Cardona.com

Var CurSurf = CurWindow.GetSurface();
//
CurSurf.SetAutoBack(OFF);
CurSurf.SetAutoRefresh(OFF);
//
Var nWinWidth = CurSurf.GetPixelWidth();
Var nWinHeigth = CurSurf.GetPixelHeight();

Var nWhite = GetRGB(255,255,255);
Var nSize = 8;

//initialize
Var ptArray = New PointArray(2);
ptArray.AddPoint(0,0);
ptArray.AddPoint(0,0);
ptArray.AddPoint(0,0);

//Main Loop
While(1)
{
	For (nLoop = 0; nLoop != 3; nLoop++)
	{
		// Set the points of the PointArray
		ptArray.SetPoint(nLoop,Random(nWinWidth),Random(nWinHeigth));
	}
	
	// Draw the polygon
	CurSurf.SetPenColor(Random(nWhite));
	CurSurf.SetPenSize(Random(nSize));
	CurSurf.SetFillColor(Random(nWhite));
	CurSurf.DrawPolygon(ptArray);
	Refresh();
}

 


(c)2001 Giovanni Cardona
Jamagician Extraordinarie