From: Fabio S. <fab...@ne...> - 2003-11-27 12:41:37
|
At 13:30 27/11/2003 +0100, you wrote: >Fabio Stange wrote: > > > { > > /* Now all you did to that memory bitmap goes into the > > screen all at once, no noise, no flicker */ > > blit (...) // my_screen -> screen > > my_screen =3D screen; > > destroy_bitmap (my_screen); > > } > >Err, if I understand correctly you just did a >"destroy_bitmap(screen)", effectively. That's definitely not good >practice: screen is a video bitmap, and you're not supposed to touch >it! You just draw to it. (Correct me if I'm wrong.) Ops. You are right. I didn=B4t have my own code to post here, so this popped out of my head and= =20 went wrong. But that could be easilly corrected with: { BITMAP *tmp; /* Now all you did to that memory bitmap goes into the screen all at once, no noise, no flicker */ blit (...) // my_screen -> screen tmp =3D my_screen my_screen =3D screen; destroy_bitmap (tmp); } And the idea remains the same. I like to use these functions because it seems to simplify a lot to me. All= =20 my other functions remain untouched, and I don=B4t need to worry where I=B4m= =20 writing to. >The standard practice would be to > >BITMAP *buffer =3D create_bitmap(SCREEN_W, SCREEN_H); (or smaller, if > you have a large > virtual screen) >while (1) // gameloop >{ > clear_to_color(buffer, makecol(0,0,0)); > > // draw something on buffer > > blit(buffer, screen, ...); // blit buffer to screen >} > > >That way you don't have to touch the screen bitmap at all. > >Hein Zelle > > > >-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-< > Unix is user friendly. It's just very particular about who > it's friends are. > > Hein Zelle he...@ic... > http://www.icce.rug.nl/~hein > >-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-< > > >------------------------------------------------------- >This SF.net email is sponsored by: SF.net Giveback Program. >Does SourceForge.net help you be more productive? Does it >help you create better code? SHARE THE LOVE, and help us help >YOU! Click Here: http://sourceforge.net/donate/ >-- >https://lists.sourceforge.net/lists/listinfo/alleg-main |