int main() { InitGraphics(); giftable.packet_count = GIF_PACKET_MAX; giftable.packet = &packets[0]; InitSprites(); while(1) { GsGifPacketsClear(&giftable); // clear the area that we are going to put the sprites/triangles/.... MoveSprites(); DrawSprites(&giftable); //add stuff to the packet area GsDrawSync(0); GsVSync(0); GsClearDrawEnv1(&draw_env); // clear the draw environment before we draw stuff on it GsGifPacketsExecute(&giftable, 1); // set to '1' becuse we want to wait for drawing to finish. if we dont wait we will write on packets that is currently writing to the gif } return 0; }
int main() { InitGraphics(); packet_table[0].packet_count = GIF_PACKET_MAX; packet_table[0].packet = &packets[0][0]; packet_table[1].packet_count = GIF_PACKET_MAX; packet_table[1].packet = &packets[1][0]; /* // change Background color draw_env[0].bg_color.b = 255; draw_env[0].bg_color.r = 255; draw_env[0].bg_color.g = 255; draw_env[1].bg_color.b = 255; draw_env[1].bg_color.r = 255; draw_env[1].bg_color.g = 255; */ while(1) { active_buffer = GsDbGetDrawBuffer(); GsGifPacketsClear(&packet_table[active_buffer]); // clear the area that we are going to put the sprites/triangles/.... MovePoint(); DrawTriangles(&packet_table[active_buffer], active_buffer); //add stuff to the packet area GsDrawSync(0); //wait for the previous buffer to finish drawing GsVSync(0); //display the previous drawn buffer SelectDisplayContext( GsDbGetDisplayBuffer() ); //tell CRTC which context we want to see on our tv // clear the draw environment before we draw stuff on it ClearDrawingContext(active_buffer); GsGifPacketsExecute(&packet_table[active_buffer], 0); // '0' we dont have to wait because we have 2 buffers (GsDrawSync(0) will do the wait) GsDbSwapBuffer(); } return 0; }