Path: chuka.playstation.co.uk!news From: "Chris Searle" Newsgroups: scee.yaroze.programming.2d_graphics,scee.yaroze.beginners,scea.yaroze.programming.2d_graphics Subject: Need help with arrays Date: Mon, 17 Aug 1998 21:51:29 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 53 Message-ID: <6rcfhe$l2e4@chuka.playstation.co.uk> NNTP-Posting-Host: cxs97c.netkonect.co.uk X-Newsreader: Microsoft Outlook Express 4.72.3115.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Xref: chuka.playstation.co.uk scee.yaroze.programming.2d_graphics:515 scee.yaroze.beginners:504 scea.yaroze.programming.2d_graphics:398 Hi, I've got an array, u_long line[640], and want to copy a random 320 chunks to a two-dimensional array here some source: #include #include #include u_long scr[240][320]; u_long line[640]; main() { RECT screen; short counter; SetVideoMode(MODE_PAL); GsInitGraph(320, 240, 4, 0, 0); GsDefDispBuff(0, 0, 0, 0); screen.x = screen.y = 0; screen.h = 240; screen.w = 320; for( counter = 0; counter < 640; counter++) { if(rand()%2) line[counter] = (1<<15) + (31<<10) + (31<<5) + 31; //set pixels to else line[counter] = (1<<15); //black or white } // setup first array while(1) { VSync(0); for(counter = 0; counter < 240; counter++) { //This part doesn't work memcpy( scr+(counter*320), line+(rand()%320), 640 ); //copy 640 bytes (320 int's) } LoadImage( &screen, *scr ); DrawSync(0); GsSwapDispBuff(); } // end while ResetGraph(0); } // end main This is a simple programming question but I do need some help. Cheers