Animation and Timers

I have been working on this project for school for a little bit now and I have run into a problem. When I run my code and click the start button under file in the client window the timer should start counting and incrementing the x and y positions, but nothing happens and also I cant seem to figure out how to keep the ellipse from leaving the client area. Everything else in the program works. If anyone has any ideas or suggestions on how to fix this is would be much appreciated. Here is the code that im having trouble with, im not quite sure if im missing something in one of my functions to get the time to start and to make the ellipse stay in the client area.



case WM_SIZE:
nXSize= LOWORD(lParam);
nYSize= HIWORD(lParam);
InvalidateRect(hWnd, NULL, TRUE);
break;




case ID_FILE_KILL:
if(kill=true){
KillTimer(hWnd,1);
}
break;

case ID_FILE_START:
if(start=true){
SetTimer(hWnd,1,50,NULL);
}
break;
Last edited on
Your code is rather involved, so it's pretty hard to follow when unformatted. Please go back and edit your post to use code tags.

Thanks

Andy

How to use code tags
http://www.cplusplus.com/forum/articles/42672/
This is the part that im having problems with, so if anyone know what im missing or any clues on how to make this work it would be greatly appreciated.
tags?

Andy
These are the snipers of code I'm having troubles with!!!
Please use code tags around the snippets.
scuse me for being real basic, this is how i set it up, if that's what you needed...

my WM_TIMER function calls WM_PAINT..

1
2
3
4
5
6
7
	case WM_TIMER:
		if (!pause) {
			dostuff();
			InvalidateRgn(hmain,0,0);
			UpdateWindow (hmain);
		}
		break;


movement and drawing is handled in dostuff()
Last edited on
Yea that helps what about keeping it from leaving the client area
well... you have options.

boundaries can:

limit (if x > wide) x = wide

wrap (if x> wide) x -= wide

bounce/reflect (if x > wide) vel = -vel
Topic archived. No new replies allowed.