Qbasicnews.com

Full Version: Animation under the GDI
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know programming in windows is convoluted, but I'm getting a little frustrated searching for help on animation. I'm not interested in DX or winG or OGL or any of that. I just need to be able to demonstrate moving a bitmap around.

I've got a double buffer set up, using an hBitmap and a second DC for it, but I can't seem to get bitmaps out of the resources and onto the screen.

There's a lot of discussion about DIBs and DDBs, but most of it seems to end in 'so that's that now use directx.'

Any good tutorial/sample code on this? (I'm on VC5)
Really all you need is LoadImage, which returns a HBITMAP, and then use SelectObject to select the bitmap you get from LoadImage into a buffer DC for your graphics. Then of course use BitBlt from the bitmap's DC to the backbuffer DC, then bitblt from back buffer to screen.

Try using some simpler graphics primitives on your back buffer (SetPixel, Rectangle, etc.) and make sure everything is copied to your screen correctly. Then work on bitmap loading.
Although it's not updated anymore and intended for VB, allapi.net has very good examples on using the Windows API. It has easy to understand examples on almost everything. What you would be insterested in it BitBlt and TranspatentBlt.
See topic. Search for win32 api. The FIRST site has all the info you need:

http://www.winprog.org/tutorial/

If you really need to know more, uh (visits own site for affliate) here: http://www.fromoesoft.com/

Under small programs, all his games are Pure GDI. Should be easy enough to grasp. Personally i just use allegro over GDI since i find it easier to work with.
No offense, but allegro sucks. If you're going to go that way, you may as well use DX, which is what he doesn't want to do.
I don't think it sucks. You can do neat things with it and it is nice and easy to code with. Just like QB.
It has known issues, it's and most importantly, it's slooooooooooow.

It does, however, has the advantage of being cross-platform compatable.
Sure, it is very slow. But for small things it will suffice. Yeah, your games are portable (as long as you can code "portablely"), and that's a plus.

To throw in a small game fast and easily it is superb. That's why I compare it to QB: With some talent you can do great things without much of a hassle.
Quote:Try using some simpler graphics primitives on your back buffer (SetPixel, Rectangle, etc.) and make sure everything is copied to your screen correctly. Then work on bitmap loading.

I actually had this all working already -- rectangles and lines and textout on an hBufferDC and everything -- I was just having trouble with the actual bitmap loading.

Thanks for the site pointers, people. I'll check those out.
You may want to take a look at FreeImage which all it does is load/save image files to DIBs in memory.