Path: chuka.playstation.co.uk!news From: (Jack) Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: Screen flicker Date: Sat, 17 Oct 1998 14:54:10 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 251 Message-ID: <3628a5ea.2751668@news.playstation.co.uk> References: <36278d19.18773715@news.playstation.co.uk> <7081ou$alr7@scea> NNTP-Posting-Host: host5-99-60-85.btinternet.com X-Newsreader: Forte Free Agent 1.11/32.235 On Fri, 16 Oct 1998 11:14:14 -0700, "Steve Spiller" wrote: >I may be wrong here, but... Are you drawing to both of your buffers? What >I mean to say is... If you are using double buffering, but only drawing to >one of the buffers, every other screen refresh would be a blank screen. > >Perhaps posting the code would help? > >-Steve Cheers Steve, Here you go I'm putting up the code. I hope someone can sort out the flickering. Jack. #include #include #include #include "pad.h" #define true (1) #define false (0) #define OTABLE_LENGTH (12) #define MAX_PACKETS (248000) #define PAL_WIDTH (320) #define PAL_HEIGHT (240) #define NTSC_WIDTH (320) #define NTSC_HEIGHT (256) #define TIMLOC (0x80094000) GsSPRITE sprite; GsBOXF box1; GsBOXF box2; int collision; int collision_x1; int collision_x2; int collision_y1; int collision_y2; int Running = true; u_long VerticalSync = 0; GsOT OT[2]; GsOT_TAG OT_Array[2][1< 0) bounce = true; //if (box1.x < 0) bounce2 = true;}; //for (bounce = 0; bounce < 2; bounce++); if (collision_x1 == true) if (box1.x >= 0) box1.x +=15; //for (bounce2 = 0; bounce > -2; bounce--); if (collision_x2 == true) if (box1.x >= 0) box1.x -=15; //for (box1.x +=15; box1.x >200; box1.x-=15); //if ((box1.x > 0)== true) box1.x =-15;}; //for (box1.x -=15; box1.x <-200; box1.x+=15); //if ((box1.x < 0)== true) box1.x =+15;}; //}; }; /****************COLLISION DETECTION*******************/ void CD(){ if (box1.x > (box2.x + box2.w-1)==collision_x1|| box2.x > (box1.x + box1.w-1)==collision_x2|| box1.y > (box2.y + box2.h-1)==collision_y1|| box2.y > (box1.y + box1.h-1)==collision_y1) collision_x1 = collision_x2 = collision_y1 = collision_y2 = false; //} else { collision_x1 = collision_x2 = collision_y1 = collision_y2 = true; } //collision = false; if (collision == true) FntPrint("\ncollision\n"); else FntPrint("\nno collision\n"); }; /********************INITIALISE GAME*********************/ void initSprite() { GsIMAGE img; RECT rect; //FntLoad(960,256); //FntOpen(0,0,PAL_WIDTH,PAL_HEIGHT,0,512); GsGetTimInfo((u_long*)(TIMLOC+4),&img); rect.x = img.px; rect.y = img.py; rect.w = img.pw; rect.h = img.ph; LoadImage(&rect,img.pixel); if ((img.pmode>>3)&0x01) { rect.x = img.cx; rect.y = img.cy; rect.w = img.cw; rect.h = img.ch; LoadImage(&rect,img.clut); } switch (img.pmode) { case 0x08: //4 bit with CLUT sprite.attribute = 0x00000000; sprite.w = img.pw*4; sprite.tpage = GetTPage(0,0,img.px,img.py); break; case 0x09: //8 bit with CLUT sprite.attribute = 0x01000000; sprite.w = img.pw*2; sprite.tpage = GetTPage(1,0,img.px,img.py); break; default: //16 bit sprite.attribute = 0x02000000; sprite.w = img.pw; sprite.tpage = GetTPage(2,0,img.px,img.py); break; } sprite.x = 10; sprite.y = 10; sprite.h = img.ph; sprite.u = 0; sprite.v = 0; sprite.cx = img.cx; sprite.cy = img.cy; sprite.r = 60; sprite.g = 60; sprite.b = 60; sprite.mx = sprite.w/2; sprite.my = sprite.h/2; sprite.scalex = 4096; sprite.scaley = 4096; sprite.rotate = 0; } void initBox(){ box1.attribute = 50; box1.x = 10; box1.y = 10; box1.w = 50; box1.h = 50; box1.r = 0; box1.g = 0; box1.b = 80; box2.attribute = 50; box2.x = -50; box2.y = 10; box2.w = 50; box2.h = 50; box2.r = 80; box2.g = 0; box2.b = 0; }