Beispiel #1
0
void CSolidView::OnPaint()
{
		if(m_size.x > 0 && m_size.y > 0 && ((m_size.x != xres) || (m_size.y != yres)))
		{
			uninitdirectdraw();
			xres = m_size.x;
			yres = m_size.y;
			initdirectdraw(xres,yres, colbits);
			m_initdirectdraw_called = true;
		}
		if(m_initdirectdraw_called)
		{
			//setcylinder(&p0, &p1, cr, -1, 0);
			//updatevxl();
			doframe();
		}

		this->m_refresh_wanted = false;
}
Beispiel #2
0
main(int argc,char *argv[])
{
	FILE	*f1;
	int	f;
	f1=fopen(argv[1],"rb");
	if(f1==NULL) return(0);
	fread(&header,sizeof(header),1,f1);
	lw=header.heigth;
	/**/
	_asm mov ax,13h
	_asm int 10h
	saveframe(-1);
	for(f=0;f<header.frames;f++) 
	{
		doframe(f1);
		saveframe(f);
	}
	saveframe(-2);
	/**/
	fclose(f1);
	return(0);
}
Beispiel #3
0
int main(int argc,char *argv[]) {

	SDL_Event event;
	clock_t starttime;
	int start_clock;
	int releasetime,now;

#ifdef DEBUGTOFILE
	output=fopen("debug.txt","wa");
	if (output==NULL)
		printf("Failed to open file debug.txt\n");
#endif

	if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
		fprintf(stderr,"Couldn't initialise SDL: %s\n", SDL_GetError());
		return 1;
	}
	atexit(SDL_Quit);
	SDL_WM_SetCaption("transience",NULL);
#ifdef DO_FULLSCREEN
#define XTRASDLVMBITS | SDL_FULLSCREEN
#else
#define XTRASDLVMBITS
#endif
	screen=SDL_SetVideoMode(SCRWID,SCRHEI,SCRBPS, SDL_HWPALETTE XTRASDLVMBITS );
	if (screen==NULL) {
		fprintf(stderr,"Couldn't initialise video.\n");
		return 1;
	}

	setuplookups();
	// srand(time(NULL));
	init();

#ifdef REDEFINE
	fp=fopen("incl.c","wa");
	if (fp==NULL)
		printf("Failed to open file incl.c\n");
	printSurfaceDetails(fp,"screen",screen);
	fclose(fp);
#endif

	starttime = clock()+CLOCKS_PER_SEC/desiredFramesPerSecond;

	start_clock = clock();
	releasetime = now = start_clock;

	while (keepLooping) {

		releasetime = start_clock+frames*CLOCKS_PER_SEC/desiredFramesPerSecond;
		// if (releasetime<now)
			// releasetime = now+CLOCKS_PER_SEC/desiredFramesPerSecond;

		if ((frames % 20) == 0) {
			fprintf(output,"\rframes/second: %.2f",(float)CLOCKS_PER_SEC*(float)frames/(float)(now-starttime));
		}

		framebits=((float)clock()-start_clock)*20.0/CLOCKS_PER_SEC;


		doframe();



		frames++;

#ifndef LEAVE_EVENTS_ALONE
		while (SDL_PollEvent(&event)) {
			if ( ( event.type==SDL_KEYDOWN && ( event.key.keysym.sym == SDLK_q || event.key.keysym.sym == SDLK_F10 ) ) || event.type==SDL_QUIT || event.type==SDL_MOUSEBUTTONDOWN) {
				keepLooping=0;
			}
		}
#endif

#ifdef KEEP_TO_FPS
		while ((now=clock())<releasetime) {
			// Not in DOS
			// sched_yield();
			// SDL_Delay(12);
		}
#endif

		// SDL_Flip(screen);
		SDL_UpdateRect(screen,0,0,SCRWID,SCRHEI);

	}

	fprintf(output,"\n");
#ifdef DEBUGTOFILE
	fclose(output);
#endif
	return 0;

}