Esempio n. 1
0
PEDITOR CreateEditor( POBJECT po )
{
	PEDITOR pe;
	pe = (PEDITOR)Allocate( sizeof( EDITOR ) );
	MemSet( pe, 0, sizeof( EDITOR ) );
	pe->TView = CreateTransform();
	pe->hVideo = OpenDisplaySizedAt( 0, -1, -1, -1, -1 );
	//InitVideo( "World Editor" );
	SetRedrawHandler( pe->hVideo, (void (CPROC*)(uintptr_t,PRENDERER))EditResizeCallback, (uintptr_t)pe );
	SetMouseHandler( pe->hVideo, EditMouseCallback, (uintptr_t)pe );
	BindEventToKey( pe->hVideo, KEY_PGUP, 0, PageUpKey, (uintptr_t)pe );
	BindEventToKey( pe->hVideo, KEY_PGDN, 0, PageDownKey, (uintptr_t)pe );
  // SetCloseHandler( pe->hVideo, EditCloseCallback, (uintptr_t)pe );

	// menu for this instance....
#ifdef __WINDOWS__
	pe->hMenu = CreatePopup(); //CreatePopupMenu();
	AppendPopupItem( pe->hMenu, MF_STRING, MNU_ADDPREDEF+0, "Add Square" );
	AppendPopupItem( pe->hMenu, MF_STRING, MNU_ADDPREDEF+1, "Add Triangle" );
	AppendPopupItem( pe->hMenu, MF_STRING, MNU_ADDLINE, "Add Line" );
#else
	pe->hMenu = NULL;
#endif
	SetPoint( vToScreen, VectorConst_Z ); // facing into screen...
	Invert( vToScreen );	 // facing out of screen...

	pe->pCurrent = po;
	pe->pCurrentFacet = NULL; //po->objinfo.FacetPool.pFacets + 0;
	pe->pCurrentLine = NULL; //po->objinfo.LinePool.pLines + 0;

	ClearTransform( pe->TView );
	Translate( pe->TView, 0, 
						  0, 
						  (RCOORD)-100.0 );

	pe->bLocked = FALSE;

	EditResizeCallback( (uintptr_t)pe);
	UpdateDisplay( pe->hVideo );
	return pe;
}
Esempio n. 2
0
void AddImage( char *name )
{
   PIMAGE_DISPLAY pdi;
	pdi = New( IMAGE_DISPLAY );

	pdi->Loaded = LoadImageFile( name );
	if( !pdi->Loaded )
	{
		Release( pdi );
      return;
	}
   pdi->display = OpenDisplaySizedAt( 0
												, pdi->Loaded->width, pdi->Loaded->height
												, g.x, g.y );
	SetRedrawHandler( pdi->display, DrawImage, (uintptr_t)pdi );
   DrawImage( (uintptr_t)pdi, pdi->display );
	SetKeyboardHandler( pdi->display, KeyHandler, 0 );
	g.x += 10;
   g.y += 10;
	if( ( pdi->next = g.images ) )
      pdi->next->me = &pdi->next;
	pdi->me = &g.images;
	g.images = pdi;
}
Esempio n. 3
0
int main( void )
{
	int32_t x, y;
	uint32_t w, h;
	PRENDERER renderer;

	l.pii = GetImageInterface();
   l.pri = GetDisplayInterface();
	SetSystemLog( SYSLOG_FILE, stdout );
	GetDisplaySizeEx( 0, &x, &y, &w, &h );
	renderer = OpenDisplaySizedAt( 0, w, h, x, y );
	SetTouchHandler( renderer, touch_events, 0 );
	UpdateDisplay( renderer );
	while( 1 )
	{
      WakeableSleep( 1000 );
	}

#if 0
   HOOKPROC hkprcSysMsg;
static HINSTANCE hinstDLL; 
static HHOOK hhookSysMsg; 
 
hinstDLL = LoadLibrary(TEXT("c:\\myapp\\sysmsg.dll")); 
hkprcSysMsg = (HOOKPROC)GetProcAddress(hinstDLL, "SysMessageProc"); 

hhookSysMsg = SetWindowsHookEx( 
                    WH_SYSMSGFILTER,
                    hkprcSysMsg,
                    hinstDLL,
                    0); 

SetWindowsHookEx(
#endif
   return 0;
}
Esempio n. 4
0
SaneWinMain(argc, argv )
//int main( int argc, char **argv )
{
	int x = 0;
	int y = 0;
	uint32_t width, height;
	int w, h;
	g.pdi = GetDisplayInterface();
	g.pii = GetImageInterface();
	RegisterIcon( NULL );
	GetDisplaySize( &width, &height );
	w = width; h = height;


	y = x  = 0;

	{
		int state = 0;
		int arg;
		g.fade_in = 500;
		g.show_time = 1000;
		for( arg = 1; arg < argc; arg++ )
		{

			if( argv[arg][0] == '-' )
			{
				if( argv[arg][1] == 'i' )
				{
					g.flags.bShowInverted = 1;
				}
				else
				{
					switch( state )
					{
					case 0:
						x = atoi( argv[arg]+1 );
						break;
					case 1:
						y = atoi( argv[arg]+1 );
						break;
					case 2:
						w = atoi( argv[arg]+1 );
						break;
					case 3:
						h = atoi( argv[arg]+1 );
						break;
					case 4:
						g.show_time = atoi( argv[arg]+1 );
						break;
					case 5:
						g.fade_in = atoi( argv[arg]+1 );
						break;
					}
					state++;
				}
			}
			else
			{
				Image x = LoadImageFile( argv[arg] );
				if( x )
				{
					g.nImages++;
					AddLink( &g.images, x );
				}
			}
		}
	}

	if( g.nImages )
	{
		g.displays[0] = OpenDisplaySizedAt( DISPLAY_ATTRIBUTE_LAYERED|DISPLAY_ATTRIBUTE_CHILD|DISPLAY_ATTRIBUTE_NO_MOUSE|DISPLAY_ATTRIBUTE_NO_AUTO_FOCUS
													 , w //width
													 , h //height
													 , x //0
													 , y //0
													 );
		g.displays[1] = OpenDisplaySizedAt( DISPLAY_ATTRIBUTE_LAYERED|DISPLAY_ATTRIBUTE_CHILD|DISPLAY_ATTRIBUTE_NO_MOUSE|DISPLAY_ATTRIBUTE_NO_AUTO_FOCUS
													 , w //width
													 , h //height
													 , x //0
													 , y //0
													 );

		SetRedrawHandler( g.displays[0], Output, 0 );
		SetRedrawHandler( g.displays[1], Output, 1 );

		if( g.nImages > 1 )
		{
			target_in_start = GetTickCount();
			AddTimer( 33, tick, 0 );
		}
		else
		{
			//lprintf( "Show the first and only the first image." );
			g.is_up[0] = 1;
			RestoreDisplay( g.displays[0] );
			UpdateDisplay( g.displays[0] );
		}

		while( 1 )
			WakeableSleep( 10000 );
	}
	else
	{
	}
	return 0;
}
Esempio n. 5
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;
}