Пример #1
0
void CPROC Output( PTRSZVAL psv, PRENDERER display )
{
    if( g.is_up[psv] )
    {
        Image surface = GetDisplayImage( display );
        Image imgGraphic;
        struct video_element *element = (struct video_element*)GetLink( &g.current_list[psv]->images, g.currents[psv] );
        //lprintf( WIDE("Current on %d is %d"), psv, g.currents[psv] );
        imgGraphic = element->image;
        BlotScaledImage( surface, imgGraphic );
    }
}
Пример #2
0
void CPROC Output( uintptr_t psv, PRENDERER display )
{
	if( g.is_up[psv] )
	{
		Image surface = GetDisplayImage( display );
		Image imgGraphic;
		//lprintf( "Current on %d is %d", psv, g.currents[psv] );
		imgGraphic = (Image)GetLink( &g.images, g.currents[psv] );
		if( g.flags.bShowInverted )
			BlotScaledImageSizedEx( surface, imgGraphic, 0, 0, (surface)->width, (surface)->height, 0, 0, (imgGraphic)->width, (imgGraphic)->height, 0, BLOT_INVERTED );
		else
			BlotScaledImage( surface, imgGraphic );
	}
}
Пример #3
0
void CPROC SpriteDrawProc( uintptr_t psv, PRENDERER renderer, int32_t x, int32_t y, uint32_t w, uint32_t h )
{
	int had_one = 0;
	int n;
	for( n = 0; n < USE_SPRITES; n++ )
	{
		if( sprite[n].ttl )
		{
			rotate_scaled_sprite( GetDisplayImage( renderer ), sprite[n].sprite, rot, 0x10000, 0x10000 );
			had_one = 1;
		}
	}
	if( !had_one )
		l.renderer = NULL;

}
Пример #4
0
void ProcessMotion( void )
{
	int n;
	for( n = 0; n < USE_SPRITES; n++ )
	{
		if( sprite[n].ttl )
		{
			Image surface = GetDisplayImage( l.renderer );
			sprite[n].ttl--;
			sprite[n].sprite->curx += sprite[n].dx;
			sprite[n].sprite->cury += sprite[n].dy;
			if( sprite[n].sprite->curx < 50 )
				sprite[n].dx = ( 15 * rand() ) / RAND_MAX + 1;
			if( sprite[n].sprite->cury < 50 )
				sprite[n].dy = ( 15 * rand() ) / RAND_MAX + 1;
			if( sprite[n].sprite->curx > (surface->width - 50) )
				sprite[n].dx = -(( 15 * rand() ) / RAND_MAX + 1);
			if( sprite[n].sprite->cury > (surface->height-50) )
				sprite[n].dy = -(( 15 * rand() ) / RAND_MAX + 1);
		}
	}
}
Пример #5
0
int CPROC EditMouseCallback( uintptr_t dwUser, int32_t x, int32_t y, uint32_t b )
{
	static int _x, _y, _right, _left;
	int right, left;
	PEDITOR pe = (PEDITOR)dwUser;
	Image surface = GetDisplayImage( pe->hVideo );
	right = b & MK_RBUTTON;
	left = b & MK_LBUTTON;

	//if( pe->bLocked )
	//{/
	//}
	pe->ptMouseDel[0] = x - pe->ptMouse[0];
	pe->ptMouseDel[1] = y - pe->ptMouse[1];
	pe->ptMouse[0] = x;
	pe->ptMouse[1] = y;

	if( !(left + right + _left + _right) ) // just moving mouse..
	{
		if( pe->bLocked )
		{
			if( pe->ptMouseDel[0] > MOUSE_LOCK || pe->ptMouseDel[0] < -MOUSE_LOCK ||
				 pe->ptMouseDel[1] > MOUSE_LOCK || pe->ptMouseDel[1] < -MOUSE_LOCK )
			{
				pe->bLocked = FALSE;
				SetMousePosition( pe->hVideo, pe->ptMouse[0], pe->ptMouse[1] );
				return 1; // done....
			}
		}
		else
		{
			if( ( abs( pe->ptO[0] - x ) < MOUSE_LOCK ) &&
				 ( abs( pe->ptO[1] - y ) < MOUSE_LOCK ) )
			{
				pe->bLocked = TRUE;
				pe->ptMouseDel[0] = 0;
				pe->ptMouseDel[1] = 0;
				pe->ptMouse[0] = pe->ptO[0];
				pe->ptMouse[1] = pe->ptO[1];
			}
			else
			if( ( abs( pe->ptN[0] - x) < MOUSE_LOCK ) &&
				 ( abs( pe->ptN[1] - y ) < MOUSE_LOCK ) )
			{
				pe->bLocked = TRUE;
				pe->ptMouseDel[0] = 0;
				pe->ptMouseDel[1] = 0;
				pe->ptMouse[0] = pe->ptN[0];
				pe->ptMouse[1] = pe->ptN[1];
			}
		}

		if( pe->bLocked ) // only reset mouse if not dragging??
		{
			pe->ptMouse[0] -= pe->ptMouseDel[0];
			pe->ptMouse[1] -= pe->ptMouseDel[1];
			SetMousePosition( pe->hVideo, pe->ptMouse[0],
											 pe->ptMouse[1] );
		}

	}

	if( pe->bLocked )
	{
		x = pe->ptMouse[0] - pe->ptMouseDel[0];
		y = pe->ptMouse[1] - pe->ptMouseDel[0];
	}

	if( !right && _right )
	{
#ifdef __WINDOWS__
		IMAGE_POINT p;
		int nCmd;
		GetCursorPos( (POINT*)&p );
		nCmd = TrackPopup( pe->hMenu
								//, TPM_CENTERALIGN
								//| TPM_TOPALIGN
								//| TPM_RIGHTBUTTON
								//| TPM_RETURNCMD
								//| TPM_NONOTIFY
								//,p[0]
								//,p[1]
								,0
							  // ,NULL // pe->hVideo->hWndOutput
							  //,NULL
							  );
		switch( nCmd )
		{
		case MNU_ADDLINE:
			break;
		}
#endif
	}

	if( left && !_left ) // left click select...
	{
		if( x == pe->ptO[0] && y == pe->ptO[1] )
		{
			pe->bDragOrigin = TRUE;
		} 
		else if( x == pe->ptN[0] && y == pe->ptN[1] )
		{
			pe->bDragNormal = TRUE;
		}
		else
		{
			pe->bDragWorld = TRUE;
		}	
	}
	else if( !left && _left ) // end click...
	{
		pe->bDragOrigin = FALSE; // cancel all operations...
		pe->bDragNormal = FALSE;
		pe->bDragWorld = FALSE;
	}
	else if( left && _left ) // probably dont want to do this if !left && !_left
	{
		if( pe->bDragOrigin )
		{
			VECTOR vo;
			if( pe->ptMouseDel[0] || pe->ptMouseDel[1] )
			{
				GetOriginV( pe->TView, vo );
				Invert( vo );
				GetRealPoint(surface, (PVECTOR)vo, pe->ptMouse );
				Apply( (PCTRANSFORM)pe->TView, pe->pCurrentLine->r.o, vo ); // apply inverse -> Apply...
				// update Intersecting lines......
				/*
				{
					PLINESEG pl;
					PLINESEGPSET plps;
					int l;
					plps = pe->pCurrentFacet->pLineSet;
					pl = pe->pCurrentLine->pTo;
					
					for( l = 0; l < plps->nUsedLines; l++ )
					{
						pl = plps->pLines[l];
						if( pl == pe->pCurrentLine )
							continue;

					}

				}
				*/
				EditResizeCallback( (uintptr_t)pe ); // update screen...
			}
		} 
		else if( pe->bDragNormal )
		{
			VECTOR vn;
			if( pe->ptMouseDel[0] || pe->ptMouseDel[1] )
			{
				GetOriginV( pe->TView, vn );
				Invert( vn );
				GetRealPoint(surface, (PVECTOR)vn, pe->ptMouse );
				sub( vn, vn, pe->pCurrentLine->r.o );
				Apply( (PCTRANSFORM)pe->TView, pe->pCurrentLine->r.n, vn ); // apply inverse -> Apply...
				// update Intersecting lines......
				EditResizeCallback( (uintptr_t)pe ); // update screen...
			}
		}
		else if( pe->bDragWorld )
		{
			VECTOR v1, v2;
			if( pe->ptMouseDel[0] || pe->ptMouseDel[1] )
			{
				GetOriginV( pe->TView, v1 );
				Invert( v1 );
				v2[vForward] = v1[vForward];
				pe->ptMouseDel[0] = pe->ptMouse[0] - pe->ptMouseDel[0];
				pe->ptMouseDel[1] = pe->ptMouse[1] - pe->ptMouseDel[1];

				GetRealPoint(surface, (PVECTOR)v1, pe->ptMouse );
				GetRealPoint(surface, (PVECTOR)v2, pe->ptMouseDel );
				sub( v1, v2, v1 );
				v1[vForward] = 0; 
				TranslateRelV( pe->TView, v1 );
				EditResizeCallback( (uintptr_t)pe ); // update screen...
			}
		}

	}

	_x = x;
	_y = y;
	_right = right;
	_left  = left;
	return 1;
}
Пример #6
0
void CPROC EditResizeCallback( uintptr_t dwUser  )
{
	PEDITOR pe = (PEDITOR)dwUser;
	//PFACETSET *ppfs;
	//PFACET pf;

	//PLINESEGPSET *pplps;
	//PMYLINESEGSET *ppls;
	//PMYLINESEG pl;
	//int l;
	// ShowCurrent();
	//ClearImage( surface );
	{
		//IMAGE_RECTANGLE r;
		//GetDisplayPosition( pe->hVideo, pe->ptUpperLeft, pe->ptUpperLeft + 1, NULL, NULL );
		/*
		GetWindowRect( pe->hVideo->hWndOutput, &r );
		pe->ptUpperLeft[0] = r.left //+ GetSystemMetrics( SM_CXBORDER )
									  + GetSystemMetrics( SM_CXFRAME );
		pe->ptUpperLeft[1] = r.top + GetSystemMetrics( SM_CYBORDER )
									 + GetSystemMetrics( SM_CYFRAME )
									 + GetSystemMetrics( SM_CYCAPTION );
									 */
	}
#if 0
	SetClip( (RCOORD)GetDisplayImage( pe->hVideo )->width,
				(RCOORD)GetDisplayImage( pe->hVideo )->height );
	ppfs = pe->pCurrent->objinfo->ppFacetPool;
	ppls = GetFromSet( LINEPSEG, pe->pCurrent->objinfo->ppLinePool );
	//ForAllInSet( FACET, &pe->pCurrent->objinfo->ppFacetPool, DrawLineSegs );
	//int f;
	//for( f = 0; f < ; f++ )
	{
		int lines;
		//pf = GetFromSet( FACET, pfs->pFacets + f;
		pplps = &pf->pLineSet;
		lines = CountUsedInSet( LINESEGP, pf->pLineSet );
		for( l = 0; l < lines; l++ )
		{
			RAY ld; // local directional...
			PLINESEGP plsp = GetSetMember( LINESEGP, pplps, l );
			pl = GetSetMember( MYLINESEG, ppls, plsp->nLine );
			if( pl == pe->pCurrentLine )
			{
				ApplyInverseR( pe->TView, &ld, &pl->r );
				DrawLine(surface, ld.o, ld.n, pl->dFrom-5, pl->dFrom, Color( 192, 192, 0 ) );
				DrawLine(surface, ld.o, ld.n, pl->dFrom, pl->dTo, Color( 0, 150, 0 ) );
				DrawLine(surface, ld.o, ld.n, pl->dTo, pl->dTo+5, Color( 192, 192, 0 ) );
				GetViewPoint(surface, &pe->ptO, ld.o );
				add( ld.o, ld.o, ld.n ); // add one slope to origin to get slope point
				GetViewPoint(surface, &pe->ptN, ld.o );
				MarkOrigin( pe, surface );
				MarkSlope( pe,surface );
			}
			else
			if( pf = pe->pCurrentFacet )
			{
				ApplyInverseR( pe->TView, &ld, &pl->r );
				DrawLine(surface, ld.o, ld.n, pl->dFrom, pl->dTo, Color( 0, 0, 150 ) );
			}
			else
			{
				ApplyInverseR( pe->TView, &ld, &pl->r );
				DrawLine(surface, ld.o, ld.n, pl->dFrom, pl->dTo, Color( 92, 92, 92 ) );
			}
		}
	}
	UpdateDisplay( pe->hVideo );
#endif
}
Пример #7
0
void CPROC DrawImage( uintptr_t psv, PRENDERER out )
{
   PIMAGE_DISPLAY pdi = (PIMAGE_DISPLAY)psv;
	BlotImage( GetDisplayImage( pdi->display ), pdi->Loaded, 0, 0 );
   UpdateDisplay( pdi->display );
}
Пример #8
0
void CPROC Output( uintptr_t psv, PRENDERER display )
{
	surface = GetDisplayImage( display );
	{
		int step = 0;
		int n = _n;
		/*
		 // portion doesn't matter since we have to do the whole surface
		 // beause layered windows are kinda stupid.
		 int minx, maxx;
		 int miny, maxy;

		 minx = _ix[n];
		 maxx = _ix[(n-1)<0?9:(n-1)];
		 if( minx > maxx )
		 {
		 int tmp = minx;
		 minx = maxx;
		 maxx = tmp;
		 }
		 miny = _iy[n];
		 maxy = _iy[(n-1)<0?9:(n-1)];
		 if( miny > maxy )
		 {
		 int tmp = miny;
		 miny = maxy;
		 maxy = tmp;
		 }
		 */

		do
		{
			int next = n+1;
			if( next == MAX_STEPS )
				next = 0;
			if( step < (MAX_STEPS-1) )
			{
				if( step == 0 )
				{
					FillDifference( surface, n, next
									  , 0
									  , g.flags.bBlacking?BASE_COLOR_BLACK:0x01000000
									  );
				}
				else
				{
               if( g.flags.bBlacking )
						FillDifference( surface, n, next
										  , g.flags.bBlacking?1:0
										  , g.flags.bBlacking?SetAlpha(BASE_COLOR_BLACK,(0xFF)/(step)):SetAlpha(BASE_COLOR_BLACK,0xFF>>(step/2))
										  );
               else
						FillDifference2( surface, n, next
										  , g.flags.bBlacking?1:0
										  , 15, 16
										  );
				}
			}
			n++;
			step++;
			if( n == MAX_STEPS )
				n = 0;
		}
		while( n != _n );
		ix += dx;
		if( ix < 0 )
		{
			ix = 0;
			dx = (rand(  ) * 12 / RAND_MAX + 1);
		}
		if( ix >= (width-imgGraphic->width ) )
		{
			ix = (width-imgGraphic->width )-1;
			dx = -(rand( ) * 12 / RAND_MAX + 1);
		}

		iy += dy;
		if( iy < 0 )
		{
			iy = 0;
			dy = (rand(  ) * 12 / RAND_MAX + 1);
		}
		if( iy >= (height-imgGraphic->height ) )
		{
			iy = (height-imgGraphic->height )-1;
			dy = -(rand( ) * 12 / RAND_MAX + 1);
		}

		// wait until full history before drawing...
		//UpdateDisplay( display );//, ix, iy, imgGraphic->width, imgGraphic->height  );
		_ix[_n] = ix;
		_iy[_n] = iy;
		_n++;
		if( _n == MAX_STEPS )
		{
			wrapped = 1;
			_n = 0;
		}
	}
Пример #9
0
int main( void )
{
	uint32_t width, height;
	uint32_t imagecount = 0;
	uint32_t testimagesatinitialization = 0;
	Image blank;

	srand( time( NULL ) );

	for(width=0; width< NUM_REELS; width++)
	{
		g.uiSpeedCounter[width] = 0;
		g.uiSpeedStep[width] = 2;
		g.idx[width]= 0;
	}

	g.pdi = GetDisplayInterface();
	g.pii = GetImageInterface();

			//SetSystemLog( SYSLOG_FILE, stdout );
   SetSystemLoggingLevel( 1000 + LOG_NOISE);
	GetDisplaySize( &width, &height );;
	g.render = OpenDisplaySizedAt( 0, width, height, 0, 0 );
	UpdateDisplay(g.render);
	g.surface = GetDisplayImage( g.render );
	SetMouseHandler( g.render, MouseMethod, 0 );

//	blank = LoadImageFile( WIDE("blankimage.jpg"));
	blank = MakeImageFile(96,96);
   ClearImageTo( blank, BASE_COLOR_CYAN );
	g.playagain=LoadImageFile( WIDE("%images%/playagain.jpg"));
	g.playing  =LoadImageFile( WIDE("%images%/playing.jpg"));
   g.background = LoadImageFile( WIDE("%images%/background.jpg") );
//   g.background = blank;
	g.strip = LoadImageFile( WIDE("%images%/slot_strip.jpg") );
	g.nReels = NUM_REELS;


	{
      Image icons[NUM_ICONS];
		int n, m;
      INDEX idx;

		for( n = 0; n < NUM_ICONS; n++ )
		{
			icons[n] = MakeSubImage( g.strip, 96 * n, 0, 96, 96 );
		}
		n =  width = imagecount = height = 0;
		while(imagecount < NUM_IMAGES )
		{
			idx = rand()%NUM_ICONS;
			g.images[imagecount] = icons[idx];
			if( testimagesatinitialization )
			{
				BlotImage( g.surface, g.images[imagecount], width * 96, height * 96 );
				width++;
				if(!( width % 8 ))
				{
					width=0;
					height++;
				}
			}
         imagecount++;
  			for( m = 0; m < (( rand()%2 )  ); m++)
  			{
				g.images[imagecount] = blank;
				if( testimagesatinitialization )
				{
					BlotImage( g.surface, g.images[imagecount], width * 96, height * 96 );
					width++;
					if(!( width % 8 ))
					{
						width=0;
						height++;
					}
				}
				imagecount++;
			}

			if( testimagesatinitialization )
			{
				SyncRender( g.render);
				UpdateDisplay(g.render);
			}

		}
		if( !testimagesatinitialization )
		{
				SyncRender( g.render);
				UpdateDisplay(g.render);
		}


		for( n = 0; n < NUM_BLURS; n++ )
		{
			g.blurs[n] = MakeImageFile( 96, (NUM_PICS) * 96 );
         g.dodges[n] = MakeImageFile( 96, (NUM_PICS) * 96 );
			for( m = 0; m < NUM_IMAGES; m++ )
			{
            idx = rand()%NUM_IMAGES;
				g.reel[0][m] = g.images[idx];
			}
			Blur( g.blurs[n], g.reel[0] );
			DodgeEx( g.dodges[n], g.reel[0] , 2);
		}
		for( n = 0; n < NUM_REELS; n++)
		{
			g.subsurface[n]  = MakeSubImage( g.surface
													 , REEL_OFSX + REEL_STEPX * n
													 ,  REEL_OFSY
													 , REEL_WIDTH, (96 * NUM_PICS_IN_WINDOW) );
			g.testsurface[n] = MakeSubImage( g.surface, REEL_OFSX + REEL_STEPX * n + 480,  REEL_OFSY , REEL_WIDTH, (96 * NUM_PICS) );
		}
		g.statussurface = MakeSubImage( g.surface
												, 490, 10
												, 140,  68
												);


		g.backgroundsurface = MakeSubImage( g.surface
												, 0, 0
												, 640,  460
												);
	}
   g.flags.bBackgroundInitialized = 0;

	ThreadTo( ReadInput, 0 );

	{
		uint32_t start = GetTickCount();
		xlprintf(LOG_NOISE)("Started at %lu"
								 , start);
      g.ofs = 0;
		while( 1 )
		{
			if( g.flags.bSpinning )
			{
				DrawSpinningReels(FALSE);
			}

#ifndef __ARM__
         // scale to approx unit speeds..
  			WakeableSleep( 250 );
			//WakeableSleep( 33);
#endif
		}
	}
	CloseDisplay( g.render );
	UnmakeImageFile( g.strip );
   return 0;
}
Пример #10
0
void Render( PRENDERER r, int output )
{
	int a,b;
	Image surface = GetDisplayImage( r );
	RCOORD aspect;

	if( !output_surface )
		output_surface = MakeImageFile( surface->width, surface->height );
	aspect = (RCOORD)output_surface->width / (RCOORD)output_surface->height;
	ofsx = (output_surface->width/2);
	ofsy = (output_surface->height/2);
	dx = display_scale*4.0 / (RCOORD)output_surface->width;
	dy = display_scale*4.0 / (RCOORD)output_surface->height;

	if( !drawn )
	{
		drawn = 1;
	ClearImage( output_surface);

   _ii1_max_iter = 0;
   _ii2_max_iter = 0;
   {
		RCOORD dam, dbm;
		dam = ( mx - ofsx ) * dx + xorg;
		dbm = ( my - ofsy ) * dy + yorg;
	for( a = 0; a < output_surface->width; a++ )
	{
		for( b = 0; b < output_surface->height; b++ )
		{
			RCOORD da, db;
			RCOORD rda, rdb;
			int r, g = 0, bl  = 0;
			int direction;
			//rda = ( ( b *2 ) / (RCOORD)output_surface->height) * sin(3.14159/2 + ( ( a * 2*3.14159 ) / (RCOORD)output_surface->width));
			//rdb = ( ( b *2 ) / (RCOORD)output_surface->height) * cos(3.14159/2 + ( ( a * 2*3.14159 ) / (RCOORD)output_surface->width));
			//da = ( rda  ) + xorg;
			//db = ( rdb ) + yorg;

			da = aspect * ( a - ofsx ) * dx + xorg;
			db = ( b - ofsy ) * dy + yorg;
			//if( (r = IsInfinite( dam, dbm, da, db )) == -1 )
				r = 0;

			/*
			// draw just in range of the cursor 
			if( !( ( (mx - a) > -20) && ( (mx-a) < 20 )
				&& ( (my - b) > -20 ) && ( (my - b) < 20 ) ) )
			{
				continue;
			}
			*/
			//if( (g = IsInfinite2( dam, dbm, da, db )) == -1 )
			//	g = 0;
			bl = IsInfinite2( 0, 0, da, db, &direction );
			if( (direction) < 0 )
			{
				r = ( -bl );
				bl = 0;
			}
			else if( bl < 0 )
			{
				g = 32;
				bl = 0;
				//r = 0;
			}
			else if( bl != 0 )
			{
				//r = 0;
				bl = bl;
			}
			//else
			//	r = 0;
			if( g == 255 )
			{
				int a = 3;
			}
			{

				// point pair horiz -0.123 (R) 0.35071355833500363833634934966131      
				//                    0.422(I)  0.64961527075646859365525325998975
				//
				// point pair vert  -0.563(R)  0.75033325929216279143681201481957  0(I)     /*distance to next 0.49986672471039669667784846697923*/
				// point pair vert  -1.563(R)  1.2501999840025594881146604817988   0(I)    /* to next 0.1125178884860932415243100526011 */
				// next is -1.857         (R)  1.3627178724886527296389705343999   0(I)

				RCOORD unity = da*da + db*db;
				RCOORD offset_unity = (da+0.123)*(da+0.123) + db*db;
			if( unity < 0.564 && unity >= 0.562 )
				plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_WHITE, 64, 256 ) );
			else if( offset_unity < 0.422 && offset_unity >= 0.420 )
				plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_WHITE, 64, 256 ) );
			else if( unity < 1.001 && unity >= 0.999 )
				plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_WHITE, 138, 256 ) );
			else if( unity < 1.564 && unity >= 1.562 )
				plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_WHITE, 64, 256 ) );
			else if( unity < 1.868 && unity >= 1.866 )
				plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_WHITE, 64, 256 ) );
			else if( da >= -0.125 && da <= -0.122 )
				plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_BLUE, 64, 256 ) );
			else if( da >= -0.001 && da <= 0.001 )
				plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_GREEN, 64, 256 ) );
			else if( db >= -0.001 && db <= 0.001 )
				plot( output_surface, a, b, ColorAverage( Color(r,g,bl), BASE_COLOR_ORANGE, 64, 256 ) );
			else
				plot( output_surface, a, b, Color(r,g,bl) );
			}
		}
	}
   }


   ii1_max_iter = _ii1_max_iter;
   ii2_max_iter = _ii1_max_iter;
	if( output )
	{
		// actually put the changes on the screen....
		PutString( output_surface, 10, 10, BASE_COLOR_WHITE, BASE_COLOR_BLACK, "Alt+TAB and select application,\nThen Press ALT+F4 to Exit. " );
	}
	}
	BlotImage( surface, output_surface, 0, 0 );

	{
	   {
			RCOORD dam, dbm;
			dam = ( mx - ofsx ) * dx + xorg;
			dbm = ( my - ofsy ) * dy + yorg;
		for( a = -20; a <= 20; a++ )
		{
			for( b = -20; b <= 20; b++ )
			{
				RCOORD da, db;
				int r, g = 0, bl  = 0;
				int direction;
				float v1[3];
				float v2[3];
				da = aspect * ( mx + a - ofsx ) * dx + xorg;
				db = ( my + b - ofsy ) * dy + yorg;
				r = 0;
				bl = IsInfinite2( 0, 0, da, db, &direction );
				if( (direction) < 0 )
				{
					v1[vForward] = bl * 0.05;
					r = ( bl );
					bl = 0;
				}
				else if( bl < 0 )
				{
					v1[vForward] = 0.5;
					g = 32;
					bl = 0;
					//r = 0;
				}
				else if( bl != 0 )
				{
					v1[vForward] = bl * 0.04;
					//r = 0;
					bl = bl;
				}
				//else
				//	r = 0;
				if( g == 255 )
				{
					int a = 3;
				}
				glBegin( GL_LINES );
				v2[vRight] = v1[vRight] = ( mx + a ) * 0.1;
				v2[vUp] = v1[vUp] = ( my + b ) * 0.1;
				v2[vForward] = 0;
				glColor4ub( r*0xFF,g,bl,255 );
				glVertex3fv( v1 );
				glVertex3fv( v2 );
				glEnd();
				//plot( output_surface, a, b, Color(r,g,bl) );
			}
		}
	   }

	}


	{
		RCOORD da, db;
		int r, g, bl  = 0;
		int iter;
		da = aspect * ( mx - ofsx ) * dx + xorg;
		db = ( my - ofsy ) * dy + yorg;
		//iter = DrawInfinite2( output_surface, 0, 0, da, db, dx, dy, ofsx, ofsy );
		iter = GLDrawInfinite2( output_surface, 0, 0, da, db, dx, dy, ofsx, ofsy );
		if( 0 )
		{
			TEXTCHAR buf[256];
			snprintf( buf,256, "%d   %d,%d = %g, %g", iter, mx, my, da, db );
			PutString( output_surface, 10, 50, BASE_COLOR_WHITE, BASE_COLOR_BLACK, buf );
		}
	}
}