Skip to main content
GameDev.net gamedev.net
🔒 Locked

Animating with GDI

Started by NeoLordAsm Aug 9, 2002 at 8:28 AM 5 replies 450+ views
Original Post
NeoLordAsm
NeoLordAsm
I need to make an animation similar to the MSWord help doggy. The animation needs to be displayed anywhere in the screen(not only in the window area). Anyone can explain me how to do this with GDI? -Roger-
Paradigm Shifter
Paradigm Shifter
From MSDN (took a bit of finding due to searching for "desktop and "window")...

The GetDesktopWindow() function returns a handle to the desktop window. The desktop window covers the entire screen. The desktop window is the area on top of which all icons and other windows are painted.

That should do the trick...
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
niyaw
niyaw
make a popup window and position it where you want the animation to be, and draw the animation to that window. look into layered windows if you need transparency. unfortunately, those are 2k+, so if anyone has a solution for transparent windows for 98, i'd like to hear it too.

edit: found something useful on my harddrive (you can find all sorts of things there, eh? ). it's "making a screenmate" presentation by felisandria that she mentioned a while ago. since i can't find the url to the presentation on the web, i uploaded it here. should be an interesting read.

[edited by - niyaw on August 9, 2002 10:21:06 AM]
xstreme2000
xstreme2000
Transparency can be done with regions, see

SetWindowRgn();

For more help flipCode.com have an article on them called "Win32 Window Skinning":

http://www.flipcode.com/articles/article_win32skins.shtml

Edit:
Just thought, these won't be very good for animation because the region would keep changing shape.


[edited by - xstreme2000 on August 9, 2002 10:25:09 AM]
NeoLordAsm
NeoLordAsm
quote:
Original post by xstreme2000
Transparency can be done with regions, see

SetWindowRgn();

For more help flipCode.com have an article on them called "Win32 Window Skinning":

http://www.flipcode.com/articles/article_win32skins.shtml

Edit:
Just thought, these won''t be very good for animation because the region would keep changing shape.


[edited by - xstreme2000 on August 9, 2002 10:25:09 AM]


Well, I cannot change region since I''m already using regions to make my app skinned. I figured out how to blt the screen creating a dc with GetDC(NULL). But now I come with another problem. How I erase what I''ve blitted in order to blit the next frame?
Or there is any other *better* way of doing a animation?

-Roger-
Auron
Auron
To erase what you''ve drawn, you could use a dirty rectangle system: just store what was already in the area before you draw it and blit it back afterward.

Alternately, you may be able to get a handle for whatever windows are underneath your screen buddy and invalidate them so they''ll redraw themselves right over top of what you drew.

Another idea, but one I''m of which I''m not sure of its usefullness: If you have the DX7 SDK, there''s an example program IIRC that animates a sprite of a mosquito in the same way you''re hoping to achieve. If you can use DirectX, that might help. But even if not, the source might have something that could help you.

I know these ideas aren''t the best but at least they''re starting points. There probably is a much simpler or better solution than all of these but at least it''s a bit of a starting point.
doctorsixstring
doctorsixstring
quote:
Original post by NeoLordAsm
Well, I cannot change region since I''m already using regions to make my app skinned.



Why would that matter? You can create as many regions as you want, and "regionize" as many windows as you want (assigning a region to a window is not skinning).

My advice would be to follow what niyaw said: create a child window and draw your image to that. Since you will be doing animation on the window, you could just change the window''s region every time you change the animation''s frame (performance probably won''t be an issue).

quote:
Original post by NeoLordAsm
How [can] I erase what I''ve blitted in order to blit the next frame?



Look up InvalidateRect().

Good luck!

-Mike

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.