Hi all!
Question: Whats the best way to add animation to a VC++ Windows program? eg. You click a button and a person walks across the screen?
Thankyou all!!!
Weever~
This is a discussion on Anim! within the Windows Programming forums, part of the Platform Specific Boards category; Hi all! Question: Whats the best way to add animation to a VC++ Windows program? eg. You click a button ...
Hi all!
Question: Whats the best way to add animation to a VC++ Windows program? eg. You click a button and a person walks across the screen?
Thankyou all!!!
Weever~
mhm.. the bestway?
maybe a video! you load a video file and display it...
or you can animate a few images yourself with a timer...
depends on what do you want to do
Hope you don't mind my bad english, I'm Austrian!
Sorry, I better give a bit more info. Basically I want to write an interactive program that teaches people how to play cards using animation and images rather than just writhing a plain old Word document or power point presentation. eg. I want a card to move to the middle of the screen when the user presses next or if a computer player looses, there would be an animated squence of the player falling off their seat.
I want to make it clear I am not programming a game, just a teaching aid, so all events will happen in an ordered sequence.
I hope I've made it a little clearer now.
Thankyou all,
Weever~
Sadly, animation in windows is no trivial affair. It demands a lot of work and development. Right now I am working on a C++ class which will automate most of it and I will post it in a couple of weeks. Until then, though(and I'm away from my compiler so I cannot be too specific), basically, you must create one HBITMAP for each 'frame' in the animation, plus an HBITMAP for the corresponding 'mask' of each frame. You must perform I think 6 BitBlt operations that AND/OR/INVERT, etc, each frame and it's mask onto the background. A very yucky process indeed!
Check back for that C++ class, though...
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}
I have a sample of code.... if you would like it.... I wrote a black jack game which displays some cards and chips... and has some primitive sound effects.... email me if you want a copy....
zMan
by the way enter www.cprogramming.com on the subject line.... I get a lot of junk email....
zMan
Its not that hard to do, if you just want to get started, using GDI you can just load a sequence of images and play them back a a sample rate by timechecking (SYSTEMTIME == SYSTEMTIME) or w/e formula, or just slwo ur prog down w/ 'Sleep'.
However you choose to do it, its not "that" hard to get going, its once you start doing professional grade in anything thats hard... also I dont think (not that its a bad thing) that you could'ent have thoguth of how to do with w/o this board.... I mean theres only one way I know of movies work...
Have fun! SPH![]()
![]()
![]()
I have wirtten you a little program, it will play 'simple' Bitmap based animations, and not all of the meath if "perfect", feal free to touchb it up and intergrate it all into anything u need... this is just an example (It should be attached to this message).
SPH![]()
![]()
![]()
P.S. If you have any "extensive" questions... IM or Email Me: (Adresses / SN's are in my profile).
I've got a couple of ideas now so thank you for all your help, but I've used both OpenGL and DirectX to produce various forms of animation before. Am I best just sticking with one of these and integrating it into the rest of the Windows program?
Thanx,
weever~
So am I best just using one of the graphical API's I mentioned above or is there some way of importing animated clips created in something like Director?
Thanx,
Weever~