zer0
Member #6,501
October 2005
|
First, heres my draw code:
1 | //DRAW DISPLAY | 2 | | 3 | // clear dblBuff and lock the screen (not sure what the purpose is yet, though :P) | 4 | acquire_screen(); | 5 | clear(dblBuff); | 6 | | 7 | | 8 | // Draw the snow, shifted by scroll. Two blits. | 9 | blit(landscape, dblBuff, scroll, 0, 0, SCREEN_H - landscape->h, landscape->w - scroll, landscape->h); | 10 | blit(landscape, dblBuff, 0, 0, landscape->w - scroll, SCREEN_H - landscape->h, scroll, landscape->h); | 11 | | 12 | // Draw all the background snowflakes | 13 | for( std::vector<SFlake *>::iterator iter = BackFlakes.begin(); | 14 | iter != BackFlakes.end(); iter++ ) | 15 | { | 16 | (*iter)->Draw(dblBuff); | 17 | } | 18 | | 19 | // Draw all enemies. | 20 | for( std::vector<Enemy *>::iterator iter = enemies.begin(); | 21 | iter != enemies.end(); iter++ ) | 22 | { | 23 | (*iter)->Draw(dblBuff); | 24 | } | 25 | | 26 | // Draw all bullets. | 27 | for( std::vector<Bullet *>::iterator iter = bullets.begin(); | 28 | iter != bullets.end(); iter++ ) | 29 | { | 30 | (*iter)->Draw(dblBuff); | 31 | } | 32 | | 33 | // draw all particles. | 34 | for( std::vector<Particle *>::iterator iter = particles.begin(); | 35 | iter != particles.end(); iter++ ) | 36 | { | 37 | (*iter)->Draw(dblBuff); | 38 | } | 39 | | 40 | // draw powerups | 41 | for( std::vector<Powerup *>::iterator iter = pUps.begin(); | 42 | iter != pUps.end(); iter++ ) | 43 | { | 44 | (*iter)->Draw(dblBuff); | 45 | } | 46 | | 47 | // draw the player | 48 | playa.Draw(dblBuff); | 49 | | 50 | // let the playe rknow the map has restarted | 51 | if( restart_timer > 0 ) | 52 | { | 53 | draw_sprite( dblBuff, restart, 160, 228 ); | 54 | } | 55 | | 56 | if( show_level_timer > 0 ) | 57 | { | 58 | draw_level_sprite(dblBuff, level_sprite, level_nums[level-1]); | 59 | } | 60 | | 61 | // draw foreground snowflakes | 62 | for( std::vector<SFlake *>::iterator iter = ForeFlakes.begin(); | 63 | iter != ForeFlakes.end(); iter++ ) | 64 | { | 65 | (*iter)->Draw(dblBuff); | 66 | } | 67 | | 68 | textprintf(dblBuff, font, 10, 10, makecol(255,255,255), "FPS: %d", fps ); | 69 | textprintf(dblBuff, font, 10, 20, makecol(255,255,255), "HEALTH: %d", playa.health ); | 70 | blit( dblBuff, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H ); | 71 | release_bitmap(screen); | 72 | frames_drawn++; |
Now, whenever I run this program in fullscreen (640x480) at a color depth of 16, it flickers. But only when I don't run it from Visual Studio .NET 2003. If I just compile and run it from the GUI, it works fine. So I tried putting in vysnc();, and it locks my FPS at 60, but flickers even worse. Then I tried messing around with video_bitmaps, aquire bitmap, etc., all for nothing. And this is for a christmas hack game, but I was just hoping I could put it out in fullscreen, not windowed.
|