Example #1
0
LRESULT CALLBACK AnimationWndHandler(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	PAINTSTRUCT ps;
	HDC	hDC;

	switch( message ) 
	{
	case WM_CLOSE:
		 DRAW.particles=0;
		 Shutdown_GL(GLRC_Animation);
		 ghWndAnimation=NULL;
  		 DefWindowProc( hWnd, message, wParam, lParam );
		break;

	case WM_KEYDOWN:
			  SendMessage(ghWndMain, message,wParam,lParam);
	case WM_SIZE: 
		  Size_GL(hWnd, GLRC_Animation,0);	
	case WM_MOVE:
			{
			WINDOWPLACEMENT  wndpl;
			GetWindowPlacement(hWnd, &wndpl);
			GLOBAL.anim_top=wndpl.rcNormalPosition.top;
			GLOBAL.anim_left=wndpl.rcNormalPosition.left;
			GLOBAL.anim_right=wndpl.rcNormalPosition.right;
			GLOBAL.anim_bottom=wndpl.rcNormalPosition.bottom;
			}
			break;
	case WM_PAINT:
			hDC = BeginPaint(hWnd, &ps);
			wglMakeCurrent(hDC, GLRC_Animation);
			DrawGLParticles();			//  Do All The Drawing
			SwapBuffers(hDC);
			wglMakeCurrent(0, 0);
			EndPaint(hWnd, &ps);
		break;
	default:
			return DefWindowProc( hWnd, message, wParam, lParam );
   }
   return 0;
}
Example #2
0
LRESULT CALLBACK AVIWndHandler(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int t;
    AVIOBJ * st;

    st=NULL;

    for (t=0; (t<GLOBAL.objects)&&(st==NULL); t++)
        if (objects[t]!=NULL)
            if (objects[t]->type==OB_AVI)
            {   st=(AVIOBJ *)objects[t];
                if (st!=NULL) if (st->displayWnd!=hWnd) st=NULL;
            }

    if (st!=NULL)
        switch( message )
        {

        case WM_DESTROY:
            Shutdown_GL(st->GLRC);
            break;
        case WM_KEYDOWN:
            SendMessage(ghWndMain, message,wParam,lParam);
            break;
        case WM_ACTIVATE:
            if (wParam==WA_CLICKACTIVE)
            {
                close_toolbox();
                actobject=st;
//		  actobject->make_dialog();
                SetActiveWindow(hWnd);
                SetFocus(hWnd);
            }
            break;

        case WM_COMMAND:
            break;
        case WM_SIZE:
        //	Size_GL(hWnd, st->GLRC,1);
        case WM_MOVE:
        {
            WINDOWPLACEMENT  wndpl;
            GetWindowPlacement(st->displayWnd, &wndpl);
            st->top=wndpl.rcNormalPosition.top;
            st->left=wndpl.rcNormalPosition.left;
            st->right=wndpl.rcNormalPosition.right;
            st->bottom=wndpl.rcNormalPosition.bottom;
        }
        InvalidateRect(st->displayWnd,NULL,FALSE);
        break;

        case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC	hDC = BeginPaint(hWnd, &ps);

            if (strcmp(st->avifile,"none"))
            {
                wglMakeCurrent(hDC, st->GLRC);
                //glLoadIdentity ();													// Reset The Modelview Matrix
                //glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);		// Clear Screen And Depth Buffer
                st->GrabAVIFrame(st->frame,hDC);										// Grab A Frame From The AVI
                wglMakeCurrent(0, 0);
            }
            EndPaint(hWnd, &ps);

        }
        break;

        default:
            return DefWindowProc( hWnd, message, wParam, lParam );
        }
    else 	return DefWindowProc( hWnd, message, wParam, lParam );
    return 0;
}